aboutsummaryrefslogtreecommitdiff
path: root/lib/Config/Version.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Config/Version.cpp')
-rw-r--r--lib/Config/Version.cpp27
1 files changed, 9 insertions, 18 deletions
diff --git a/lib/Config/Version.cpp b/lib/Config/Version.cpp
index b64ccef12c7b..60687b9d8940 100644
--- a/lib/Config/Version.cpp
+++ b/lib/Config/Version.cpp
@@ -13,8 +13,6 @@
#include "lld/Config/Version.h"
#include "llvm/Support/raw_ostream.h"
-#include <cstdlib>
-#include <cstring>
using namespace llvm;
@@ -37,22 +35,15 @@ StringRef getLLDRevision() {
}
std::string getLLDRepositoryVersion() {
- std::string buf;
- llvm::raw_string_ostream OS(buf);
- std::string Path = getLLDRepositoryPath();
- std::string Revision = getLLDRevision();
- if (!Path.empty() || !Revision.empty()) {
- OS << '(';
- if (!Path.empty())
- OS << Path;
- if (!Revision.empty()) {
- if (!Path.empty())
- OS << ' ';
- OS << Revision;
- }
- OS << ')';
- }
- return OS.str();
+ std::string S = getLLDRepositoryPath();
+ std::string T = getLLDRevision();
+ if (S.empty() && T.empty())
+ return "";
+ if (!S.empty() && !T.empty())
+ return "(" + S + " " + T + ")";
+ if (!S.empty())
+ return "(" + S + ")";
+ return "(" + T + ")";
}
StringRef getLLDVersion() {