summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGObjC.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2010-06-21 20:59:55 +0000
committerAnders Carlsson <andersca@mac.com>2010-06-21 20:59:55 +0000
commit280e61f148d66ba5a5352e7d9dfa70ce64f1fa29 (patch)
treef128049933f12378052dc7efe7ada6ee8499b3a1 /clang/lib/CodeGen/CGObjC.cpp
parentc62ab8d064f6c6a8553ffe4571c9da7e9ecbc337 (diff)
downloadbcm5719-llvm-280e61f148d66ba5a5352e7d9dfa70ce64f1fa29.tar.gz
bcm5719-llvm-280e61f148d66ba5a5352e7d9dfa70ce64f1fa29.zip
Fix an Obj-C++ miscompile when calling an Obj-C method that returns a C++ reference.
llvm-svn: 106477
Diffstat (limited to 'clang/lib/CodeGen/CGObjC.cpp')
-rw-r--r--clang/lib/CodeGen/CGObjC.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGObjC.cpp b/clang/lib/CodeGen/CGObjC.cpp
index 95be0dd1204..30f7ab55ce9 100644
--- a/clang/lib/CodeGen/CGObjC.cpp
+++ b/clang/lib/CodeGen/CGObjC.cpp
@@ -90,11 +90,14 @@ RValue CodeGenFunction::EmitObjCMessageExpr(const ObjCMessageExpr *E,
CallArgList Args;
EmitCallArgs(Args, E->getMethodDecl(), E->arg_begin(), E->arg_end());
+ QualType ResultType =
+ E->getMethodDecl() ? E->getMethodDecl()->getResultType() : E->getType();
+
if (isSuperMessage) {
// super is only valid in an Objective-C method
const ObjCMethodDecl *OMD = cast<ObjCMethodDecl>(CurFuncDecl);
bool isCategoryImpl = isa<ObjCCategoryImplDecl>(OMD->getDeclContext());
- return Runtime.GenerateMessageSendSuper(*this, Return, E->getType(),
+ return Runtime.GenerateMessageSendSuper(*this, Return, ResultType,
E->getSelector(),
OMD->getClassInterface(),
isCategoryImpl,
@@ -104,7 +107,7 @@ RValue CodeGenFunction::EmitObjCMessageExpr(const ObjCMessageExpr *E,
E->getMethodDecl());
}
- return Runtime.GenerateMessageSend(*this, Return, E->getType(),
+ return Runtime.GenerateMessageSend(*this, Return, ResultType,
E->getSelector(),
Receiver, Args, OID,
E->getMethodDecl());
OpenPOWER on IntegriCloud