diff options
author | rdivacky <rdivacky@FreeBSD.org> | 2010-01-23 11:10:26 +0000 |
---|---|---|
committer | rdivacky <rdivacky@FreeBSD.org> | 2010-01-23 11:10:26 +0000 |
commit | 2fce988e86bc01829142e4362d4eff1af0925147 (patch) | |
tree | c69d3f4f13d508570bb5257a6aea735f88bdf09c /lib/Basic | |
parent | a3fa5c7f1b5e2ba4d6ec033dc0e2376326b05824 (diff) | |
download | FreeBSD-src-2fce988e86bc01829142e4362d4eff1af0925147.zip FreeBSD-src-2fce988e86bc01829142e4362d4eff1af0925147.tar.gz |
Update clang to r94309.
Diffstat (limited to 'lib/Basic')
-rw-r--r-- | lib/Basic/Makefile | 5 | ||||
-rw-r--r-- | lib/Basic/Targets.cpp | 2 | ||||
-rw-r--r-- | lib/Basic/Version.cpp | 42 |
3 files changed, 43 insertions, 6 deletions
diff --git a/lib/Basic/Makefile b/lib/Basic/Makefile index 5bd4314..f733578 100644 --- a/lib/Basic/Makefile +++ b/lib/Basic/Makefile @@ -17,10 +17,13 @@ BUILD_ARCHIVE = 1 CXXFLAGS = -fno-rtti CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include +ifdef CLANG_VENDOR +CPPFLAGS += -DCLANG_VENDOR='"$(CLANG_VENDOR) "' +endif include $(LEVEL)/Makefile.common -SVN_REVISION := $(shell cd $(PROJ_SRC_DIR)/../.. && svnversion) +SVN_REVISION := $(shell $(LLVM_SRC_ROOT)/utils/GetSourceVersion $(PROJ_SRC_DIR)/../..) CPP.Defines += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include \ -DSVN_REVISION='"$(SVN_REVISION)"' diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp index bba2c3f..ea076ae 100644 --- a/lib/Basic/Targets.cpp +++ b/lib/Basic/Targets.cpp @@ -16,9 +16,9 @@ #include "clang/Basic/Builtins.h" #include "clang/Basic/Diagnostic.h" #include "clang/Basic/LangOptions.h" +#include "clang/Basic/MacroBuilder.h" #include "clang/Basic/TargetBuiltins.h" #include "clang/Basic/TargetOptions.h" -#include "clang/Frontend/Utils.h" #include "llvm/ADT/APFloat.h" #include "llvm/ADT/OwningPtr.h" #include "llvm/ADT/STLExtras.h" diff --git a/lib/Basic/Version.cpp b/lib/Basic/Version.cpp index ba31544..b1b250f 100644 --- a/lib/Basic/Version.cpp +++ b/lib/Basic/Version.cpp @@ -10,13 +10,17 @@ // This file defines several version-related utility functions for Clang. // //===----------------------------------------------------------------------===// + +#include "clang/Basic/Version.h" +#include "llvm/Support/raw_ostream.h" #include <cstring> #include <cstdlib> + using namespace std; namespace clang { -const char *getClangSubversionPath() { +llvm::StringRef getClangRepositoryPath() { static const char *Path = 0; if (Path) return Path; @@ -41,13 +45,43 @@ const char *getClangSubversionPath() { } -unsigned getClangSubversionRevision() { +llvm::StringRef getClangRevision() { #ifndef SVN_REVISION // Subversion was not available at build time? - return 0; + return llvm::StringRef(); #else - return strtol(SVN_REVISION, 0, 10); + static std::string revision; + if (revision.empty()) { + llvm::raw_string_ostream OS(revision); + OS << strtol(SVN_REVISION, 0, 10); + } + return revision; #endif } +llvm::StringRef getClangFullRepositoryVersion() { + static std::string buf; + if (buf.empty()) { + llvm::raw_string_ostream OS(buf); + OS << getClangRepositoryPath(); + llvm::StringRef Revision = getClangRevision(); + if (!Revision.empty()) + OS << ' ' << Revision; + } + return buf; +} + +const char *getClangFullVersion() { + static std::string buf; + if (buf.empty()) { + llvm::raw_string_ostream OS(buf); +#ifdef CLANG_VENDOR + OS << CLANG_VENDOR; +#endif + OS << "clang version " CLANG_VERSION_STRING " (" + << getClangFullRepositoryVersion() << ')'; + } + return buf.c_str(); +} + } // end namespace clang |