Version.cpp revision 198092
1139749Simp//===- Version.cpp - Clang Version Number -----------------------*- C++ -*-===// 253855Simp// 353855Simp// The LLVM Compiler Infrastructure 453855Simp// 553855Simp// This file is distributed under the University of Illinois Open Source 653855Simp// License. See LICENSE.TXT for details. 753855Simp// 853855Simp//===----------------------------------------------------------------------===// 953855Simp// 1053855Simp// This file defines several version-related utility functions for Clang. 1153855Simp// 1253855Simp//===----------------------------------------------------------------------===// 1353855Simp#include <cstring> 1453855Simp#include <cstdlib> 1553855Simpusing namespace std; 1653855Simp 1753855Simpnamespace clang { 1853855Simp 1953855Simpconst char *getClangSubversionPath() { 2053855Simp static const char *Path = 0; 2153855Simp if (Path) 2253855Simp return Path; 2353855Simp 2453855Simp static char URL[] = "$URL: http://llvm.org/svn/llvm-project/cfe/trunk/lib/Basic/Version.cpp $"; 2553855Simp char *End = strstr(URL, "/lib/Basic"); 2653855Simp if (End) 2753855Simp *End = 0; 2853855Simp 2959272Simp char *Begin = strstr(URL, "cfe/"); 30129798Simp if (Begin) { 3197613Stakawata Path = Begin + 4; 3259272Simp return Path; 3353855Simp } 3453855Simp 3574636Simp Path = URL; 3674636Simp return Path; 3774636Simp} 3853855Simp 3953855Simp 4053855Simpunsigned getClangSubversionRevision() { 4153855Simp#ifndef SVN_REVISION 4253855Simp // Subversion was not available at build time? 4353855Simp return 0; 4453855Simp#else 4553855Simp return strtol(SVN_REVISION, 0, 10); 4653855Simp#endif 4759193Simp} 4853855Simp 4953855Simp} // end namespace clang 5059193Simp