diff options
author | Anders Carlsson <andersca@mac.com> | 2010-06-21 20:59:55 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2010-06-21 20:59:55 +0000 |
commit | 7e70fb217dcdf96faf34df3e197c3831c86f8089 (patch) | |
tree | 2b704e41775d9354075e4d1c13b78aae0313196a /lib/CodeGen/CGObjC.cpp | |
parent | 9a140845438c2fc31e7d48a6dedbc695f4c83c68 (diff) |
Fix an Obj-C++ miscompile when calling an Obj-C method that returns a C++ reference.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106477 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGObjC.cpp')
-rw-r--r-- | lib/CodeGen/CGObjC.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/CodeGen/CGObjC.cpp b/lib/CodeGen/CGObjC.cpp index 95be0dd120..30f7ab55ce 100644 --- a/lib/CodeGen/CGObjC.cpp +++ b/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()); |