Skip to content

Commit c7de4b1

Browse files
committed
[Index] Move reloading from swiftinterface after the "up to date" check
1 parent 8e4f62a commit c7de4b1

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

lib/Index/IndexRecord.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -495,22 +495,6 @@ emitDataForSwiftSerializedModule(ModuleDecl *module,
495495
IndexUnitWriter &parentUnitWriter,
496496
const PathRemapper &pathRemapper,
497497
SourceFile *initialFile) {
498-
// Reload resilient modules from swiftinterface to avoid indexing
499-
// internal details.
500-
if (module->getResilienceStrategy() == ResilienceStrategy::Resilient) {
501-
module->getASTContext().setIgnoreAdjacentModules(true);
502-
503-
ImportPath::Module::Builder builder(module->getName());
504-
auto reloadedModule = module->getASTContext().getModule(builder.get());
505-
506-
if (reloadedModule) {
507-
module = reloadedModule;
508-
} else {
509-
// If we can't rebuild from the swiftinterface, don't index this module.
510-
return true;
511-
}
512-
}
513-
514498
StringRef filename = module->getModuleFilename();
515499
std::string moduleName = module->getNameStr().str();
516500

@@ -529,6 +513,22 @@ emitDataForSwiftSerializedModule(ModuleDecl *module,
529513
if (*isUptodateOpt)
530514
return false;
531515

516+
// Reload resilient modules from swiftinterface to avoid indexing
517+
// internal details.
518+
if (module->getResilienceStrategy() == ResilienceStrategy::Resilient) {
519+
module->getASTContext().setIgnoreAdjacentModules(true);
520+
521+
ImportPath::Module::Builder builder(module->getName());
522+
auto reloadedModule = module->getASTContext().getModule(builder.get());
523+
524+
if (reloadedModule) {
525+
module = reloadedModule;
526+
} else {
527+
// If we can't rebuild from the swiftinterface, don't index this module.
528+
return true;
529+
}
530+
}
531+
532532
// FIXME: Would be useful for testing if swift had clang's -Rremark system so
533533
// we could output a remark here that we are going to create index data for
534534
// a module file.

0 commit comments

Comments
 (0)