blob: ba31544384cb0973bada623c55987604445fcf7b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
//===- Version.cpp - Clang Version Number -----------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file defines several version-related utility functions for Clang.
//
//===----------------------------------------------------------------------===//
#include <cstring>
#include <cstdlib>
using namespace std;
namespace clang {
const char *getClangSubversionPath() {
static const char *Path = 0;
if (Path)
return Path;
static char URL[] = "$URL: http://llvm.org/svn/llvm-project/cfe/trunk/lib/Basic/Version.cpp $";
char *End = strstr(URL, "/lib/Basic");
if (End)
*End = 0;
End = strstr(URL, "/clang/tools/clang");
if (End)
*End = 0;
char *Begin = strstr(URL, "cfe/");
if (Begin) {
Path = Begin + 4;
return Path;
}
Path = URL;
return Path;
}
unsigned getClangSubversionRevision() {
#ifndef SVN_REVISION
// Subversion was not available at build time?
return 0;
#else
return strtol(SVN_REVISION, 0, 10);
#endif
}
} // end namespace clang
|