[PATCH] D150964: [llvm-profdata] Accept --version argument

Michael Platings via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 19 07:31:51 PDT 2023


michaelplatings created this revision.
Herald added subscribers: hoy, wlei.
Herald added a project: All.
michaelplatings requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D150964

Files:
  llvm/test/tools/llvm-profdata/version.test
  llvm/tools/llvm-profdata/llvm-profdata.cpp


Index: llvm/tools/llvm-profdata/llvm-profdata.cpp
===================================================================
--- llvm/tools/llvm-profdata/llvm-profdata.cpp
+++ llvm/tools/llvm-profdata/llvm-profdata.cpp
@@ -3070,6 +3070,12 @@
              << "Available commands: merge, show, overlap\n";
       return 0;
     }
+
+    if (strcmp(argv[1], "--version") == 0) {
+      outs() << ProgName << '\n';
+      cl::PrintVersionMessage();
+      return 0;
+    }
   }
 
   if (argc < 2)
Index: llvm/test/tools/llvm-profdata/version.test
===================================================================
--- /dev/null
+++ llvm/test/tools/llvm-profdata/version.test
@@ -0,0 +1,4 @@
+# RUN: llvm-profdata --version | FileCheck %s
+
+# CHECK: llvm-profdata{{$}}
+# CHECK: LLVM version {{.*}}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150964.523766.patch
Type: text/x-patch
Size: 790 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230519/cd3e4745/attachment.bin>


More information about the llvm-commits mailing list