summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGCall.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2011-10-31 16:27:11 +0000
committerAnders Carlsson <andersca@mac.com>2011-10-31 16:27:11 +0000
commit2f1a6c3f015c6a7db51ef51f99519f88c43f894a (patch)
tree2a4d018b4a94339d36b1b8ceca018c88399455af /clang/lib/CodeGen/CGCall.cpp
parenta35cdd68cf799d1cd2f9346e24bcd67d0b2afad3 (diff)
downloadbcm5719-llvm-2f1a6c3f015c6a7db51ef51f99519f88c43f894a.tar.gz
bcm5719-llvm-2f1a6c3f015c6a7db51ef51f99519f88c43f894a.zip
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.
llvm-svn: 143350
Diffstat (limited to 'clang/lib/CodeGen/CGCall.cpp')
-rw-r--r--clang/lib/CodeGen/CGCall.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index f9eaedab18f..6e3b70cef85 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/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);
OpenPOWER on IntegriCloud