mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Mangle synthesized error structs as a variant of the imported enum
When importing a C enum with the ns_error_domain attribute, we
synthesize a struct containing an NSError object to represent errors
in that domain. That synthesized struct should have a mangled name
that ties it to the original C enum, if we want it to be stable, and
now it does.
Before: $SSC7MyErrorV (a normal struct, which is a lie)
After: $SSC11MyErrorCode13ns_error_enumLLV
kind=Global
kind=Structure
kind=Module, text="__C_Synthesized"
kind=PrivateDeclName
kind=Identifier, text="ns_error_enum"
kind=Identifier, text="MyErrorCode"
Using the "private discriminator" feature allows us to pack in extra
information about the declaration without changing the mangling
grammar, and without stepping on anything the importer is using.
More rdar://problem/24688918
This commit is contained in:
@@ -1422,6 +1422,8 @@ namespace decls_block {
|
||||
= BCRecordLayout<ObjCRuntimeName_DECL_ATTR>;
|
||||
using RestatedObjCConformanceDeclAttrLayout
|
||||
= BCRecordLayout<RestatedObjCConformance_DECL_ATTR>;
|
||||
using CustomTypeNameManglingDeclAttrLayout
|
||||
= BCRecordLayout<CustomTypeNameMangling_DECL_ATTR>;
|
||||
|
||||
using InlineDeclAttrLayout = BCRecordLayout<
|
||||
Inline_DECL_ATTR,
|
||||
|
||||
Reference in New Issue
Block a user