diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2024-03-13 15:33:11 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-13 15:33:11 -0700 |
commit | 6885810e7de283ee8d3c8fc328a98544970b3db6 (patch) | |
tree | 01b9f2757bd8ebb932af1d4f2aa4eb30acc954d8 /llvm/lib/Support/CommandLine.cpp | |
parent | 35db929b50af51e18c75da74b23caa6c14beeaf6 (diff) | |
download | llvm-6885810e7de283ee8d3c8fc328a98544970b3db6.zip llvm-6885810e7de283ee8d3c8fc328a98544970b3db6.tar.gz llvm-6885810e7de283ee8d3c8fc328a98544970b3db6.tar.bz2 |
[llvm] Include LLVM_REPOSITORY and LLVM_REVISION in tool version (#84990)
Include the `LLVM_REPOSITORY` and `LLVM_REVISION` in the version output
of tools using `cl::PrintVersionMessage()` such as dwarfdump and
dsymutil.
Before:
```
$ llvm-dwarfdump --version
LLVM (http://llvm.org/):
LLVM version 19.0.0git
Optimized build with assertions.
```
After:
```
$ llvm-dwarfdump --version
LLVM (http://llvm.org/):
LLVM version 19.0.0git (git@github.com:llvm/llvm-project.git 8467457afc61d70e881c9817ace26356ef757733)
Optimized build with assertions.
```
rdar://121526866
Diffstat (limited to 'llvm/lib/Support/CommandLine.cpp')
-rw-r--r-- | llvm/lib/Support/CommandLine.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/llvm/lib/Support/CommandLine.cpp b/llvm/lib/Support/CommandLine.cpp index c076ae8..42dbc4d 100644 --- a/llvm/lib/Support/CommandLine.cpp +++ b/llvm/lib/Support/CommandLine.cpp @@ -39,6 +39,7 @@ #include "llvm/Support/Path.h" #include "llvm/Support/Process.h" #include "llvm/Support/StringSaver.h" +#include "llvm/Support/VCSRevision.h" #include "llvm/Support/VirtualFileSystem.h" #include "llvm/Support/raw_ostream.h" #include <cstdlib> @@ -2538,7 +2539,15 @@ public: #else OS << "LLVM (http://llvm.org/):\n "; #endif - OS << PACKAGE_NAME << " version " << PACKAGE_VERSION << "\n "; + OS << PACKAGE_NAME << " version " << PACKAGE_VERSION; +#ifdef LLVM_REPOSITORY + OS << " (" << LLVM_REPOSITORY; +#ifdef LLVM_REVISION + OS << ' ' << LLVM_REVISION; +#endif + OS << ')'; +#endif + OS << "\n "; #if LLVM_IS_DEBUG_BUILD OS << "DEBUG build"; #else |