summaryrefslogtreecommitdiffstats
path: root/gnu/llvm/tools/lld/lib/Config/Version.cpp
diff options
context:
space:
mode:
authorpatrick <patrick@openbsd.org>2017-01-24 08:32:59 +0000
committerpatrick <patrick@openbsd.org>2017-01-24 08:32:59 +0000
commit53d771aafdbe5b919f264f53cba3788e2c4cffd2 (patch)
tree7eca39498be0ff1e3a6daf583cd9ca5886bb2636 /gnu/llvm/tools/lld/lib/Config/Version.cpp
parentIn preparation of compiling our kernels with -ffreestanding, explicitly map (diff)
downloadwireguard-openbsd-53d771aafdbe5b919f264f53cba3788e2c4cffd2.tar.xz
wireguard-openbsd-53d771aafdbe5b919f264f53cba3788e2c4cffd2.zip
Import LLVM 4.0.0 rc1 including clang and lld to help the current
development effort on OpenBSD/arm64.
Diffstat (limited to 'gnu/llvm/tools/lld/lib/Config/Version.cpp')
-rw-r--r--gnu/llvm/tools/lld/lib/Config/Version.cpp52
1 files changed, 19 insertions, 33 deletions
diff --git a/gnu/llvm/tools/lld/lib/Config/Version.cpp b/gnu/llvm/tools/lld/lib/Config/Version.cpp
index 60687b9d894..25544756f8b 100644
--- a/gnu/llvm/tools/lld/lib/Config/Version.cpp
+++ b/gnu/llvm/tools/lld/lib/Config/Version.cpp
@@ -12,46 +12,32 @@
//===----------------------------------------------------------------------===//
#include "lld/Config/Version.h"
-#include "llvm/Support/raw_ostream.h"
using namespace llvm;
-namespace lld {
-
-StringRef getLLDRepositoryPath() {
-#ifdef LLD_REPOSITORY_STRING
- return LLD_REPOSITORY_STRING;
-#else
- return "";
-#endif
+// Returns an SVN repository path, which is usually "trunk".
+static std::string getRepositoryPath() {
+ StringRef S = LLD_REPOSITORY_STRING;
+ size_t Pos = S.find("lld/");
+ if (Pos != StringRef::npos)
+ return S.substr(Pos + 4);
+ return S;
}
-StringRef getLLDRevision() {
-#ifdef LLD_REVISION_STRING
- return LLD_REVISION_STRING;
-#else
- return "";
-#endif
-}
+// Returns an SVN repository name, e.g., " (trunk 284614)"
+// or an empty string if no repository info is available.
+static std::string getRepository() {
+ std::string Repo = getRepositoryPath();
+ std::string Rev = LLD_REVISION_STRING;
-std::string getLLDRepositoryVersion() {
- std::string S = getLLDRepositoryPath();
- std::string T = getLLDRevision();
- if (S.empty() && T.empty())
+ if (Repo.empty() && Rev.empty())
return "";
- if (!S.empty() && !T.empty())
- return "(" + S + " " + T + ")";
- if (!S.empty())
- return "(" + S + ")";
- return "(" + T + ")";
+ if (!Repo.empty() && !Rev.empty())
+ return " (" + Repo + " " + Rev + ")";
+ return " (" + Repo + Rev + ")";
}
-StringRef getLLDVersion() {
-#ifdef LLD_VERSION_STRING
- return LLD_VERSION_STRING;
-#else
- return "";
-#endif
+// Returns a version string, e.g., "LLD 4.0 (lld/trunk 284614)".
+std::string lld::getLLDVersion() {
+ return "LLD " + std::string(LLD_VERSION_STRING) + getRepository();
}
-
-} // end namespace lld