diff --git a/clang/lib/Basic/Version.cpp b/clang/lib/Basic/Version.cpp --- a/clang/lib/Basic/Version.cpp +++ b/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(); }