Author: compnerd Date: Tue Feb 6 17:55:08 2018 New Revision: 324439 URL: http://llvm.org/viewvc/llvm-project?rev=324439&view=rev Log: AST: support SwiftCC on MS ABI
Microsoft has reserved the identifier 'S' as the swift calling convention. Decorate the symbols appropriately. This enables swift on Windows. Added: cfe/trunk/test/CodeGenCXX/msabi-swiftcall-cc.cpp Modified: cfe/trunk/lib/AST/MicrosoftMangle.cpp Modified: cfe/trunk/lib/AST/MicrosoftMangle.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/MicrosoftMangle.cpp?rev=324439&r1=324438&r2=324439&view=diff ============================================================================== --- cfe/trunk/lib/AST/MicrosoftMangle.cpp (original) +++ cfe/trunk/lib/AST/MicrosoftMangle.cpp Tue Feb 6 17:55:08 2018 @@ -950,11 +950,10 @@ void MicrosoftCXXNameMangler::mangleUnqu } } +// <postfix> ::= <unqualified-name> [<postfix>] +// ::= <substitution> [<postfix>] void MicrosoftCXXNameMangler::mangleNestedName(const NamedDecl *ND) { - // <postfix> ::= <unqualified-name> [<postfix>] - // ::= <substitution> [<postfix>] const DeclContext *DC = getEffectiveDeclContext(ND); - while (!DC->isTranslationUnit()) { if (isa<TagDecl>(ND) || isa<VarDecl>(ND)) { unsigned Disc; @@ -2136,6 +2135,7 @@ void MicrosoftCXXNameMangler::mangleCall case CC_X86StdCall: Out << 'G'; break; case CC_X86FastCall: Out << 'I'; break; case CC_X86VectorCall: Out << 'Q'; break; + case CC_Swift: Out << 'S'; break; case CC_X86RegCall: Out << 'w'; break; } } Added: cfe/trunk/test/CodeGenCXX/msabi-swiftcall-cc.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/msabi-swiftcall-cc.cpp?rev=324439&view=auto ============================================================================== --- cfe/trunk/test/CodeGenCXX/msabi-swiftcall-cc.cpp (added) +++ cfe/trunk/test/CodeGenCXX/msabi-swiftcall-cc.cpp Tue Feb 6 17:55:08 2018 @@ -0,0 +1,28 @@ +// RUN: %clang_cc1 -triple i686-unknown-windows-msvc -fdeclspec -emit-llvm %s -o - | FileCheck %s + +void __attribute__((__swiftcall__)) f() {} +// CHECK-DAG: @"\01?f@@YSXXZ" + +void (__attribute__((__swiftcall__)) *p)(); +// CHECK-DAG: @"\01?p@@3P6SXXZA" + +namespace { +void __attribute__((__swiftcall__)) __attribute__((__used__)) f() { } +// CHECK-DAG: "\01?f@?A@@YSXXZ" +} + +namespace n { +void __attribute__((__swiftcall__)) f() {} +// CHECK-DAG: "\01?f@n@@YSXXZ" +} + +struct __declspec(dllexport) S { + S(const S &) = delete; + S & operator=(const S &) = delete; + void __attribute__((__swiftcall__)) m() { } + // CHECK-DAG: "\01?m@S@@QASXXZ" +}; + +void f(void (__attribute__((__swiftcall__))())) {} +// CHECK-DAG: "\01?f@@YAXP6SXXZ@Z" + _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits