@@ -199,10 +199,10 @@ static bool emitMakeDependenciesIfNeeded(DiagnosticEngine &diags,
199
199
return false ;
200
200
}
201
201
202
- static bool emitMakeDependenciesIfNeeded (DiagnosticEngine &diags,
202
+ static void emitMakeDependenciesIfNeeded (DiagnosticEngine &diags,
203
203
DependencyTracker *depTracker,
204
204
const FrontendOptions &opts) {
205
- return opts.InputsAndOutputs .forEachInputProducingSupplementaryOutput (
205
+ opts.InputsAndOutputs .forEachInputProducingSupplementaryOutput (
206
206
[&](const InputFile &f) -> bool {
207
207
return emitMakeDependenciesIfNeeded (diags, depTracker, opts, f);
208
208
});
@@ -1253,6 +1253,9 @@ static void performEndOfPipelineActions(CompilerInstance &Instance) {
1253
1253
// Emit dependencies and index data.
1254
1254
emitReferenceDependenciesForAllPrimaryInputsIfNeeded (Instance);
1255
1255
emitIndexData (Instance);
1256
+ emitMakeDependenciesIfNeeded (Instance.getDiags (),
1257
+ Instance.getDependencyTracker (), opts);
1258
+
1256
1259
}
1257
1260
1258
1261
// / Performs the compile requested by the user.
@@ -1300,6 +1303,7 @@ static bool performCompile(CompilerInstance &Instance,
1300
1303
performEndOfPipelineActions (Instance);
1301
1304
};
1302
1305
1306
+ auto &Context = Instance.getASTContext ();
1303
1307
if (FrontendOptions::shouldActionOnlyParse (Action)) {
1304
1308
// Parsing gets triggered lazily, but let's make sure we have the right
1305
1309
// input kind.
@@ -1311,11 +1315,11 @@ static bool performCompile(CompilerInstance &Instance,
1311
1315
(void )kind;
1312
1316
} else if (Action == FrontendOptions::ActionType::ResolveImports) {
1313
1317
Instance.performParseAndResolveImportsOnly ();
1318
+ return Context.hadError ();
1314
1319
} else {
1315
1320
Instance.performSema ();
1316
1321
}
1317
1322
1318
- ASTContext &Context = Instance.getASTContext ();
1319
1323
if (Action == FrontendOptions::ActionType::Parse) {
1320
1324
// A -parse invocation only cares about the side effects of parsing, so
1321
1325
// force the parsing of all the source files.
@@ -1326,16 +1330,8 @@ static bool performCompile(CompilerInstance &Instance,
1326
1330
return Context.hadError ();
1327
1331
}
1328
1332
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);
1339
1335
1340
1336
if (observer)
1341
1337
observer->performedSemanticAnalysis (Instance);
0 commit comments