File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed
Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -1201,6 +1201,15 @@ std::string SILDeclRef::mangle(ManglingKind MKind) const {
12011201 SKind);
12021202
12031203 case SILDeclRef::Kind::Allocator:
1204+ // As a special case, initializers can have manually mangled names.
1205+ // Use the SILGen name only for the original non-thunked, non-curried entry
1206+ // point.
1207+ if (auto NameA = getDecl ()->getAttrs ().getAttribute <SILGenNameAttr>()) {
1208+ if (!NameA->Name .empty () && !isThunk ()) {
1209+ return NameA->Name .str ();
1210+ }
1211+ }
1212+
12041213 return mangler.mangleConstructorEntity (cast<ConstructorDecl>(getDecl ()),
12051214 /* allocating*/ true ,
12061215 SKind);
Original file line number Diff line number Diff line change @@ -51,3 +51,17 @@ private func PlainPrivate() { }
5151// CHECK: define hidden void @cdecl_internal
5252// CHECK: define hidden swiftcc void @"$s7asmname13CDeclInternal
5353// CHECK: define internal void @cdecl_private()
54+
55+ // silgen_name on enum constructors
56+ public enum X {
57+ case left( Int64 )
58+ case right( Int64 )
59+ }
60+
61+ extension X {
62+ // CHECK: define{{( dllexport)?}}{{( protected)?}} swiftcc { i64, i8 } @blah_X_constructor
63+ @_silgen_name ( " blah_X_constructor " )
64+ public init ( blah: Int64 ) {
65+ self = . left( blah)
66+ }
67+ }
You can’t perform that action at this time.
0 commit comments