[cfe-commits] r116928 - /cfe/trunk/lib/Rewrite/RewriteObjC.cpp
Fariborz Jahanian
fjahanian at apple.com
Wed Oct 20 09:07:20 PDT 2010
Author: fjahanian
Date: Wed Oct 20 11:07:20 2010
New Revision: 116928
URL: http://llvm.org/viewvc/llvm-project?rev=116928&view=rev
Log:
Fixes a potential crash in rewriter when sending message
to 'super'.
Modified:
cfe/trunk/lib/Rewrite/RewriteObjC.cpp
Modified: cfe/trunk/lib/Rewrite/RewriteObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Rewrite/RewriteObjC.cpp?rev=116928&r1=116927&r2=116928&view=diff
==============================================================================
--- cfe/trunk/lib/Rewrite/RewriteObjC.cpp (original)
+++ cfe/trunk/lib/Rewrite/RewriteObjC.cpp Wed Oct 20 11:07:20 2010
@@ -1250,11 +1250,6 @@
llvm::SmallVector<Expr *, 1> ExprVec;
ExprVec.push_back(newStmt);
- if (Expr *Exp = dyn_cast<Expr>(Receiver))
- if (PropGetters[Exp])
- // This allows us to handle chain/nested property/implicit getters.
- Receiver = PropGetters[Exp];
-
ObjCMessageExpr *MsgExpr;
if (Super)
MsgExpr = ObjCMessageExpr::Create(*Context,
@@ -1266,7 +1261,15 @@
Sel, OMD,
&ExprVec[0], 1,
/*FIXME:*/SourceLocation());
- else
+ else {
+ // FIXME. Refactor this into common code with that in
+ // RewritePropertyOrImplicitGetter
+ assert(Receiver && "RewritePropertyOrImplicitSetter - null Receiver");
+ if (Expr *Exp = dyn_cast<Expr>(Receiver))
+ if (PropGetters[Exp])
+ // This allows us to handle chain/nested property/implicit getters.
+ Receiver = PropGetters[Exp];
+
MsgExpr = ObjCMessageExpr::Create(*Context,
Ty.getNonReferenceType(),
/*FIXME: */SourceLocation(),
@@ -1274,6 +1277,7 @@
Sel, OMD,
&ExprVec[0], 1,
/*FIXME:*/SourceLocation());
+ }
Stmt *ReplacingStmt = SynthMessageExpr(MsgExpr);
// Now do the actual rewrite.
@@ -1325,11 +1329,6 @@
assert (OMD && "RewritePropertyOrImplicitGetter - OMD is null");
- if (Expr *Exp = dyn_cast<Expr>(Receiver))
- if (PropGetters[Exp])
- // This allows us to handle chain/nested property/implicit getters.
- Receiver = PropGetters[Exp];
-
ObjCMessageExpr *MsgExpr;
if (Super)
MsgExpr = ObjCMessageExpr::Create(*Context,
@@ -1341,7 +1340,12 @@
Sel, OMD,
0, 0,
/*FIXME:*/SourceLocation());
- else
+ else {
+ assert (Receiver && "RewritePropertyOrImplicitGetter - Receiver is null");
+ if (Expr *Exp = dyn_cast<Expr>(Receiver))
+ if (PropGetters[Exp])
+ // This allows us to handle chain/nested property/implicit getters.
+ Receiver = PropGetters[Exp];
MsgExpr = ObjCMessageExpr::Create(*Context,
Ty.getNonReferenceType(),
/*FIXME:*/SourceLocation(),
@@ -1349,6 +1353,7 @@
Sel, OMD,
0, 0,
/*FIXME:*/SourceLocation());
+ }
Stmt *ReplacingStmt = SynthMessageExpr(MsgExpr);
More information about the cfe-commits
mailing list