[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 8467457afc)
Optimized build with assertions.
```
rdar://121526866
This commit is contained in:
1 parent
35db929b50
commit
6885810e7d
2 files changed
+13
-1
No files matched your search
@@ -286,6 +286,9 @@ add_llvm_component_library(LLVMSupport
|
||||
${LLVM_MAIN_INCLUDE_DIR}/llvm/Support
|
||||
${Backtrace_INCLUDE_DIRS}
|
||||
|
||||
DEPENDS
|
||||
llvm_vcsrevision_h
|
||||
|
||||
LINK_LIBS
|
||||
${system_libs} ${imported_libs} ${delayload_flags}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in new issue
Block a user