[llvm-cov] Allow commas in filenames passed to -object flag

Currently, -object takes a comma separated list of objects as an
argument, which prevents it working with path names that contain a
comma. Drop comma-separated support, which requires to set pass the
-object flag multiple times to set multiple objects.

Patch by Andrew Gallagher!

Differential Revision: https://reviews.llvm.org/D87003
This commit is contained in:
Vedant Kumar 2020-09-18 13:43:49 -07:00
parent 6640720520
commit ea70c5e0ce
2 changed files with 14 additions and 2 deletions

View File

@ -0,0 +1,3 @@
RUN: llvm-cov show %t -instr-profile %t -dump-collected-objects -object a,b | FileCheck %s
CHECK: a,b

View File

@ -544,8 +544,11 @@ int CodeCoverageTool::run(Command Cmd, int argc, const char **argv) {
cl::Positional, cl::desc("Covered executable or object file.")); cl::Positional, cl::desc("Covered executable or object file."));
cl::list<std::string> CovFilenames( cl::list<std::string> CovFilenames(
"object", cl::desc("Coverage executable or object file"), cl::ZeroOrMore, "object", cl::desc("Coverage executable or object file"), cl::ZeroOrMore);
cl::CommaSeparated);
cl::opt<bool> DebugDumpCollectedObjects(
"dump-collected-objects", cl::Optional, cl::Hidden,
cl::desc("Show the collected coverage object files"));
cl::list<std::string> InputSourceFiles( cl::list<std::string> InputSourceFiles(
cl::Positional, cl::desc("<Source files>"), cl::ZeroOrMore); cl::Positional, cl::desc("<Source files>"), cl::ZeroOrMore);
@ -668,6 +671,12 @@ int CodeCoverageTool::run(Command Cmd, int argc, const char **argv) {
::exit(1); ::exit(1);
} }
if (DebugDumpCollectedObjects) {
for (StringRef OF : ObjectFilenames)
outs() << OF << '\n';
::exit(0);
}
ViewOpts.Format = Format; ViewOpts.Format = Format;
switch (ViewOpts.Format) { switch (ViewOpts.Format) {
case CoverageViewOptions::OutputFormat::Text: case CoverageViewOptions::OutputFormat::Text: