Skip to content

Commit 0fbcf67

Browse files
authored
[ClangImporter] Hardcode NSString being bridged to String (#17412) (#17430)
...so that we don't have to depend on the ObjectiveC module having API notes for a class it doesn't actually define. Support for rdar://problem/40278479. (cherry picked from commit 426d27c)
1 parent 1cd7557 commit 0fbcf67

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/ClangImporter/ImportType.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -949,12 +949,13 @@ namespace {
949949
}
950950

951951
// Determine whether this Objective-C class type is bridged to
952-
// a Swift type.
952+
// a Swift type. Hardcode "NSString" since it's referenced from
953+
// the ObjectiveC module (a level below Foundation).
953954
Type bridgedType;
954955
if (auto objcClassDef = objcClass->getDefinition())
955956
bridgedType = mapSwiftBridgeAttr(objcClassDef);
956-
else
957-
bridgedType = mapSwiftBridgeAttr(objcClass);
957+
else if (objcClass->getName() == "NSString")
958+
bridgedType = Impl.SwiftContext.getStringDecl()->getDeclaredType();
958959

959960
if (bridgedType) {
960961
// Gather the type arguments.

0 commit comments

Comments
 (0)