File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -63,8 +63,10 @@ std::string SpecializationMangler::finalize() {
6363 StringRef FuncName = Function ? Function->getName () : StringRef (FunctionName);
6464 NodePointer FuncTopLevel = nullptr ;
6565 if (FuncName.starts_with (MANGLING_PREFIX_STR)) {
66+ // Demangling can fail, i.e. FuncTopLevel == nullptr, if the user provides
67+ // a custom not-demangable `@_silgen_name` (but still containing the "$s"
68+ // mangling prefix).
6669 FuncTopLevel = D.demangleSymbol (FuncName);
67- assert (FuncTopLevel);
6870 }
6971 else if (FuncName.starts_with (MANGLING_PREFIX_EMBEDDED_STR)) {
7072 FuncTopLevel = D.demangleSymbol (FuncName);
Original file line number Diff line number Diff line change @@ -1665,3 +1665,22 @@ bb0(%0 : $Int):
16651665 dealloc_stack %1
16661666 return %11
16671667}
1668+
1669+
1670+ sil hidden [ossa] @$s_custom_not_demangable_name : $@convention(thin) <T> (@thick T.Type) -> () {
1671+ bb0(%0 : $@thick T.Type):
1672+ %8 = tuple ()
1673+ return %8 : $()
1674+ }
1675+
1676+ // CHECK-LABEL: sil [ossa] @call_custom_name :
1677+ // CHECK: function_ref @$s29$s_custom_not_demangable_nameSi_Ttg5 : $@convention(thin) () -> ()
1678+ // CHECK: } // end sil function 'call_custom_name'
1679+ sil [ossa] @call_custom_name : $@convention(thin) () -> () {
1680+ bb0:
1681+ %2 = function_ref @$s_custom_not_demangable_name : $@convention(thin) <τ_0_0> (@thick τ_0_0.Type) -> ()
1682+ %3 = metatype $@thick Int.Type
1683+ %4 = apply %2<Int>(%3) : $@convention(thin) <τ_0_0> (@thick τ_0_0.Type) -> ()
1684+ %5 = tuple ()
1685+ return %5 : $()
1686+ }
You can’t perform that action at this time.
0 commit comments