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

Jan Svoboda via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 11 15:11:07 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();
----------------
jansvoboda11 wrote:

We inherit these from the translation unit, are their values usable for modules?

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


More information about the cfe-commits mailing list