Skip to content

Commit a89b71d

Browse files
committed
[Sema] Skip decls without a owning module in workaround for dupe definitions
The test swift-class-instantiation-module-interface triggered crashes in this logic because some decls don't have a owning module. It appears to be the synthesized templates that are at cause here.
1 parent e7b1434 commit a89b71d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/Sema/TypeCheckAccess.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1540,9 +1540,12 @@ swift::getDisallowedOriginKind(const Decl *decl,
15401540
continue;
15411541
}
15421542
}
1543+
auto owningModule = redecl->getOwningModule();
1544+
if (!owningModule)
1545+
continue;
15431546
auto moduleWrapper =
15441547
decl->getASTContext().getClangModuleLoader()->getWrapperForModule(
1545-
redecl->getOwningModule());
1548+
owningModule);
15461549
auto visibleAccessPath =
15471550
find_if(sfImportedModules, [&moduleWrapper](auto importedModule) {
15481551
return importedModule.importedModule == moduleWrapper ||

0 commit comments

Comments
 (0)