Skip to content

Commit ea4646f

Browse files
authored
Merge pull request #66177 from NuriAmari/cyclic-lookup-fix
[Swift-ObjC-Interop] Speculative cyclic lookup fix
2 parents f467295 + f676b75 commit ea4646f

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)