varungandhi-apple created this revision. varungandhi-apple added a reviewer: compnerd. Herald added a subscriber: hiraditya. varungandhi-apple requested review of this revision. Herald added projects: clang, LLVM. Herald added subscribers: llvm-commits, cfe-commits.
Previously, Clang was able to mangle the Swift calling convention but 'MicrosoftDemangle.cpp' was not able to demangle it. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D95053 Files: clang/lib/AST/MicrosoftMangle.cpp llvm/include/llvm/Demangle/MicrosoftDemangleNodes.h llvm/lib/Demangle/MicrosoftDemangle.cpp llvm/lib/Demangle/MicrosoftDemangleNodes.cpp llvm/test/Demangle/ms-mangle.test Index: llvm/test/Demangle/ms-mangle.test =================================================================== --- llvm/test/Demangle/ms-mangle.test +++ 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) Index: llvm/lib/Demangle/MicrosoftDemangleNodes.cpp =================================================================== --- llvm/lib/Demangle/MicrosoftDemangleNodes.cpp +++ llvm/lib/Demangle/MicrosoftDemangleNodes.cpp @@ -107,6 +107,9 @@ case CallingConv::Clrcall: OS << "__clrcall"; break; + case CallingConv::Swift: + OS << "__attribute__((__swiftcall__))"; + break; default: break; } Index: llvm/lib/Demangle/MicrosoftDemangle.cpp =================================================================== --- llvm/lib/Demangle/MicrosoftDemangle.cpp +++ 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; Index: llvm/include/llvm/Demangle/MicrosoftDemangleNodes.h =================================================================== --- llvm/include/llvm/Demangle/MicrosoftDemangleNodes.h +++ llvm/include/llvm/Demangle/MicrosoftDemangleNodes.h @@ -67,6 +67,7 @@ Eabi, Vectorcall, Regcall, + Swift, // Clang-only }; enum class ReferenceKind : uint8_t { None, LValueRef, RValueRef }; Index: clang/lib/AST/MicrosoftMangle.cpp =================================================================== --- clang/lib/AST/MicrosoftMangle.cpp +++ clang/lib/AST/MicrosoftMangle.cpp @@ -2695,6 +2695,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
Index: llvm/test/Demangle/ms-mangle.test =================================================================== --- llvm/test/Demangle/ms-mangle.test +++ 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) Index: llvm/lib/Demangle/MicrosoftDemangleNodes.cpp =================================================================== --- llvm/lib/Demangle/MicrosoftDemangleNodes.cpp +++ llvm/lib/Demangle/MicrosoftDemangleNodes.cpp @@ -107,6 +107,9 @@ case CallingConv::Clrcall: OS << "__clrcall"; break; + case CallingConv::Swift: + OS << "__attribute__((__swiftcall__))"; + break; default: break; } Index: llvm/lib/Demangle/MicrosoftDemangle.cpp =================================================================== --- llvm/lib/Demangle/MicrosoftDemangle.cpp +++ 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; Index: llvm/include/llvm/Demangle/MicrosoftDemangleNodes.h =================================================================== --- llvm/include/llvm/Demangle/MicrosoftDemangleNodes.h +++ llvm/include/llvm/Demangle/MicrosoftDemangleNodes.h @@ -67,6 +67,7 @@ Eabi, Vectorcall, Regcall, + Swift, // Clang-only }; enum class ReferenceKind : uint8_t { None, LValueRef, RValueRef }; Index: clang/lib/AST/MicrosoftMangle.cpp =================================================================== --- clang/lib/AST/MicrosoftMangle.cpp +++ clang/lib/AST/MicrosoftMangle.cpp @@ -2695,6 +2695,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
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits