Files
swift-mirror/test/IRGen/objc_runtime_name_clang_attr.swift
Joe Groff fe1186447b IRGen: Generate runtime type manglings using ObjC runtime names.
In order for the runtime demangler to be able to find ObjC classes and protocols, it needs to
have the runtime name of the declaration be in the mangled name. Only do this for runtime manglings,
to minimize the potential ABI impact for symbol names that already have the source-level names of
ObjC entities baked in. Fixes SR-12169 | rdar://59306590.
2020-03-05 16:55:00 -08:00

20 lines
861 B
Swift

// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-ir -import-objc-header %S/Inputs/objc_runtime_name_clang_attr.h %s | %FileCheck %s
// REQUIRES: objc_interop
// Use the runtime name for runtime instantiation
// CHECK-LABEL: @"$sSo16ObjCRuntimeNamedCSgMD" = {{.*}}@"symbolic So26ObjCRuntimeNameIsDifferentCSg"
public func getMetadata() -> Any.Type {
return ObjCRuntimeNamed?.self
}
// CHECK-LABEL: @"$sSo21ObjCProtoRuntimeNamed_pSgMD" = {{.*}}@"symbolic So31ObjCProtoRuntimeNameIsDifferent_pSg"
public func getMetadata2() -> Any.Type {
return ObjCProtoRuntimeNamed?.self
}
// Use the source name for symbols to avoid breaking ABI.
// CHECK-LABEL: define{{.*}}3fooyySo16ObjCRuntimeNamedCF
public func foo(_: ObjCRuntimeNamed) {}
// CHECK-LABEL: define{{.*}}3fooyySo21ObjCProtoRuntimeNamed_pF
public func foo(_: ObjCProtoRuntimeNamed) {}