Author: Ben Langmuir
Date: 2023-03-31T09:43:22-07:00
New Revision: 758bca6483853a743297b68bd88a5dba9d5247f2

URL: 
https://github.com/llvm/llvm-project/commit/758bca6483853a743297b68bd88a5dba9d5247f2
DIFF: 
https://github.com/llvm/llvm-project/commit/758bca6483853a743297b68bd88a5dba9d5247f2.diff

LOG: [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

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp 
b/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
index 8cac033742a8c..3d41e78dfc7c7 100644
--- a/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
+++ b/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
@@ -100,6 +100,8 @@ 
ModuleDepCollector::makeInvocationForModuleBuildWithoutOutputs(
   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

diff  --git a/clang/test/ClangScanDeps/Inputs/removed-args/cdb.json.template 
b/clang/test/ClangScanDeps/Inputs/removed-args/cdb.json.template
index 2bdc340a3fccd..7ae3c88aedd8d 100644
--- a/clang/test/ClangScanDeps/Inputs/removed-args/cdb.json.template
+++ b/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"
   }
 ]

diff  --git a/clang/test/ClangScanDeps/removed-args.c 
b/clang/test/ClangScanDeps/removed-args.c
index 02fbb8cacff2c..9a4ef25838e46 100644
--- a/clang/test/ClangScanDeps/removed-args.c
+++ b/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"


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to