Skip to content

Commit c5a715d

Browse files
committed
Revert "[cxx-interop] Fix two issues with extending nested types across modules."
This reverts commit 6ba7a1e.
1 parent 2d12fab commit c5a715d

12 files changed

+7
-129
lines changed

lib/ClangImporter/ClangImporter.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2547,10 +2547,6 @@ static bool isVisibleFromModule(const ClangModuleUnit *ModuleFilter,
25472547
auto *Importer = static_cast<ClangImporter *>(Ctx.getClangModuleLoader());
25482548
auto ClangNode = Importer->getEffectiveClangNode(VD);
25492549

2550-
// Decls in the __ObjC bridging header is always visible.
2551-
if (VD->getModuleContext() == Importer->getImportedHeaderModule())
2552-
return true;
2553-
25542550
// Macros can be "redeclared" by putting an equivalent definition in two
25552551
// different modules. (We don't actually check the equivalence.)
25562552
// FIXME: We're also not checking if the redeclaration is in /this/ module.

lib/ClangImporter/ImportDecl.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2473,11 +2473,6 @@ namespace {
24732473
for (auto redecl : decl->redecls())
24742474
Impl.ImportedDecls[{redecl, getVersion()}] = enumDecl;
24752475

2476-
// Because a namespaces's decl context is the bridging header, make sure
2477-
// we add them to the bridging header lookup table.
2478-
addEntryToLookupTable(*Impl.BridgingHeaderLookupTable,
2479-
const_cast<clang::NamespaceDecl *>(decl),
2480-
Impl.getNameImporter());
24812476
return enumDecl;
24822477
}
24832478

lib/ClangImporter/ImporterImpl.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,9 @@ class LLVM_LIBRARY_VISIBILITY ClangImporter::Implementation
363363
"<bridging-header-import>";
364364

365365
private:
366+
/// The Swift lookup table for the bridging header.
367+
std::unique_ptr<SwiftLookupTable> BridgingHeaderLookupTable;
368+
366369
/// The Swift lookup tables, per module.
367370
///
368371
/// Annoyingly, we list this table early so that it gets torn down after
@@ -426,9 +429,6 @@ class LLVM_LIBRARY_VISIBILITY ClangImporter::Implementation
426429
llvm::SmallDenseMap<ModuleDecl *, SourceFile *> ClangSwiftAttrSourceFiles;
427430

428431
public:
429-
/// The Swift lookup table for the bridging header.
430-
std::unique_ptr<SwiftLookupTable> BridgingHeaderLookupTable;
431-
432432
/// Mapping of already-imported declarations.
433433
llvm::DenseMap<std::pair<const clang::Decl *, Version>, Decl *> ImportedDecls;
434434

test/IDE/complete_from_clang_framework.swift

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,6 @@ func testSwiftCompletions(foo: SwiftStruct) {
125125
// CLANG_BAR-DAG: Decl[GlobalVar]/OtherModule[Bar]: BAR_MACRO_1[#Int32#]{{; name=.+$}}
126126
// CLANG_BAR-DAG: Decl[Struct]/OtherModule[Bar]: SomeItemSet[#SomeItemSet#]
127127
// CLANG_BAR-DAG: Decl[TypeAlias]/OtherModule[Bar]: SomeEnvironment[#SomeItemSet#]
128-
// CLANG_BAR-DAG: Decl[TypeAlias]/OtherModule[__ObjC]: __NSConstantString[#__NSConstantString_tag#]; name=__NSConstantString
129-
// CLANG_BAR-DAG: Decl[TypeAlias]/OtherModule[__ObjC]: __builtin_ms_va_list[#UnsafeMutablePointer<CChar>#]; name=__builtin_ms_va_list
130-
// CLANG_BAR-DAG: Decl[TypeAlias]/OtherModule[__ObjC]: __builtin_va_list[#(__va_list_tag)#]; name=__builtin_va_list
131128
// CLANG_BAR: End completions
132129

133130
// CLANG_BOTH_FOO_BAR: Begin completions
@@ -154,15 +151,12 @@ func testCompleteModuleQualifiedFoo2() {
154151
Foo#^CLANG_QUAL_FOO_2^#
155152
// If the number of results below changes, then you need to add a result to the
156153
// list below.
157-
// CLANG_QUAL_FOO_2: Begin completions, 82 items
154+
// CLANG_QUAL_FOO_2: Begin completions, 76 items
158155
// CLANG_QUAL_FOO_2-DAG: Decl[Class]/OtherModule[Foo]: .FooClassBase[#FooClassBase#]{{; name=.+$}}
159156
// CLANG_QUAL_FOO_2-DAG: Decl[Class]/OtherModule[Foo]: .FooClassDerived[#FooClassDerived#]{{; name=.+$}}
160157
// CLANG_QUAL_FOO_2-DAG: Decl[Class]/OtherModule[Foo]: .ClassWithInternalProt[#ClassWithInternalProt#]{{; name=.+$}}
161158
// CLANG_QUAL_FOO_2-DAG: Decl[Struct]/OtherModule[Foo]: ._InternalStruct[#_InternalStruct#]
162159
// CLANG_QUAL_FOO_2-DAG: Decl[Class]/OtherModule[Foo]: .FooClassPropertyOwnership[#FooClassPropertyOwnership#]{{; name=.+$}}
163-
// CLANG_QUAL_FOO_2-DAG: Decl[TypeAlias]/OtherModule[__ObjC]: .__NSConstantString[#__NSConstantString_tag#]; name=__NSConstantString
164-
// CLANG_QUAL_FOO_2-DAG: Decl[TypeAlias]/OtherModule[__ObjC]: .__builtin_ms_va_list[#UnsafeMutablePointer<CChar>#]; name=__builtin_ms_va_list
165-
// CLANG_QUAL_FOO_2-DAG: Decl[TypeAlias]/OtherModule[__ObjC]: .__builtin_va_list[#(__va_list_tag)#]; name=__builtin_va_list
166160
// CLANG_QUAL_FOO_2-DAG: Decl[FreeFunction]/OtherModule[Foo]: ._internalTopLevelFunc()[#Void#]
167161
// CLANG_QUAL_FOO_2-DAG: Decl[Enum]/OtherModule[Foo]: .FooComparisonResult[#FooComparisonResult#]{{; name=.+$}}
168162
// CLANG_QUAL_FOO_2-DAG: Decl[FreeFunction]/OtherModule[Foo]: .fooFunc1({#(a): Int32#})[#Int32#]{{; name=.+$}}
@@ -226,17 +220,14 @@ func testCompleteModuleQualifiedFoo2() {
226220
// CLANG_QUAL_FOO_2-DAG: Decl[Class]/OtherModule[Foo]: .FooRepeatedMembers[#FooRepeatedMembers#]{{; name=.+$}}
227221
// CLANG_QUAL_FOO_2-DAG: Decl[Class]/OtherModule[Foo]: .FooClassWithClassProperties[#FooClassWithClassProperties#];
228222
// CLANG_QUAL_FOO_2-DAG: Decl[Enum]/OtherModule[Foo]: .SCNFilterMode[#SCNFilterMode#];
229-
// CLANG_QUAL_FOO_2-DAG: Decl[TypeAlias]/OtherModule[__ObjC]: .__NSConstantString[#__NSConstantString_tag#]; name=__NSConstantString
230-
// CLANG_QUAL_FOO_2-DAG: Decl[TypeAlias]/OtherModule[__ObjC]: .__builtin_ms_va_list[#UnsafeMutablePointer<CChar>#]; name=__builtin_ms_va_list
231-
// CLANG_QUAL_FOO_2-DAG: Decl[TypeAlias]/OtherModule[__ObjC]: .__builtin_va_list[#(__va_list_tag)#]; name=__builtin_va_list
232223
// CLANG_QUAL_FOO_2: End completions
233224
}
234225

235226
func testCompleteModuleQualifiedBar1() {
236227
Bar.#^CLANG_QUAL_BAR_1^#
237228
// If the number of results below changes, this is an indication that you need
238229
// to add a result to the appropriate list. Do not just bump the number!
239-
// CLANG_QUAL_BAR_1: Begin completions, 11 items
230+
// CLANG_QUAL_BAR_1: Begin completions, 8 items
240231
}
241232

242233
func testCompleteFunctionCall1() {

test/Interop/Cxx/modules/Inputs/bridge-header.h

Lines changed: 0 additions & 12 deletions
This file was deleted.

test/Interop/Cxx/modules/Inputs/module.modulemap

Lines changed: 0 additions & 4 deletions
This file was deleted.

test/Interop/Cxx/modules/Inputs/namespace-extension-lib.swift

Lines changed: 0 additions & 13 deletions
This file was deleted.

test/Interop/Cxx/modules/Inputs/namespace.h

Lines changed: 0 additions & 18 deletions
This file was deleted.

test/Interop/Cxx/modules/Inputs/struct-from-bridge-extension-lib.swift

Lines changed: 0 additions & 7 deletions
This file was deleted.

test/Interop/Cxx/modules/use-namespace-extension-lib.swift

Lines changed: 0 additions & 26 deletions
This file was deleted.

test/Interop/Cxx/modules/use-struct-from-bridge-extension-lib.swift

Lines changed: 0 additions & 24 deletions
This file was deleted.

test/Interop/Cxx/namespace/templates-module-interface.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@
4747
// CHECK-NEXT: }
4848
// CHECK-NEXT: typealias ForwardDeclaredClassTemplateOutOfLineChar = TemplatesNS1.TemplatesNS2.__CxxTemplateInstN12TemplatesNS112TemplatesNS237ForwardDeclaredClassTemplateOutOfLineIcEE
4949
// CHECK-NEXT: enum TemplatesNS4 {
50-
// CHECK-NEXT: struct __CxxTemplateInstN12TemplatesNS417HasSpecializationIiEE {
50+
// CHECK-NEXT: struct __CxxTemplateInstN12TemplatesNS417HasSpecializationIcEE {
5151
// CHECK-NEXT: init()
5252
// CHECK-NEXT: }
53-
// CHECK-NEXT: struct __CxxTemplateInstN12TemplatesNS417HasSpecializationIcEE {
53+
// CHECK-NEXT: struct __CxxTemplateInstN12TemplatesNS417HasSpecializationIiEE {
5454
// CHECK-NEXT: init()
5555
// CHECK-NEXT: }
5656
// CHECK-NEXT: struct HasSpecialization<> {

0 commit comments

Comments
 (0)