[llvm] 6521905 - [llvm-profdata] Accept --version argument
Michael Platings via llvm-commits
llvm-commits at lists.llvm.org
Mon May 22 06:45:03 PDT 2023
Author: Michael Platings
Date: 2023-05-22T14:44:03+01:00
New Revision: 65219053892d6f96ca7c0ddf1dd88d3c97b573c4
URL: https://github.com/llvm/llvm-project/commit/65219053892d6f96ca7c0ddf1dd88d3c97b573c4
DIFF: https://github.com/llvm/llvm-project/commit/65219053892d6f96ca7c0ddf1dd88d3c97b573c4.diff
LOG: [llvm-profdata] Accept --version argument
The `llvm-profdata --version` output now looks like:
llvm-profdata
LLVM (http://llvm.org/):
LLVM version 17.0.0git
Optimized build with assertions.
This makes llvm-profdata more consistent with other tools.
Reviewed By: simon_tatham
Differential Revision: https://reviews.llvm.org/D150964
Added:
llvm/test/tools/llvm-profdata/version.test
Modified:
llvm/tools/llvm-profdata/llvm-profdata.cpp
Removed:
################################################################################
diff --git a/llvm/test/tools/llvm-profdata/version.test b/llvm/test/tools/llvm-profdata/version.test
new file mode 100644
index 0000000000000..91e0e0e0e1798
--- /dev/null
+++ b/llvm/test/tools/llvm-profdata/version.test
@@ -0,0 +1,4 @@
+# RUN: llvm-profdata --version | FileCheck %s
+
+# CHECK: llvm-profdata{{$}}
+# CHECK: LLVM version {{.*}}
diff --git a/llvm/tools/llvm-profdata/llvm-profdata.cpp b/llvm/tools/llvm-profdata/llvm-profdata.cpp
index a6f7b5256a2d7..9199a69677155 100644
--- a/llvm/tools/llvm-profdata/llvm-profdata.cpp
+++ b/llvm/tools/llvm-profdata/llvm-profdata.cpp
@@ -3070,6 +3070,12 @@ int llvm_profdata_main(int argc, char **argvNonConst,
<< "Available commands: merge, show, overlap\n";
return 0;
}
+
+ if (strcmp(argv[1], "--version") == 0) {
+ outs() << ProgName << '\n';
+ cl::PrintVersionMessage();
+ return 0;
+ }
}
if (argc < 2)
More information about the llvm-commits
mailing list