diff options
author | Jia Liu <proljc@gmail.com> | 2012-03-02 14:37:41 +0000 |
---|---|---|
committer | Jia Liu <proljc@gmail.com> | 2012-03-02 14:37:41 +0000 |
commit | 5c302484e9faaaa01b039f14c15c44b5006f1324 (patch) | |
tree | e63f3f1e4e7ae0081bfb209805cd30482cdfdf76 /clang/lib/Basic/Version.cpp | |
parent | a95b23ba9bc151bd5f99af2c579786a55ecbb9ba (diff) | |
download | llvm-5c302484e9faaaa01b039f14c15c44b5006f1324.zip llvm-5c302484e9faaaa01b039f14c15c44b5006f1324.tar.gz llvm-5c302484e9faaaa01b039f14c15c44b5006f1324.tar.bz2 |
clang -v support for separate clang.git and llvm.git, patch by Andrew Trick.
llvm-svn: 151910
Diffstat (limited to 'clang/lib/Basic/Version.cpp')
-rw-r--r-- | clang/lib/Basic/Version.cpp | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/clang/lib/Basic/Version.cpp b/clang/lib/Basic/Version.cpp index 10b9364..2934822 100644 --- a/clang/lib/Basic/Version.cpp +++ b/clang/lib/Basic/Version.cpp @@ -19,7 +19,7 @@ #include <cstdlib> namespace clang { - + std::string getClangRepositoryPath() { #if defined(CLANG_REPOSITORY_STRING) return CLANG_REPOSITORY_STRING; @@ -50,6 +50,21 @@ std::string getClangRepositoryPath() { #endif } +std::string getLLVMRepositoryPath() { +#ifdef LLVM_REPOSITORY + StringRef URL(LLVM_REPOSITORY); +#else + StringRef URL(""); +#endif + + // Trim path prefix off, assuming path came from standard llvm path. + size_t Start = URL.find("llvm/"); + if (Start != StringRef::npos) + URL = URL.substr(Start + 5); + + return URL; +} + std::string getClangRevision() { #ifdef SVN_REVISION return SVN_REVISION; @@ -58,6 +73,14 @@ std::string getClangRevision() { #endif } +std::string getLLVMRevision() { +#ifdef LLVM_REVISION + return LLVM_REVISION; +#else + return ""; +#endif +} + std::string getClangFullRepositoryVersion() { std::string buf; llvm::raw_string_ostream OS(buf); @@ -70,9 +93,17 @@ std::string getClangFullRepositoryVersion() { OS << ' '; OS << Revision; } + // Support LLVM in a separate repository. + std::string LLVMRev = getLLVMRevision(); + if (!LLVMRev.empty() && LLVMRev != Revision) { + std::string LLVMRepo = getLLVMRepositoryPath(); + if (!LLVMRepo.empty()) + OS << ' ' << LLVMRepo; + OS << ' ' << LLVMRev; + } return OS.str(); } - + std::string getClangFullVersion() { std::string buf; llvm::raw_string_ostream OS(buf); |