Skip to content

Commit 20d4eb7

Browse files
benlangmuirakyrtzi
authored andcommitted
[clang][deps] Remove -coverage-data-file and -coverage-notes-file from modules
When not performing codegen, we can strip the coverage-data-file and coverage-notes-file options to improve canonicalization. rdar://107443796 Differential Revision: https://reviews.llvm.org/D147282 (cherry picked from commit 758bca6)
1 parent 5fa22a8 commit 20d4eb7

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ ModuleDepCollector::makeInvocationForModuleBuildWithoutOutputs(
106106
if (!CI.getLangOpts()->ModulesCodegen) {
107107
CI.getCodeGenOpts().DebugCompilationDir.clear();
108108
CI.getCodeGenOpts().CoverageCompilationDir.clear();
109+
CI.getCodeGenOpts().CoverageDataFile.clear();
110+
CI.getCodeGenOpts().CoverageNotesFile.clear();
109111
}
110112

111113
// Map output paths that affect behaviour to "-" so their existence is in the
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[
22
{
33
"directory": "DIR",
4-
"command": "clang -fsyntax-only DIR/tu.c -fmodules -fimplicit-module-maps -fmodules-validate-once-per-build-session -fbuild-session-file=DIR/build-session -fmodules-prune-interval=123 -fmodules-prune-after=123 -fmodules-cache-path=DIR/cache -include DIR/header.h -grecord-command-line -fdebug-compilation-dir=DIR/debug -fcoverage-compilation-dir=DIR/coverage -o DIR/tu.o -serialize-diagnostics DIR/tu.diag -MT tu -MD -MF DIR/tu.d",
4+
"command": "clang -fsyntax-only DIR/tu.c -fmodules -fimplicit-module-maps -fmodules-validate-once-per-build-session -fbuild-session-file=DIR/build-session -fmodules-prune-interval=123 -fmodules-prune-after=123 -fmodules-cache-path=DIR/cache -include DIR/header.h -grecord-command-line -fdebug-compilation-dir=DIR/debug -fcoverage-compilation-dir=DIR/coverage -ftest-coverage -o DIR/tu.o -serialize-diagnostics DIR/tu.diag -MT tu -MD -MF DIR/tu.d",
55
"file": "DIR/tu.c"
66
}
77
]

clang/test/ClangScanDeps/removed-args.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
// CHECK-NEXT: "-cc1"
2424
// CHECK-NOT: "-fdebug-compilation-dir="
2525
// CHECK-NOT: "-fcoverage-compilation-dir="
26+
// CHECK-NOT: "-coverage-notes-file
27+
// CHECK-NOT: "-coverage-data-file
2628
// CHECK-NOT: "-dwarf-debug-flags"
2729
// CHECK-NOT: "-main-file-name"
2830
// CHECK-NOT: "-include"
@@ -46,6 +48,8 @@
4648
// CHECK-NEXT: "-cc1"
4749
// CHECK-NOT: "-fdebug-compilation-dir=
4850
// CHECK-NOT: "-fcoverage-compilation-dir=
51+
// CHECK-NOT: "-coverage-notes-file
52+
// CHECK-NOT: "-coverage-data-file
4953
// CHECK-NOT: "-dwarf-debug-flags"
5054
// CHECK-NOT: "-main-file-name"
5155
// CHECK-NOT: "-include"

0 commit comments

Comments
 (0)