@@ -1456,10 +1456,25 @@ DirectLookupRequest::evaluate(Evaluator &evaluator,
1456
1456
auto allFound = evaluateOrDefault (
1457
1457
ctx.evaluator , CXXNamespaceMemberLookup ({cast<EnumDecl>(decl), name}),
1458
1458
{});
1459
- for (auto found : allFound)
1460
- Table.addMember (found);
1461
-
1462
1459
populateLookupTableEntryFromExtensions (ctx, Table, baseName, decl);
1460
+
1461
+ // Bypass the regular member lookup table if we find something in
1462
+ // the original C++ namespace. We don't want to store the C++ decl in the
1463
+ // lookup table as the decl can be referenced from multiple namespace
1464
+ // declarations due to inline namespaces. We still merge in the other
1465
+ // entries found in the lookup table, to support finding members in
1466
+ // namespace extensions.
1467
+ if (!allFound.empty ()) {
1468
+ auto known = Table.find (name);
1469
+ if (known != Table.end ()) {
1470
+ auto swiftLookupResult = maybeFilterOutAttrImplements (
1471
+ known->second , name, includeAttrImplements);
1472
+ for (auto foundSwiftDecl : swiftLookupResult) {
1473
+ allFound.push_back (foundSwiftDecl);
1474
+ }
1475
+ }
1476
+ return allFound;
1477
+ }
1463
1478
} else if (isa_and_nonnull<clang::RecordDecl>(decl->getClangDecl ())) {
1464
1479
auto allFound = evaluateOrDefault (
1465
1480
ctx.evaluator ,
0 commit comments