aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Basic/Version.cpp
diff options
context:
space:
mode:
authorSylvestre Ledru <sylvestre@debian.org>2020-07-08 13:33:34 +0200
committerSylvestre Ledru <sylvestre@debian.org>2020-07-08 14:02:02 +0200
commitbbea4d5e6b82a683dccaa8f4916e2a44f5dd3490 (patch)
treed28d89af85a9d1bbeed0a32f1af0eb79ab77e879 /clang/lib/Basic/Version.cpp
parent88c82474d2ef92d0cda7d902206d90a73eed9c9d (diff)
downloadllvm-bbea4d5e6b82a683dccaa8f4916e2a44f5dd3490.zip
llvm-bbea4d5e6b82a683dccaa8f4916e2a44f5dd3490.tar.gz
llvm-bbea4d5e6b82a683dccaa8f4916e2a44f5dd3490.tar.bz2
clang: Don't show a trailing space with --version when not built from the repo
Reported here: https://bugs.llvm.org/show_bug.cgi?id=38998#c15 Reviewers: hans Differential Revision: https://reviews.llvm.org/D83386
Diffstat (limited to 'clang/lib/Basic/Version.cpp')
-rw-r--r--clang/lib/Basic/Version.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/clang/lib/Basic/Version.cpp b/clang/lib/Basic/Version.cpp
index c4b7d34..286107c 100644
--- a/clang/lib/Basic/Version.cpp
+++ b/clang/lib/Basic/Version.cpp
@@ -97,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();
}
@@ -111,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();
}