[clang] 060b253 - [clang][deps] Remove more codegen options
Jan Svoboda via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 11 15:57:28 PDT 2022
Author: Jan Svoboda
Date: 2022-10-11T15:57:19-07:00
New Revision: 060b25346b95cc161d21418f31c333f9a115d77e
URL: https://github.com/llvm/llvm-project/commit/060b25346b95cc161d21418f31c333f9a115d77e
DIFF: https://github.com/llvm/llvm-project/commit/060b25346b95cc161d21418f31c333f9a115d77e.diff
LOG: [clang][deps] Remove more codegen options
Codegen options are typically unused by modules. Reset some of them to increase sharing between TUs with different flags.
Reviewed By: Bigcheese
Differential Revision: https://reviews.llvm.org/D135720
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 f38ed7be4ddda..2f3444d74b10b 100644
--- a/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
+++ b/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
@@ -97,8 +97,15 @@ ModuleDepCollector::makeInvocationForModuleBuildWithoutOutputs(
// units.
CI.getFrontendOpts().Inputs.clear();
CI.getFrontendOpts().OutputFile.clear();
+
+ // TODO: Figure out better way to set options to their default value.
CI.getCodeGenOpts().MainFileName.clear();
CI.getCodeGenOpts().DwarfDebugFlags.clear();
+ if (!CI.getLangOpts()->ModulesCodegen) {
+ CI.getCodeGenOpts().DebugCompilationDir.clear();
+ CI.getCodeGenOpts().CoverageCompilationDir.clear();
+ }
+
// Map output paths that affect behaviour to "-" so their existence is in the
// context hash. The final path will be computed in addOutputPaths.
if (!CI.getDiagnosticOpts().DiagnosticSerializationFile.empty())
diff --git a/clang/test/ClangScanDeps/Inputs/removed-args/cdb.json.template b/clang/test/ClangScanDeps/Inputs/removed-args/cdb.json.template
index 95d1f99955bb0..2bdc340a3fccd 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 -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 -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 12d6ab1428f52..02fbb8cacff2c 100644
--- a/clang/test/ClangScanDeps/removed-args.c
+++ b/clang/test/ClangScanDeps/removed-args.c
@@ -21,6 +21,8 @@
// CHECK-NEXT: "clang-modulemap-file": "[[PREFIX]]/module.modulemap",
// CHECK-NEXT: "command-line": [
// CHECK-NEXT: "-cc1"
+// CHECK-NOT: "-fdebug-compilation-dir="
+// CHECK-NOT: "-fcoverage-compilation-dir="
// CHECK-NOT: "-dwarf-debug-flags"
// CHECK-NOT: "-main-file-name"
// CHECK-NOT: "-include"
@@ -42,6 +44,8 @@
// CHECK-NEXT: "clang-modulemap-file": "[[PREFIX]]/module.modulemap",
// CHECK-NEXT: "command-line": [
// CHECK-NEXT: "-cc1"
+// CHECK-NOT: "-fdebug-compilation-dir=
+// CHECK-NOT: "-fcoverage-compilation-dir=
// CHECK-NOT: "-dwarf-debug-flags"
// CHECK-NOT: "-main-file-name"
// CHECK-NOT: "-include"
More information about the cfe-commits
mailing list