Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions llvm/test/tools/llvm-lto2/version.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## Show that you can run version as a main command for llvm-lto2
## or a subcommand of llvm-lto2 run.

RUN: llvm-lto2 --version | Filecheck %s
RUN: llvm-lto2 run --version | FileCheck %s
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was going to suggest removing the support for emitting the version under the run subcommand, but I don't see it in llvm-lto2.cpp. Is that coming from somewhere in cl::ParseCommandLineOptions?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Teresa,

It seems that llvm-lto2 run uses cl::ParseCommandLineOptions. This calls initCommonOptions() in CommandLine.cpp instantiates a CommandLineCommonOptions struct, where there is a VersionPrinter option and function. So taking it out or changing that workflow would impact other uses of cl::ParseCommandLineOptions.


CHECK: version
4 changes: 4 additions & 0 deletions llvm/tools/llvm-lto2/llvm-lto2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -616,5 +616,9 @@ int main(int argc, char **argv) {
outs() << GlobalValue::getGUIDAssumingExternalLinkage(argv[2]) << '\n';
return 0;
}
if (Subcommand == "--version") {
cl::PrintVersionMessage();
return 0;
}
return usage();
}
Loading