[clang] 9a11174 - [Driver] Add -fno-test-coverage
Fangrui Song via cfe-commits
cfe-commits at lists.llvm.org
Fri May 8 17:02:01 PDT 2020
Author: Fangrui Song
Date: 2020-05-08T17:01:53-07:00
New Revision: 9a11174287c78e6f807823fdfbdf4c27c0cad3d9
URL: https://github.com/llvm/llvm-project/commit/9a11174287c78e6f807823fdfbdf4c27c0cad3d9
DIFF: https://github.com/llvm/llvm-project/commit/9a11174287c78e6f807823fdfbdf4c27c0cad3d9.diff
LOG: [Driver] Add -fno-test-coverage
Added:
Modified:
clang/include/clang/Driver/Options.td
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/Driver/coverage.c
Removed:
################################################################################
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index ef8ccb5b90e2..0d00e34040bc 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -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>;
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 7d52d7faa48f..42d5af71c23c 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -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)
diff --git a/clang/test/Driver/coverage.c b/clang/test/Driver/coverage.c
index 4e1b49bd3a72..f8f493715581 100644
--- a/clang/test/Driver/coverage.c
+++ b/clang/test/Driver/coverage.c
@@ -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
More information about the cfe-commits
mailing list