r224525 - [Objective-C]. Patch to unify code generation for ObjCMsgSend and ObjCBoxedExpr.
Fariborz Jahanian
fjahanian at apple.com
Thu Dec 18 09:13:57 PST 2014
Author: fjahanian
Date: Thu Dec 18 11:13:56 2014
New Revision: 224525
URL: http://llvm.org/viewvc/llvm-project?rev=224525&view=rev
Log:
[Objective-C]. Patch to unify code generation for ObjCMsgSend and ObjCBoxedExpr.
Patch by Alex Denisov. NFC.
Modified:
cfe/trunk/include/clang/AST/ExprObjC.h
cfe/trunk/lib/CodeGen/CGObjC.cpp
Modified: cfe/trunk/include/clang/AST/ExprObjC.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ExprObjC.h?rev=224525&r1=224524&r2=224525&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/ExprObjC.h (original)
+++ cfe/trunk/include/clang/AST/ExprObjC.h Thu Dec 18 11:13:56 2014
@@ -124,6 +124,15 @@ public:
// Iterators
child_range children() { return child_range(&SubExpr, &SubExpr+1); }
+
+ typedef ConstExprIterator const_arg_iterator;
+
+ const_arg_iterator arg_begin() const {
+ return reinterpret_cast<Stmt const * const*>(&SubExpr);
+ }
+ const_arg_iterator arg_end() const {
+ return reinterpret_cast<Stmt const * const*>(&SubExpr + 1);
+ }
friend class ASTStmtReader;
};
Modified: cfe/trunk/lib/CodeGen/CGObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjC.cpp?rev=224525&r1=224524&r2=224525&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjC.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjC.cpp Thu Dec 18 11:13:56 2014
@@ -60,7 +60,6 @@ llvm::Value *CodeGenFunction::EmitObjCSt
llvm::Value *
CodeGenFunction::EmitObjCBoxedExpr(const ObjCBoxedExpr *E) {
// Generate the correct selector for this literal's concrete type.
- const Expr *SubExpr = E->getSubExpr();
// Get the method.
const ObjCMethodDecl *BoxingMethod = E->getBoxingMethod();
assert(BoxingMethod && "BoxingMethod is null");
@@ -73,12 +72,9 @@ CodeGenFunction::EmitObjCBoxedExpr(const
CGObjCRuntime &Runtime = CGM.getObjCRuntime();
const ObjCInterfaceDecl *ClassDecl = BoxingMethod->getClassInterface();
llvm::Value *Receiver = Runtime.GetClass(*this, ClassDecl);
-
- const ParmVarDecl *argDecl = *BoxingMethod->param_begin();
- QualType ArgQT = argDecl->getType().getUnqualifiedType();
- RValue RV = EmitAnyExpr(SubExpr);
+
CallArgList Args;
- Args.add(RV, ArgQT);
+ EmitCallArgs(Args, BoxingMethod, E->arg_begin(), E->arg_end());
RValue result = Runtime.GenerateMessageSend(
*this, ReturnValueSlot(), BoxingMethod->getReturnType(), Sel, Receiver,
More information about the cfe-commits
mailing list