@@ -154,6 +154,20 @@ void ModuleDepCollector::addOutputPaths(CowCompilerInvocation &CI,
154
154
}
155
155
}
156
156
157
+ void dependencies::removeUnnecessaryDependencies (CompilerInvocation &CI,
158
+ bool ForModuleBuild) {
159
+ if (CI.getFrontendOpts ().ProgramAction == frontend::GeneratePCH ||
160
+ (ForModuleBuild && !CI.getLangOpts ().ModulesCodegen )) {
161
+ CI.getCodeGenOpts ().DebugCompilationDir .clear ();
162
+ CI.getCodeGenOpts ().CoverageCompilationDir .clear ();
163
+ CI.getCodeGenOpts ().CoverageDataFile .clear ();
164
+ CI.getCodeGenOpts ().CoverageNotesFile .clear ();
165
+ CI.getCodeGenOpts ().ProfileInstrumentUsePath .clear ();
166
+ CI.getCodeGenOpts ().SampleProfileFile .clear ();
167
+ CI.getCodeGenOpts ().ProfileRemappingFile .clear ();
168
+ }
169
+ }
170
+
157
171
static CowCompilerInvocation
158
172
makeCommonInvocationForModuleBuild (CompilerInvocation CI) {
159
173
CI.resetNonModularOptions ();
@@ -170,15 +184,8 @@ makeCommonInvocationForModuleBuild(CompilerInvocation CI) {
170
184
// TODO: Figure out better way to set options to their default value.
171
185
CI.getCodeGenOpts ().MainFileName .clear ();
172
186
CI.getCodeGenOpts ().DwarfDebugFlags .clear ();
173
- if (!CI.getLangOpts ().ModulesCodegen ) {
174
- CI.getCodeGenOpts ().DebugCompilationDir .clear ();
175
- CI.getCodeGenOpts ().CoverageCompilationDir .clear ();
176
- CI.getCodeGenOpts ().CoverageDataFile .clear ();
177
- CI.getCodeGenOpts ().CoverageNotesFile .clear ();
178
- CI.getCodeGenOpts ().ProfileInstrumentUsePath .clear ();
179
- CI.getCodeGenOpts ().SampleProfileFile .clear ();
180
- CI.getCodeGenOpts ().ProfileRemappingFile .clear ();
181
- }
187
+
188
+ removeUnnecessaryDependencies (CI, /* ForModuleBuild=*/ true );
182
189
183
190
// Map output paths that affect behaviour to "-" so their existence is in the
184
191
// context hash. The final path will be computed in addOutputPaths.
0 commit comments