r197584 - Implement the MSABI and SysVABI calling conventions for Objective-C method declarations. This appears to be an omission from r189644.
Aaron Ballman
aaron at aaronballman.com
Wed Dec 18 08:23:37 PST 2013
Author: aaronballman
Date: Wed Dec 18 10:23:37 2013
New Revision: 197584
URL: http://llvm.org/viewvc/llvm-project?rev=197584&view=rev
Log:
Implement the MSABI and SysVABI calling conventions for Objective-C method declarations. This appears to be an omission from r189644.
Modified:
cfe/trunk/lib/CodeGen/CGCall.cpp
cfe/trunk/test/CodeGenObjC/attr-callconv.m
Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=197584&r1=197583&r2=197584&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Wed Dec 18 10:23:37 2013
@@ -123,7 +123,7 @@ CodeGenTypes::arrangeFreeFunctionType(Ca
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 getCallingConventionF
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::arrangeObjCMessageSendSign
}
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>())
Modified: cfe/trunk/test/CodeGenObjC/attr-callconv.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/attr-callconv.m?rev=197584&r1=197583&r2=197584&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenObjC/attr-callconv.m (original)
+++ cfe/trunk/test/CodeGenObjC/attr-callconv.m Wed Dec 18 10:23:37 2013
@@ -5,7 +5,9 @@
@end
@implementation Test
-- (void)test __attribute__((stdcall)) {
+- (void)test __attribute__((stdcall)) {}
// CHECK: define{{.*}}x86_stdcallcc{{.*}}Test test
-}
+
+- (void)test2 __attribute__((ms_abi)) {}
+ // CHECK: define{{.*}}x86_64_win64cc{{.*}}Test test2
@end
More information about the cfe-commits
mailing list