[clang] [clang/DependencyScanning/ModuleDepCollector] Refactor part of `makeCommonInvocationForModuleBuild` into its own function, NFC (PR #88447)

Argyrios Kyrtzidis via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 11 15:57:06 PDT 2024


================
@@ -154,6 +154,20 @@ void ModuleDepCollector::addOutputPaths(CowCompilerInvocation &CI,
   }
 }
 
+void dependencies::removeUnnecessaryDependencies(CompilerInvocation &CI,
+                                                 bool ForModuleBuild) {
+  if (CI.getFrontendOpts().ProgramAction == frontend::GeneratePCH ||
+      (ForModuleBuild && !CI.getLangOpts().ModulesCodegen)) {
+    CI.getCodeGenOpts().DebugCompilationDir.clear();
+    CI.getCodeGenOpts().CoverageCompilationDir.clear();
+    CI.getCodeGenOpts().CoverageDataFile.clear();
+    CI.getCodeGenOpts().CoverageNotesFile.clear();
+    CI.getCodeGenOpts().ProfileInstrumentUsePath.clear();
+    CI.getCodeGenOpts().SampleProfileFile.clear();
+    CI.getCodeGenOpts().ProfileRemappingFile.clear();
----------------
akyrtzi wrote:

I had an offline discussion with Jan about how to better factor-out this piece of code.

https://github.com/llvm/llvm-project/pull/88447


More information about the cfe-commits mailing list