diff --git a/clang/lib/AST/MicrosoftMangle.cpp b/clang/lib/AST/MicrosoftMangle.cpp --- a/clang/lib/AST/MicrosoftMangle.cpp +++ b/clang/lib/AST/MicrosoftMangle.cpp @@ -2684,6 +2684,7 @@ // ::= I # __fastcall // ::= J # __export __fastcall // ::= Q # __vectorcall + // ::= S # __attribute__((__swiftcall__)) // Clang-only // ::= w # __regcall // The 'export' calling conventions are from a bygone era // (*cough*Win16*cough*) when functions were declared for export with diff --git a/llvm/include/llvm/Demangle/MicrosoftDemangleNodes.h b/llvm/include/llvm/Demangle/MicrosoftDemangleNodes.h --- a/llvm/include/llvm/Demangle/MicrosoftDemangleNodes.h +++ b/llvm/include/llvm/Demangle/MicrosoftDemangleNodes.h @@ -67,6 +67,7 @@ Eabi, Vectorcall, Regcall, + Swift, // Clang-only }; enum class ReferenceKind : uint8_t { None, LValueRef, RValueRef }; diff --git a/llvm/lib/Demangle/MicrosoftDemangle.cpp b/llvm/lib/Demangle/MicrosoftDemangle.cpp --- a/llvm/lib/Demangle/MicrosoftDemangle.cpp +++ b/llvm/lib/Demangle/MicrosoftDemangle.cpp @@ -1711,6 +1711,8 @@ return CallingConv::Eabi; case 'Q': return CallingConv::Vectorcall; + case 'S': + return CallingConv::Swift; } return CallingConv::None; diff --git a/llvm/lib/Demangle/MicrosoftDemangleNodes.cpp b/llvm/lib/Demangle/MicrosoftDemangleNodes.cpp --- a/llvm/lib/Demangle/MicrosoftDemangleNodes.cpp +++ b/llvm/lib/Demangle/MicrosoftDemangleNodes.cpp @@ -107,6 +107,9 @@ case CallingConv::Clrcall: OS << "__clrcall"; break; + case CallingConv::Swift: + OS << "__attribute__((__swiftcall__)) "; + break; default: break; } diff --git a/llvm/test/Demangle/ms-mangle.test b/llvm/test/Demangle/ms-mangle.test --- a/llvm/test/Demangle/ms-mangle.test +++ b/llvm/test/Demangle/ms-mangle.test @@ -338,6 +338,9 @@ ?vector_func@@YQXXZ ; CHECK: void __vectorcall vector_func(void) +?swift_func@@YSXXZ +; CHECK: void __attribute__((__swiftcall__)) swift_func(void) + ??$fn_tmpl@$1?extern_c_func@@YAXXZ@@YAXXZ ; CHECK: void __cdecl fn_tmpl<&void __cdecl extern_c_func(void)>(void)