[cfe-commits] r52679 - in /cfe/trunk: include/clang/AST/ExprObjC.h lib/AST/StmtSerialization.cpp
Ted Kremenek
kremenek at apple.com
Tue Jun 24 10:00:08 PDT 2008
Author: kremenek
Date: Tue Jun 24 12:00:08 2008
New Revision: 52679
URL: http://llvm.org/viewvc/llvm-project?rev=52679&view=rev
Log:
Update serialization for ObjCMessageExpr to handle additional bit-swizziling of receiver information.
Modified:
cfe/trunk/include/clang/AST/ExprObjC.h
cfe/trunk/lib/AST/StmtSerialization.cpp
Modified: cfe/trunk/include/clang/AST/ExprObjC.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ExprObjC.h?rev=52679&r1=52678&r2=52679&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/ExprObjC.h (original)
+++ cfe/trunk/include/clang/AST/ExprObjC.h Tue Jun 24 12:00:08 2008
@@ -225,13 +225,11 @@
};
class ObjCMessageExpr : public Expr {
- enum { RECEIVER=0, ARGS_START=1 };
-
- // Bit-swizziling flags.
- enum { IsInstMeth=0, IsClsMethDeclUnknown, IsClsMethDeclKnown, Flags=0x3 };
-
+ // SubExprs - The receiver and arguments of the message expression.
Stmt **SubExprs;
+ // NumArgs - The number of arguments (not including the receiver) to the
+ // message expression.
unsigned NumArgs;
// A unigue name for this message.
@@ -243,13 +241,21 @@
ObjCMethodDecl *MethodProto;
SourceLocation LBracloc, RBracloc;
+
+ // Constants for indexing into SubExprs.
+ enum { RECEIVER=0, ARGS_START=1 };
+
+ // Bit-swizziling flags.
+ enum { IsInstMeth=0, IsClsMethDeclUnknown, IsClsMethDeclKnown, Flags=0x3 };
+ unsigned getFlag() const { return (uintptr_t) SubExprs[RECEIVER] & Flags; }
// constructor used during deserialization
ObjCMessageExpr(Selector selInfo, QualType retType,
SourceLocation LBrac, SourceLocation RBrac,
- Expr **ArgExprs, unsigned nargs)
- : Expr(ObjCMessageExprClass, retType), NumArgs(nargs), SelName(selInfo),
- MethodProto(NULL), LBracloc(LBrac), RBracloc(RBrac) {}
+ Stmt **subexprs, unsigned nargs)
+ : Expr(ObjCMessageExprClass, retType), SubExprs(subexprs),
+ NumArgs(nargs), SelName(selInfo), MethodProto(NULL),
+ LBracloc(LBrac), RBracloc(RBrac) {}
public:
/// This constructor is used to represent class messages where the
Modified: cfe/trunk/lib/AST/StmtSerialization.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtSerialization.cpp?rev=52679&r1=52678&r2=52679&view=diff
==============================================================================
--- cfe/trunk/lib/AST/StmtSerialization.cpp (original)
+++ cfe/trunk/lib/AST/StmtSerialization.cpp Tue Jun 24 12:00:08 2008
@@ -1017,7 +1017,7 @@
}
void ObjCMessageExpr::EmitImpl(Serializer& S) const {
- S.EmitBool(getReceiver() ? true : false);
+ S.EmitInt(getFlag());
S.Emit(getType());
S.Emit(SelName);
S.Emit(LBracloc);
@@ -1027,14 +1027,18 @@
if (getReceiver())
S.BatchEmitOwnedPtrs(NumArgs+1, SubExprs);
- else {
- S.EmitPtr(getClassName());
+ else {
+ ClassInfo Info = getClassInfo();
+
+ if (Info.first) S.EmitPtr(Info.first);
+ else S.EmitPtr(Info.second);
+
S.BatchEmitOwnedPtrs(NumArgs, &SubExprs[ARGS_START]);
}
}
ObjCMessageExpr* ObjCMessageExpr::CreateImpl(Deserializer& D, ASTContext& C) {
- bool isReceiver = D.ReadBool();
+ unsigned flags = D.ReadInt();
QualType t = QualType::ReadVal(D);
Selector S = Selector::ReadVal(D);
SourceLocation L = SourceLocation::ReadVal(D);
@@ -1042,7 +1046,7 @@
// Construct an array for the subexpressions.
unsigned NumArgs = D.ReadInt();
- Expr** SubExprs = new Expr*[NumArgs+1];
+ Stmt** SubExprs = new Stmt*[NumArgs+1];
// Construct the ObjCMessageExpr object using the special ctor.
ObjCMessageExpr* ME = new ObjCMessageExpr(S, t, L, R, SubExprs, NumArgs);
@@ -1053,12 +1057,12 @@
// Now read in the arguments.
- if (isReceiver)
+ if (flags & Flags == IsInstMeth)
D.BatchReadOwnedPtrs(NumArgs+1, SubExprs, C);
else {
- // Read the pointer for ClassName. The Deserializer will handle the
+ // Read the pointer for Cls/ClassName. The Deserializer will handle the
// bit-mangling automatically.
- SubExprs[RECEIVER] = (Expr*) ((uintptr_t) 0x1);
+ SubExprs[RECEIVER] = (Stmt*) ((uintptr_t) flags);
D.ReadUIntPtr((uintptr_t&) SubExprs[RECEIVER]);
// Read the arguments.
More information about the cfe-commits
mailing list