[PATCH] D83386: clang: Don't show a trailing space with --version when not built from the repo
Sylvestre Ledru via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 8 04:46:54 PDT 2020
sylvestre.ledru created this revision.
sylvestre.ledru added reviewers: thakis, hans.
Herald added a project: clang.
Reported here:
https://bugs.llvm.org/show_bug.cgi?id=38998#c15
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D83386
Files:
clang/lib/Basic/Version.cpp
Index: clang/lib/Basic/Version.cpp
===================================================================
--- clang/lib/Basic/Version.cpp
+++ clang/lib/Basic/Version.cpp
@@ -97,8 +97,12 @@
#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 @@
#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();
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83386.276376.patch
Type: text/x-patch
Size: 857 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200708/8dfc305b/attachment-0001.bin>
More information about the cfe-commits
mailing list