}
bool ToolChain::needsGCovInstrumentation(const llvm::opt::ArgList &Args) {
- return Args.hasFlag(options::OPT_fprofile_arcs, options::OPT_fno_profile_arcs,
- false) ||
- Args.hasArg(options::OPT_coverage);
+ return Args.hasArg(options::OPT_coverage) ||
+ Args.hasFlag(options::OPT_fprofile_arcs, options::OPT_fno_profile_arcs,
+ false);
}
Tool *ToolChain::SelectTool(const JobAction &JA) const {
bool EmitCovNotes = Args.hasArg(options::OPT_ftest_coverage) ||
Args.hasArg(options::OPT_coverage);
- bool EmitCovData = Args.hasFlag(options::OPT_fprofile_arcs,
- options::OPT_fno_profile_arcs, false) ||
- Args.hasArg(options::OPT_coverage);
+ bool EmitCovData = TC.needsGCovInstrumentation(Args);
if (EmitCovNotes)
CmdArgs.push_back("-femit-coverage-notes");
if (EmitCovData)
// GCNO-LOCATION: "-coverage-notes-file" "{{.*}}/foo/bar.gcno"
// GCNO-LOCATION-REL: "-coverage-notes-file" "{{.*}}{{/|\\\\}}foo/bar.gcno"
+/// Don't warn -Wunused-command-line-argument.
+// RUN: %clang -E -Werror --coverage -ftest-coverage -fprofile-arcs %s
+
/// Test -fprofile-dir=
// RUN: not %clang -S -Werror -fprofile-dir=abc %s
// RUN: not %clang -S -Werror -ftest-coverage -fprofile-dir=abc %s