Skip to content

Commit 48ec67c

Browse files
committed
Clang importer: filter out declarations found in the Standard Library.
With this, everything builds and runs properly when the Swift name lookup tables are enabled for AnyObject and module-scope lookups.
1 parent d71de5d commit 48ec67c

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

lib/ClangImporter/ClangImporter.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4559,6 +4559,13 @@ void ClangImporter::Implementation::lookupValue(
45594559
if (!decl) continue;
45604560
}
45614561

4562+
// If we found a declaration from the standard library, make sure
4563+
// it does not show up in the lookup results for the imported
4564+
// module.
4565+
if (decl->getDeclContext()->isModuleScopeContext() &&
4566+
decl->getModuleContext() == getStdlibModule())
4567+
continue;
4568+
45624569
// If the name matched, report this result.
45634570
if (decl->getFullName().matchesRef(name))
45644571
consumer.foundDecl(decl, DeclVisibilityKind::VisibleAtTopLevel);

test/IRGen/existentials_objc.sil

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// RUN: rm -rf %t && mkdir %t
22
// RUN: %build-irgen-test-overlays
33
// RUN: %target-swift-frontend -sdk %S/Inputs -I %t %s -emit-ir | FileCheck %s
4+
// RUN: %target-swift-frontend -enable-swift-name-lookup-tables -sdk %S/Inputs -I %t %s -emit-ir | FileCheck %s
45

56
// REQUIRES: CPU=x86_64
67
// REQUIRES: objc_interop

0 commit comments

Comments
 (0)