[Driver] Add -fno-test-coverage

This commit is contained in:
Fangrui Song 2020-05-08 16:50:34 -07:00
parent 68a9308a0b
commit 9a11174287
3 changed files with 10 additions and 1 deletions

View File

@ -1875,6 +1875,7 @@ def foptimization_record_passes_EQ : Joined<["-"], "foptimization-record-passes=
MetaVarName<"<regex>">;
def ftest_coverage : Flag<["-"], "ftest-coverage">, Group<f_Group>;
def fno_test_coverage : Flag<["-"], "fno-test-coverage">, Group<f_Group>;
def fvectorize : Flag<["-"], "fvectorize">, Group<f_Group>,
HelpText<"Enable the loop vectorization passes">;
def fno_vectorize : Flag<["-"], "fno-vectorize">, Group<f_Group>;

View File

@ -861,7 +861,8 @@ static void addPGOAndCoverageFlags(const ToolChain &TC, Compilation &C,
}
}
bool EmitCovNotes = Args.hasArg(options::OPT_ftest_coverage) ||
bool EmitCovNotes = Args.hasFlag(options::OPT_ftest_coverage,
options::OPT_fno_test_coverage, false) ||
Args.hasArg(options::OPT_coverage);
bool EmitCovData = TC.needsGCovInstrumentation(Args);
if (EmitCovNotes)

View File

@ -1,3 +1,10 @@
// RUN: %clang -### -S -ftest-coverage %s 2>&1 | FileCheck --check-prefix=TEST-COVERAGE %s
// RUN: %clang -### -S -ftest-coverage -fno-test-coverage %s 2>&1 | FileCheck --check-prefix=NO-TEST-COVERAGE %s
// TEST-COVERAGE: "-femit-coverage-notes"
// TEST-COVERAGE: "-coverage-notes-file" "{{.*}}{{/|\\\\}}coverage.gcno"
// NO-TEST-COVERAGE-NOT: "-coverage-notes-file"
// RUN: %clang -### -S -fprofile-arcs %s 2>&1 | FileCheck --check-prefix=PROFILE-ARCS %s
// RUN: %clang -### -S -fprofile-arcs -fno-profile-arcs %s 2>&1 | FileCheck --check-prefix=NO-PROFILE-ARCS %s