diff options
author | Anders Carlsson <andersca@mac.com> | 2011-10-31 16:27:11 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2011-10-31 16:27:11 +0000 |
commit | eea64802558cc398571938b1f28cda1d4fa79ec3 (patch) | |
tree | cff7c15350ed90fd8824ec94b26d93678d9da975 /lib/CodeGen/CGCall.cpp | |
parent | f453cb9f677e16c00b358ec91eccf5f003765dc6 (diff) |
In x86_64, when calling an Objective-C method that returns a _Complex long double, make sure to use the objc_msgSend_fp2ret function which ensures that the return value will be {0, 0} if the receiver is nil.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143350 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGCall.cpp')
-rw-r--r-- | lib/CodeGen/CGCall.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/CodeGen/CGCall.cpp b/lib/CodeGen/CGCall.cpp index f9eaedab18..6e3b70cef8 100644 --- a/lib/CodeGen/CGCall.cpp +++ b/lib/CodeGen/CGCall.cpp @@ -611,6 +611,17 @@ bool CodeGenModule::ReturnTypeUsesFPRet(QualType ResultType) { return false; } +bool CodeGenModule::ReturnTypeUsesFP2Ret(QualType ResultType) { + if (const ComplexType *CT = ResultType->getAs<ComplexType>()) { + if (const BuiltinType *BT = CT->getElementType()->getAs<BuiltinType>()) { + if (BT->getKind() == BuiltinType::LongDouble) + return getContext().getTargetInfo().useObjCFP2RetForComplexLongDouble(); + } + } + + return false; +} + llvm::FunctionType *CodeGenTypes::GetFunctionType(GlobalDecl GD) { const CGFunctionInfo &FI = getFunctionInfo(GD); |