Skip to content

Commit f676b75

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 79a2ff5 commit f676b75

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
@@ -4525,7 +4525,13 @@ namespace {
45254525
SmallVector<Decl *, 4> matchingTopLevelDecls;
45264526

45274527
// Get decls with a matching @objc attribute
4528-
module->lookupTopLevelDeclsByObjCName(matchingTopLevelDecls, name);
4528+
module->getTopLevelDeclsWhereAttributesMatch(
4529+
matchingTopLevelDecls, [&name](const DeclAttributes attrs) -> bool {
4530+
if (auto objcAttr = attrs.getAttribute<ObjCAttr>())
4531+
if (auto objcName = objcAttr->getName())
4532+
return objcName->getSimpleName() == name;
4533+
return false;
4534+
});
45294535

45304536
// Filter by decl kind
45314537
for (auto result : matchingTopLevelDecls) {

0 commit comments

Comments
 (0)