Skip to content

Commit 1fe0aa6

Browse files
committed
[Swift-ObjC-Interop] Speculative cyclic lookup fix
The lookup to resolve an ObjC forward declaration to its potential native Swift definition within a mixed module is becoming cyclic somehow. The old uncached lookup still works, so it seems this is an issue with cache invalidation somehow. Until the route of the issue, use the old uncached lookup method.
1 parent 72718c0 commit 1fe0aa6

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/ClangImporter/ImportDecl.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4514,7 +4514,13 @@ namespace {
45144514
SmallVector<Decl *, 4> matchingTopLevelDecls;
45154515

45164516
// Get decls with a matching @objc attribute
4517-
module->lookupTopLevelDeclsByObjCName(matchingTopLevelDecls, name);
4517+
module->getTopLevelDeclsWhereAttributesMatch(
4518+
matchingTopLevelDecls, [&name](const DeclAttributes attrs) -> bool {
4519+
if (auto objcAttr = attrs.getAttribute<ObjCAttr>())
4520+
if (auto objcName = objcAttr->getName())
4521+
return objcName->getSimpleName() == name;
4522+
return false;
4523+
});
45184524

45194525
// Filter by decl kind
45204526
for (auto result : matchingTopLevelDecls) {

0 commit comments

Comments
 (0)