diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2020-07-26 19:36:28 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2020-07-26 19:36:28 +0000 | 
| commit | cfca06d7963fa0909f90483b42a6d7d194d01e08 (patch) | |
| tree | 209fb2a2d68f8f277793fc8df46c753d31bc853b /clang/lib/Basic/Version.cpp | |
| parent | 706b4fc47bbc608932d3b491ae19a3b9cde9497b (diff) | |
Notes
Diffstat (limited to 'clang/lib/Basic/Version.cpp')
| -rw-r--r-- | clang/lib/Basic/Version.cpp | 51 | 
1 files changed, 17 insertions, 34 deletions
diff --git a/clang/lib/Basic/Version.cpp b/clang/lib/Basic/Version.cpp index c69d13b2f689b..286107cab9d7b 100644 --- a/clang/lib/Basic/Version.cpp +++ b/clang/lib/Basic/Version.cpp @@ -28,46 +28,19 @@ std::string getClangRepositoryPath() {    return CLANG_REPOSITORY_STRING;  #else  #ifdef CLANG_REPOSITORY -  StringRef URL(CLANG_REPOSITORY); +  return CLANG_REPOSITORY;  #else -  StringRef URL(""); +  return "";  #endif - -  // If the CLANG_REPOSITORY is empty, try to use the SVN keyword. This helps us -  // pick up a tag in an SVN export, for example. -  StringRef SVNRepository("$URL$"); -  if (URL.empty()) { -    URL = SVNRepository.slice(SVNRepository.find(':'), -                              SVNRepository.find("/lib/Basic")); -  } - -  // Strip off version from a build from an integration branch. -  URL = URL.slice(0, URL.find("/src/tools/clang")); - -  // Trim path prefix off, assuming path came from standard cfe path. -  size_t Start = URL.find("cfe/"); -  if (Start != StringRef::npos) -    URL = URL.substr(Start + 4); - -  return URL;  #endif  }  std::string getLLVMRepositoryPath() {  #ifdef LLVM_REPOSITORY -  StringRef URL(LLVM_REPOSITORY); +  return LLVM_REPOSITORY;  #else -  StringRef URL(""); +  return "";  #endif - -  // Trim path prefix off, assuming path came from standard llvm path. -  // Leave "llvm/" prefix to distinguish the following llvm revision from the -  // clang revision. -  size_t Start = URL.find("llvm/"); -  if (Start != StringRef::npos) -    URL = URL.substr(Start); - -  return URL;  }  std::string getClangRevision() { @@ -124,8 +97,12 @@ std::string getClangToolFullVersion(StringRef ToolName) {  #ifdef CLANG_VENDOR    OS << CLANG_VENDOR;  #endif -  OS << ToolName << " version " CLANG_VERSION_STRING " " -     << getClangFullRepositoryVersion(); +  OS << ToolName << " version " CLANG_VERSION_STRING; + +  std::string repo = getClangFullRepositoryVersion(); +  if (!repo.empty()) { +    OS << " " << repo; +  }    return OS.str();  } @@ -138,7 +115,13 @@ std::string getClangFullCPPVersion() {  #ifdef CLANG_VENDOR    OS << CLANG_VENDOR;  #endif -  OS << "Clang " CLANG_VERSION_STRING " " << getClangFullRepositoryVersion(); +  OS << "Clang " CLANG_VERSION_STRING; + +  std::string repo = getClangFullRepositoryVersion(); +  if (!repo.empty()) { +    OS << " " << repo; +  } +    return OS.str();  }  | 
