Use pointer swizziling to unify in ObjCMessageExpr the receiver and classname "fields". This saves us a pointer.
Implemented serialization for ObjCMessageExpr.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50528 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp
index 67e39b6..479b651 100644
--- a/lib/AST/Expr.cpp
+++ b/lib/AST/Expr.cpp
@@ -1091,7 +1091,7 @@
SourceLocation LBrac, SourceLocation RBrac,
Expr **ArgExprs, unsigned nargs)
: Expr(ObjCMessageExprClass, retType), SelName(selInfo),
- MethodProto(mproto), ClassName(0) {
+ MethodProto(mproto) {
NumArgs = nargs;
SubExprs = new Expr*[NumArgs+1];
SubExprs[RECEIVER] = receiver;
@@ -1110,10 +1110,10 @@
SourceLocation LBrac, SourceLocation RBrac,
Expr **ArgExprs, unsigned nargs)
: Expr(ObjCMessageExprClass, retType), SelName(selInfo),
- MethodProto(mproto), ClassName(clsName) {
+ MethodProto(mproto) {
NumArgs = nargs;
SubExprs = new Expr*[NumArgs+1];
- SubExprs[RECEIVER] = 0;
+ SubExprs[RECEIVER] = (Expr*) ((uintptr_t) clsName | 0x1);
if (NumArgs) {
for (unsigned i = 0; i != NumArgs; ++i)
SubExprs[i+ARGS_START] = static_cast<Expr *>(ArgExprs[i]);
@@ -1122,7 +1122,6 @@
RBracloc = RBrac;
}
-
bool ChooseExpr::isConditionTrue(ASTContext &C) const {
llvm::APSInt CondVal(32);
bool IsConst = getCond()->isIntegerConstantExpr(CondVal, C);
@@ -1397,8 +1396,8 @@
}
// ObjCMessageExpr
-Stmt::child_iterator ObjCMessageExpr::child_begin() {
- return reinterpret_cast<Stmt**>(&SubExprs[0]);
+Stmt::child_iterator ObjCMessageExpr::child_begin() {
+ return reinterpret_cast<Stmt**>(&SubExprs[ getReceiver() ? 0 : ARGS_START ]);
}
Stmt::child_iterator ObjCMessageExpr::child_end() {
return reinterpret_cast<Stmt**>(&SubExprs[getNumArgs()+ARGS_START]);