File tree Expand file tree Collapse file tree 3 files changed +17
-12
lines changed Expand file tree Collapse file tree 3 files changed +17
-12
lines changed Original file line number Diff line number Diff line change @@ -582,6 +582,7 @@ class CompilerInstance {
582
582
bool setUpASTContextIfNeeded ();
583
583
void setupStatsReporter ();
584
584
void setupDiagnosticVerifierIfNeeded ();
585
+ void setupDependencyTrackerIfNeeded ();
585
586
Optional<unsigned > setUpCodeCompletionBuffer ();
586
587
587
588
// / Set up all state in the CompilerInstance to process the given input file.
Original file line number Diff line number Diff line change @@ -288,9 +288,25 @@ void CompilerInstance::setupDiagnosticVerifierIfNeeded() {
288
288
}
289
289
}
290
290
291
+ void CompilerInstance::setupDependencyTrackerIfNeeded () {
292
+ const auto &Invocation = getInvocation ();
293
+ const auto &opts = Invocation.getFrontendOptions ();
294
+
295
+ if (opts.InputsAndOutputs .hasDependencyTrackerPath () ||
296
+ !opts.IndexStorePath .empty () || opts.TrackSystemDeps ) {
297
+ // Note that we're tracking dependencies even when we don't need to write
298
+ // them directly; in particular, -track-system-dependencies affects how
299
+ // module interfaces get loaded, and so we need to be consistently tracking
300
+ // system dependencies throughout the compiler.
301
+ createDependencyTracker (opts.TrackSystemDeps );
302
+ }
303
+ }
304
+
291
305
bool CompilerInstance::setup (const CompilerInvocation &Invok) {
292
306
Invocation = Invok;
293
307
308
+ setupDependencyTrackerIfNeeded ();
309
+
294
310
// If initializing the overlay file system fails there's no sense in
295
311
// continuing because the compiler will read the wrong files.
296
312
if (setUpVirtualFileSystemOverlays ())
Original file line number Diff line number Diff line change @@ -2202,18 +2202,6 @@ int swift::performFrontend(ArrayRef<const char *> Args,
2202
2202
const DiagnosticOptions &diagOpts = Invocation.getDiagnosticOptions ();
2203
2203
bool verifierEnabled = diagOpts.VerifyMode != DiagnosticOptions::NoVerify;
2204
2204
2205
- if (Invocation.getFrontendOptions ()
2206
- .InputsAndOutputs .hasDependencyTrackerPath () ||
2207
- !Invocation.getFrontendOptions ().IndexStorePath .empty () ||
2208
- Invocation.getFrontendOptions ().TrackSystemDeps ) {
2209
- // Note that we're tracking dependencies even when we don't need to write
2210
- // them directly; in particular, -track-system-dependencies affects how
2211
- // module interfaces get loaded, and so we need to be consistently tracking
2212
- // system dependencies throughout the compiler.
2213
- Instance->createDependencyTracker (
2214
- Invocation.getFrontendOptions ().TrackSystemDeps );
2215
- }
2216
-
2217
2205
if (Instance->setup (Invocation)) {
2218
2206
return finishDiagProcessing (1 , /* verifierEnabled*/ false );
2219
2207
}
You can’t perform that action at this time.
0 commit comments