aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-cov/llvm-cov.cpp
diff options
context:
space:
mode:
authorJustin Bogner <mail@justinbogner.com>2015-03-24 23:34:36 +0000
committerJustin Bogner <mail@justinbogner.com>2015-03-24 23:34:36 +0000
commit5a07bb8b5f64368fe35d32d9653b5157a0d4b18b (patch)
treea978852bb462f5cedacd4490d02b9fbbc13d3e4a /llvm/tools/llvm-cov/llvm-cov.cpp
parent156d46eda0248c9fb6f213980a52f3f4cc7be7dc (diff)
downloadllvm-5a07bb8b5f64368fe35d32d9653b5157a0d4b18b.zip
llvm-5a07bb8b5f64368fe35d32d9653b5157a0d4b18b.tar.gz
llvm-5a07bb8b5f64368fe35d32d9653b5157a0d4b18b.tar.bz2
llvm-cov: Require a subcommand when invoked as llvm-cov
A while ago llvm-cov gained support for clang's instrumentation based profiling in addition to its gcov support, and subcommands were added to choose which behaviour to use. When no subcommand was specified, we fell back to gcov compatibility with a warning that a subcommand would be required in the future. Now, we require the subcommand. Note that if the basename of llvm-cov is gcov (via symlink or hardlink, for example), we still use the gcov compatible behaviour with no subcommand required. llvm-svn: 233132
Diffstat (limited to 'llvm/tools/llvm-cov/llvm-cov.cpp')
-rw-r--r--llvm/tools/llvm-cov/llvm-cov.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/llvm/tools/llvm-cov/llvm-cov.cpp b/llvm/tools/llvm-cov/llvm-cov.cpp
index 3b7cffc..bf66f58 100644
--- a/llvm/tools/llvm-cov/llvm-cov.cpp
+++ b/llvm/tools/llvm-cov/llvm-cov.cpp
@@ -14,6 +14,7 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/Support/Path.h"
+#include "llvm/Support/Process.h"
#include "llvm/Support/raw_ostream.h"
#include <string>
@@ -33,8 +34,12 @@ int gcovMain(int argc, const char *argv[]);
/// \brief Top level help.
static int helpMain(int argc, const char *argv[]) {
- errs() << "OVERVIEW: LLVM code coverage tool\n\n"
- << "USAGE: llvm-cov {gcov|report|show}\n";
+ errs() << "Usage: llvm-cov {gcov|report|show} [OPTION]...\n\n"
+ << "Shows code coverage information.\n\n"
+ << "Subcommands:\n"
+ << " gcov: Work with the gcov format.\n"
+ << " show: Annotate source files using instrprof style coverage.\n"
+ << " report: Summarize instrprof style coverage information.\n";
return 0;
}
@@ -61,18 +66,13 @@ int main(int argc, const char **argv) {
}
}
- // Give a warning and fall back to gcov
- errs().changeColor(raw_ostream::RED);
- errs() << "warning:";
- // Assume that argv[1] wasn't a command when it stats with a '-' or is a
- // filename (i.e. contains a '.')
- if (argc > 1 && !StringRef(argv[1]).startswith("-") &&
- StringRef(argv[1]).find(".") == StringRef::npos)
- errs() << " Unrecognized command '" << argv[1] << "'.";
- errs() << " Using the gcov compatible mode "
- "(this behaviour may be dropped in the future).";
- errs().resetColor();
- errs() << "\n";
-
- return gcovMain(argc, argv);
+ if (argc > 1) {
+ if (sys::Process::StandardErrHasColors())
+ errs().changeColor(raw_ostream::RED);
+ errs() << "Unrecognized command: " << argv[1] << ".\n\n";
+ if (sys::Process::StandardErrHasColors())
+ errs().resetColor();
+ }
+ helpMain(argc, argv);
+ return 1;
}