Skip to content

Commit 48ba0ed

Browse files
committed
Added version command for llvm-lto2
1 parent 7563531 commit 48ba0ed

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
## Show that you can run version as a main command for llvm-lto2
2+
## or a subcommand of llvm-lto2 run.
3+
4+
RUN: llvm-lto2 version | Filecheck %s
5+
RUN: llvm-lto2 run --version | FileCheck %s
6+
7+
CHECK: version

llvm/tools/llvm-lto2/llvm-lto2.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ template <typename T> static T check(ErrorOr<T> E, std::string Msg) {
247247
}
248248

249249
static int usage() {
250-
errs() << "Available subcommands: dump-symtab run print-guid\n";
250+
errs() << "Available subcommands: dump-symtab run print-guid version\n";
251251
return 1;
252252
}
253253

@@ -616,5 +616,9 @@ int main(int argc, char **argv) {
616616
outs() << GlobalValue::getGUIDAssumingExternalLinkage(argv[2]) << '\n';
617617
return 0;
618618
}
619+
if (Subcommand == "version") {
620+
cl::PrintVersionMessage();
621+
return 0;
622+
}
619623
return usage();
620624
}

0 commit comments

Comments
 (0)