diff options
author | Aaron Ballman <aaron@aaronballman.com> | 2013-12-18 16:23:37 +0000 |
---|---|---|
committer | Aaron Ballman <aaron@aaronballman.com> | 2013-12-18 16:23:37 +0000 |
commit | 0362a6d466e68a0dfdda8c3c8e0947ce8747e5ae (patch) | |
tree | b0246fcfc2920b04506201b7d0f81205741c467d /clang/lib/CodeGen | |
parent | 4b0ffe7e493c07a2416e7005c370e027e13d4ac5 (diff) | |
download | bcm5719-llvm-0362a6d466e68a0dfdda8c3c8e0947ce8747e5ae.tar.gz bcm5719-llvm-0362a6d466e68a0dfdda8c3c8e0947ce8747e5ae.zip |
Implement the MSABI and SysVABI calling conventions for Objective-C method declarations. This appears to be an omission from r189644.
llvm-svn: 197584
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/CGCall.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp index 50cbdb1b071..8cc61e99bf5 100644 --- a/clang/lib/CodeGen/CGCall.cpp +++ b/clang/lib/CodeGen/CGCall.cpp @@ -123,7 +123,7 @@ CodeGenTypes::arrangeFreeFunctionType(CanQual<FunctionProtoType> FTP) { return ::arrangeFreeFunctionType(*this, argTypes, FTP); } -static CallingConv getCallingConventionForDecl(const Decl *D) { +static CallingConv getCallingConventionForDecl(const Decl *D, bool IsWindows) { // Set the appropriate calling convention for the Function. if (D->hasAttr<StdCallAttr>()) return CC_X86StdCall; @@ -146,6 +146,12 @@ static CallingConv getCallingConventionForDecl(const Decl *D) { if (D->hasAttr<IntelOclBiccAttr>()) return CC_IntelOclBicc; + if (D->hasAttr<MSABIAttr>()) + return IsWindows ? CC_C : CC_X86_64Win64; + + if (D->hasAttr<SysVABIAttr>()) + return IsWindows ? CC_X86_64SysV : CC_C; + return CC_C; } @@ -293,7 +299,8 @@ CodeGenTypes::arrangeObjCMessageSendSignature(const ObjCMethodDecl *MD, } FunctionType::ExtInfo einfo; - einfo = einfo.withCallingConv(getCallingConventionForDecl(MD)); + bool IsWindows = getContext().getTargetInfo().getTriple().isOSWindows(); + einfo = einfo.withCallingConv(getCallingConventionForDecl(MD, IsWindows)); if (getContext().getLangOpts().ObjCAutoRefCount && MD->hasAttr<NSReturnsRetainedAttr>()) |