Skip to content

Commit 6ed0a87

Browse files
committed
[Frontend] Move .d generation to end of pipeline
1 parent 11efc36 commit 6ed0a87

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

lib/FrontendTool/FrontendTool.cpp

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,10 @@ static bool emitMakeDependenciesIfNeeded(DiagnosticEngine &diags,
199199
return false;
200200
}
201201

202-
static bool emitMakeDependenciesIfNeeded(DiagnosticEngine &diags,
202+
static void emitMakeDependenciesIfNeeded(DiagnosticEngine &diags,
203203
DependencyTracker *depTracker,
204204
const FrontendOptions &opts) {
205-
return opts.InputsAndOutputs.forEachInputProducingSupplementaryOutput(
205+
opts.InputsAndOutputs.forEachInputProducingSupplementaryOutput(
206206
[&](const InputFile &f) -> bool {
207207
return emitMakeDependenciesIfNeeded(diags, depTracker, opts, f);
208208
});
@@ -1253,6 +1253,9 @@ static void performEndOfPipelineActions(CompilerInstance &Instance) {
12531253
// Emit dependencies and index data.
12541254
emitReferenceDependenciesForAllPrimaryInputsIfNeeded(Instance);
12551255
emitIndexData(Instance);
1256+
emitMakeDependenciesIfNeeded(Instance.getDiags(),
1257+
Instance.getDependencyTracker(), opts);
1258+
12561259
}
12571260

12581261
/// Performs the compile requested by the user.
@@ -1300,6 +1303,7 @@ static bool performCompile(CompilerInstance &Instance,
13001303
performEndOfPipelineActions(Instance);
13011304
};
13021305

1306+
auto &Context = Instance.getASTContext();
13031307
if (FrontendOptions::shouldActionOnlyParse(Action)) {
13041308
// Parsing gets triggered lazily, but let's make sure we have the right
13051309
// input kind.
@@ -1311,11 +1315,11 @@ static bool performCompile(CompilerInstance &Instance,
13111315
(void)kind;
13121316
} else if (Action == FrontendOptions::ActionType::ResolveImports) {
13131317
Instance.performParseAndResolveImportsOnly();
1318+
return Context.hadError();
13141319
} else {
13151320
Instance.performSema();
13161321
}
13171322

1318-
ASTContext &Context = Instance.getASTContext();
13191323
if (Action == FrontendOptions::ActionType::Parse) {
13201324
// A -parse invocation only cares about the side effects of parsing, so
13211325
// force the parsing of all the source files.
@@ -1326,16 +1330,8 @@ static bool performCompile(CompilerInstance &Instance,
13261330
return Context.hadError();
13271331
}
13281332

1329-
if (Action == FrontendOptions::ActionType::ScanDependencies) {
1330-
scanDependencies(Instance);
1331-
}
1332-
1333-
(void)emitMakeDependenciesIfNeeded(Instance.getDiags(),
1334-
Instance.getDependencyTracker(), opts);
1335-
1336-
if (Action == FrontendOptions::ActionType::ResolveImports ||
1337-
Action == FrontendOptions::ActionType::ScanDependencies)
1338-
return Context.hadError();
1333+
if (Action == FrontendOptions::ActionType::ScanDependencies)
1334+
return scanDependencies(Instance);
13391335

13401336
if (observer)
13411337
observer->performedSemanticAnalysis(Instance);

0 commit comments

Comments
 (0)