Skip to content

Commit c22eb45

Browse files
committed
[Index] Move reloading from swiftinterface after the "up to date" check
1 parent 7b8547b commit c22eb45

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

lib/Index/IndexRecord.cpp

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -495,21 +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-
}
513498

514499
StringRef filename = module->getModuleFilename();
515500
std::string moduleName = module->getNameStr().str();
@@ -529,6 +514,22 @@ emitDataForSwiftSerializedModule(ModuleDecl *module,
529514
if (*isUptodateOpt)
530515
return false;
531516

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

0 commit comments

Comments
 (0)