[PATCH] D147282: [clang][deps] Remove -coverage-data-file and -coverage-notes-file from modules

Ben Langmuir via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 30 15:53:43 PDT 2023


benlangmuir created this revision.
benlangmuir added reviewers: akyrtzi, jansvoboda11.
Herald added a project: All.
benlangmuir requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

When not performing codegen, we can strip the coverage-data-file and coverage-notes-file options to improve canonicalization.

rdar://107443796


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D147282

Files:
  clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
  clang/test/ClangScanDeps/Inputs/removed-args/cdb.json.template
  clang/test/ClangScanDeps/removed-args.c


Index: clang/test/ClangScanDeps/removed-args.c
===================================================================
--- clang/test/ClangScanDeps/removed-args.c
+++ clang/test/ClangScanDeps/removed-args.c
@@ -23,6 +23,8 @@
 // CHECK-NEXT:         "-cc1"
 // CHECK-NOT:          "-fdebug-compilation-dir="
 // CHECK-NOT:          "-fcoverage-compilation-dir="
+// CHECK-NOT:          "-coverage-notes-file
+// CHECK-NOT:          "-coverage-data-file
 // CHECK-NOT:          "-dwarf-debug-flags"
 // CHECK-NOT:          "-main-file-name"
 // CHECK-NOT:          "-include"
@@ -46,6 +48,8 @@
 // CHECK-NEXT:         "-cc1"
 // CHECK-NOT:          "-fdebug-compilation-dir=
 // CHECK-NOT:          "-fcoverage-compilation-dir=
+// CHECK-NOT:          "-coverage-notes-file
+// CHECK-NOT:          "-coverage-data-file
 // CHECK-NOT:          "-dwarf-debug-flags"
 // CHECK-NOT:          "-main-file-name"
 // CHECK-NOT:          "-include"
Index: clang/test/ClangScanDeps/Inputs/removed-args/cdb.json.template
===================================================================
--- clang/test/ClangScanDeps/Inputs/removed-args/cdb.json.template
+++ clang/test/ClangScanDeps/Inputs/removed-args/cdb.json.template
@@ -1,7 +1,7 @@
 [
   {
     "directory": "DIR",
-    "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",
+    "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",
     "file": "DIR/tu.c"
   }
 ]
Index: clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
===================================================================
--- clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
+++ clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
@@ -100,6 +100,8 @@
   if (!CI.getLangOpts()->ModulesCodegen) {
     CI.getCodeGenOpts().DebugCompilationDir.clear();
     CI.getCodeGenOpts().CoverageCompilationDir.clear();
+    CI.getCodeGenOpts().CoverageDataFile.clear();
+    CI.getCodeGenOpts().CoverageNotesFile.clear();
   }
 
   // Map output paths that affect behaviour to "-" so their existence is in the


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147282.509842.patch
Type: text/x-patch
Size: 2807 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230330/bf242fae/attachment-0001.bin>


More information about the cfe-commits mailing list