forked from OSchip/llvm-project
More git-svn compatible version string, by request.
If you're using git-svn, the clang and llvm repository will typically map to a different revision. Before we had: clang version 3.1 (trunk 152167 trunk 152162) After this change: clang version 3.1 (trunk 152167) (llvm/trunk 152162) So it's self-descriptive with an extra parens group. Which is more compatible with version string parsers is probably debatable, but this style was requested. llvm-svn: 152183
This commit is contained in:
parent
e86f8f4df9
commit
9179e8a4a3
|
@ -58,9 +58,11 @@ std::string getLLVMRepositoryPath() {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Trim path prefix off, assuming path came from standard llvm path.
|
// 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/");
|
size_t Start = URL.find("llvm/");
|
||||||
if (Start != StringRef::npos)
|
if (Start != StringRef::npos)
|
||||||
URL = URL.substr(Start + 5);
|
URL = URL.substr(Start);
|
||||||
|
|
||||||
return URL;
|
return URL;
|
||||||
}
|
}
|
||||||
|
@ -86,6 +88,8 @@ std::string getClangFullRepositoryVersion() {
|
||||||
llvm::raw_string_ostream OS(buf);
|
llvm::raw_string_ostream OS(buf);
|
||||||
std::string Path = getClangRepositoryPath();
|
std::string Path = getClangRepositoryPath();
|
||||||
std::string Revision = getClangRevision();
|
std::string Revision = getClangRevision();
|
||||||
|
if (!Path.empty() || !Revision.empty()) {
|
||||||
|
OS << '(';
|
||||||
if (!Path.empty())
|
if (!Path.empty())
|
||||||
OS << Path;
|
OS << Path;
|
||||||
if (!Revision.empty()) {
|
if (!Revision.empty()) {
|
||||||
|
@ -93,13 +97,16 @@ std::string getClangFullRepositoryVersion() {
|
||||||
OS << ' ';
|
OS << ' ';
|
||||||
OS << Revision;
|
OS << Revision;
|
||||||
}
|
}
|
||||||
|
OS << ')';
|
||||||
|
}
|
||||||
// Support LLVM in a separate repository.
|
// Support LLVM in a separate repository.
|
||||||
std::string LLVMRev = getLLVMRevision();
|
std::string LLVMRev = getLLVMRevision();
|
||||||
if (!LLVMRev.empty() && LLVMRev != Revision) {
|
if (!LLVMRev.empty() && LLVMRev != Revision) {
|
||||||
|
OS << " (";
|
||||||
std::string LLVMRepo = getLLVMRepositoryPath();
|
std::string LLVMRepo = getLLVMRepositoryPath();
|
||||||
if (!LLVMRepo.empty())
|
if (!LLVMRepo.empty())
|
||||||
OS << ' ' << LLVMRepo;
|
OS << LLVMRepo << ' ';
|
||||||
OS << ' ' << LLVMRev;
|
OS << LLVMRev << ')';
|
||||||
}
|
}
|
||||||
return OS.str();
|
return OS.str();
|
||||||
}
|
}
|
||||||
|
@ -110,8 +117,8 @@ std::string getClangFullVersion() {
|
||||||
#ifdef CLANG_VENDOR
|
#ifdef CLANG_VENDOR
|
||||||
OS << CLANG_VENDOR;
|
OS << CLANG_VENDOR;
|
||||||
#endif
|
#endif
|
||||||
OS << "clang version " CLANG_VERSION_STRING " ("
|
OS << "clang version " CLANG_VERSION_STRING " "
|
||||||
<< getClangFullRepositoryVersion() << ')';
|
<< getClangFullRepositoryVersion();
|
||||||
|
|
||||||
// If vendor supplied, include the base LLVM version as well.
|
// If vendor supplied, include the base LLVM version as well.
|
||||||
#ifdef CLANG_VENDOR
|
#ifdef CLANG_VENDOR
|
||||||
|
|
Loading…
Reference in New Issue