Mangle imported declarations using their C names.

This makes them consistent no matter what shenanigans are pulled by
the importer, particularly NS_ENUM vs. NS_OPTIONS and NS_SWIFT_NAME.

The 'NSErrorDomain' API note /nearly/ works with this, but the
synthesized error struct is still mangled as a Swift declaration,
which means it's not rename-stable. See follow-up commits.

The main place where this still falls down is NS_STRING_ENUM: when
this is applied, a typedef is imported as a unique struct, but without
it it's just a typealias for the underlying type. There's also still a
problem with synthesized conformances, which have a module mangled
into the witness table symbol even though that symbol is linkonce_odr.

rdar://problem/31616162
This commit is contained in:
Jordan Rose
2017-04-19 17:55:56 -07:00
parent bfa4ca4f00
commit 38e2cfe1e2
33 changed files with 319 additions and 186 deletions

View File

@@ -63,7 +63,7 @@ print("ObjC quick look objects:")
// CHECK-LABEL: ObjC enums:
print("ObjC enums:")
// CHECK-NEXT: We cannot reflect ComparisonResult yet
// CHECK-NEXT: We cannot reflect NSComparisonResult yet
print("We cannot reflect \(ComparisonResult.orderedAscending) yet")
// Don't crash when introspecting framework types such as NSURL.