]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lld/lib/Config/Version.cpp
MFV r309587:
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lld / lib / Config / Version.cpp
1 //===- lib/Config/Version.cpp - LLD Version Number ---------------*- C++-=====//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file defines several version-related utility functions for LLD.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #include "lld/Config/Version.h"
15 #include "llvm/Support/raw_ostream.h"
16
17 using namespace llvm;
18
19 namespace lld {
20
21 StringRef getLLDRepositoryPath() {
22 #ifdef LLD_REPOSITORY_STRING
23   return LLD_REPOSITORY_STRING;
24 #else
25   return "";
26 #endif
27 }
28
29 StringRef getLLDRevision() {
30 #ifdef LLD_REVISION_STRING
31   return LLD_REVISION_STRING;
32 #else
33   return "";
34 #endif
35 }
36
37 std::string getLLDRepositoryVersion() {
38   std::string S = getLLDRepositoryPath();
39   std::string T = getLLDRevision();
40   if (S.empty() && T.empty())
41     return "";
42   if (!S.empty() && !T.empty())
43     return "(" + S + " " + T + ")";
44   if (!S.empty())
45     return "(" + S + ")";
46   return "(" + T + ")";
47 }
48
49 StringRef getLLDVersion() {
50 #ifdef LLD_VERSION_STRING
51   return LLD_VERSION_STRING;
52 #else
53   return "";
54 #endif
55 }
56
57 } // end namespace lld