Skip to content

Commit

Permalink
[llvm-profdata] Accept --version argument
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mplatings committed May 22, 2023
1 parent 1f1b819 commit 6521905
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions llvm/test/tools/llvm-profdata/version.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# RUN: llvm-profdata --version | FileCheck %s

# CHECK: llvm-profdata{{$}}
# CHECK: LLVM version {{.*}}
6 changes: 6 additions & 0 deletions llvm/tools/llvm-profdata/llvm-profdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 6521905

Please sign in to comment.