summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-cov/llvm-cov.cpp
diff options
context:
space:
mode:
authorJustin Bogner <mail@justinbogner.com>2015-06-03 02:48:09 +0000
committerJustin Bogner <mail@justinbogner.com>2015-06-03 02:48:09 +0000
commit733013c6315e1c367b59f124368ed673942999f2 (patch)
treea5a373fbc16f25d325ed2ea63807df0adbea5e39 /llvm/tools/llvm-cov/llvm-cov.cpp
parentb2e0c1198283dc4cbdf3cd724a628ae2537dfc14 (diff)
downloadbcm5719-llvm-733013c6315e1c367b59f124368ed673942999f2.tar.gz
bcm5719-llvm-733013c6315e1c367b59f124368ed673942999f2.zip
llvm-cov: Make llvm-cov --version DTRT
In r233132 we started requiring a subcommand in llvm-cov, but this made `llvm-cov --version` invalid, which is kind of silly. Print version information in this case, as most people would expect. llvm-svn: 238897
Diffstat (limited to 'llvm/tools/llvm-cov/llvm-cov.cpp')
-rw-r--r--llvm/tools/llvm-cov/llvm-cov.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/tools/llvm-cov/llvm-cov.cpp b/llvm/tools/llvm-cov/llvm-cov.cpp
index bf66f583a52..8c5acaef63b 100644
--- a/llvm/tools/llvm-cov/llvm-cov.cpp
+++ b/llvm/tools/llvm-cov/llvm-cov.cpp
@@ -13,6 +13,7 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSwitch.h"
+#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/Process.h"
#include "llvm/Support/raw_ostream.h"
@@ -43,6 +44,12 @@ static int helpMain(int argc, const char *argv[]) {
return 0;
}
+/// \brief Top level version information.
+static int versionMain(int argc, const char *argv[]) {
+ cl::PrintVersionMessage();
+ return 0;
+}
+
int main(int argc, const char **argv) {
// If argv[0] is or ends with 'gcov', always be gcov compatible
if (sys::path::stem(argv[0]).endswith_lower("gcov"))
@@ -57,6 +64,7 @@ int main(int argc, const char **argv) {
.Case("report", reportMain)
.Case("show", showMain)
.Cases("-h", "-help", "--help", helpMain)
+ .Cases("-version", "--version", versionMain)
.Default(nullptr);
if (Func) {
OpenPOWER on IntegriCloud