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 {
1201
1201
SKind);
1202
1202
1203
1203
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
+
1204
1213
return mangler.mangleConstructorEntity (cast<ConstructorDecl>(getDecl ()),
1205
1214
/* allocating*/ true ,
1206
1215
SKind);
Original file line number Diff line number Diff line change @@ -51,3 +51,17 @@ private func PlainPrivate() { }
51
51
// CHECK: define hidden void @cdecl_internal
52
52
// CHECK: define hidden swiftcc void @"$s7asmname13CDeclInternal
53
53
// 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