aboutsummaryrefslogtreecommitdiff
path: root/lib/Basic/Version.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-10-05 20:33:49 +0000
committerDouglas Gregor <dgregor@apple.com>2009-10-05 20:33:49 +0000
commitb8d1191fdeb4eec9bc5cf9bf4b027add0fb467b3 (patch)
treeaf194a61af6a09e6076135b8d39bc755b8126d2f /lib/Basic/Version.cpp
parent60b5d8ed5993a2551c60e1b2400c3414a7070687 (diff)
Provide a common set of routines in Version.h that return Subversion
branch/revision information. Use that information in the driver, rather than one-off branch/revision computation. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83321 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Basic/Version.cpp')
-rw-r--r--lib/Basic/Version.cpp18
1 files changed, 2 insertions, 16 deletions
diff --git a/lib/Basic/Version.cpp b/lib/Basic/Version.cpp
index 3a51ccb5e7..9699ee416b 100644
--- a/lib/Basic/Version.cpp
+++ b/lib/Basic/Version.cpp
@@ -39,24 +39,10 @@ const char *getClangSubversionPath() {
unsigned getClangSubversionRevision() {
#ifndef SVN_REVISION
+ // Subversion was not available at build time?
return 0;
#else
- // What follows is an evil trick. We can end up getting three different
- // kinds of results when asking for the Subversion information:
- // - if SVN_REVISION is a number, we return that number (adding 0 to it is
- // harmless).
- // - if SVN_REVISION is "exported" (for an tree without any Subversion
- // info), we end up referencing the local variable "exported" and adding
- // zero to it, and we return 0.
- // - if SVN_REVISION is empty (because "svn info" returned no results),
- // the "+" turns into a unary "+" operator and we return 0.
- //
- // Making this less ugly requires doing more computation in the CMake- and
- // Makefile-based build systems, with all sorts of checking to make sure we
- // don't end up breaking this build. It's better this way. Really.
- const unsigned exported = 0;
- (void)exported;
- return SVN_REVISION + 0;
+ return strtol(SVN_REVISION, 0, 10);
#endif
}