[cfe-commits] r97620 - /cfe/trunk/lib/Basic/Version.cpp

Ted Kremenek kremenek at apple.com
Tue Mar 2 17:02:49 PST 2010


Author: kremenek
Date: Tue Mar  2 19:02:48 2010
New Revision: 97620

URL: http://llvm.org/viewvc/llvm-project?rev=97620&view=rev
Log:
Make getClangRevision() check that SVN_VERSION is an empty string 
(even if it is defined).  This fixes the issue of this function
returning '0' when SVN_VERSION is defined to be "".

Fixes: <rdar://problem/7663667>

Modified:
    cfe/trunk/lib/Basic/Version.cpp

Modified: cfe/trunk/lib/Basic/Version.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Version.cpp?rev=97620&r1=97619&r2=97620&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Version.cpp (original)
+++ cfe/trunk/lib/Basic/Version.cpp Tue Mar  2 19:02:48 2010
@@ -40,15 +40,15 @@
 }
 
 std::string getClangRevision() {
-#ifndef SVN_REVISION
-  // Subversion was not available at build time?
-  return "";
-#else
-  std::string revision;
-  llvm::raw_string_ostream OS(revision);
-  OS << strtol(SVN_REVISION, 0, 10);
-  return revision;
+#ifdef SVN_REVISION
+  if (SVN_VERSION[0] != '\0') {
+    std::string revision;
+    llvm::raw_string_ostream OS(revision);
+    OS << strtol(SVN_REVISION, 0, 10);
+    return revision;
+  }
 #endif
+  return "";
 }
 
 std::string getClangFullRepositoryVersion() {





More information about the cfe-commits mailing list