llvm-cov: Don't manually parse an option for no reason

We're using cl::opt here, but for some reason we're reading out one
particular option by hand instead. This makes -help and the like
behave rather poorly, so let's not do it this way.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220928 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Justin Bogner 2014-10-30 20:51:24 +00:00
parent 3d41cbb3f4
commit 6e5def6b3e

View File

@ -81,7 +81,7 @@ public:
int report(int argc, const char **argv,
CommandLineParserType commandLineParser);
StringRef ObjectFilename;
std::string ObjectFilename;
CoverageViewOptions ViewOpts;
std::string PGOFilename;
CoverageFiltersMatchAll Filters;
@ -233,6 +233,10 @@ int CodeCoverageTool::run(Command Cmd, int argc, const char **argv) {
PrettyStackTraceProgram X(argc, argv);
llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
cl::opt<std::string, true> ObjectFilename(
cl::Positional, cl::Required, cl::location(this->ObjectFilename),
cl::desc("Covered executable or object file."));
cl::list<std::string> InputSourceFiles(
cl::Positional, cl::desc("<Source files>"), cl::ZeroOrMore);
@ -332,23 +336,6 @@ int CodeCoverageTool::run(Command Cmd, int argc, const char **argv) {
return 0;
};
// Parse the object filename
if (argc > 1) {
StringRef Arg(argv[1]);
if (Arg.equals_lower("-help") || Arg.equals_lower("-version")) {
cl::ParseCommandLineOptions(2, argv, "LLVM code coverage tool\n");
return 0;
}
ObjectFilename = Arg;
argv[1] = argv[0];
--argc;
++argv;
} else {
errs() << sys::path::filename(argv[0]) << ": No executable file given!\n";
return 1;
}
switch (Cmd) {
case Show:
return show(argc, argv, commandLineParser);