aboutsummaryrefslogtreecommitdiff
path: root/lib/Rewrite/RewriteObjC.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2010-10-11 22:21:03 +0000
committerFariborz Jahanian <fjahanian@apple.com>2010-10-11 22:21:03 +0000
commit8537f7b49402bddeac95893eb711a3912aef3552 (patch)
tree9f3a1632e51484aeee359e09a9ec68e199afb6e8 /lib/Rewrite/RewriteObjC.cpp
parenta9f4f620daf073805b89e893afcdc5eb7a9bdc50 (diff)
Some refactoring of property rewriting stuff
in rewriter. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116254 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Rewrite/RewriteObjC.cpp')
-rw-r--r--lib/Rewrite/RewriteObjC.cpp28
1 files changed, 11 insertions, 17 deletions
diff --git a/lib/Rewrite/RewriteObjC.cpp b/lib/Rewrite/RewriteObjC.cpp
index 745b7888d5..339b7d1640 100644
--- a/lib/Rewrite/RewriteObjC.cpp
+++ b/lib/Rewrite/RewriteObjC.cpp
@@ -5356,12 +5356,9 @@ void RewriteObjC::CollectPropertySetters(Stmt *S) {
if (BinaryOperator *BinOp = dyn_cast<BinaryOperator>(S)) {
if (BinOp->isAssignmentOp()) {
- if (ObjCPropertyRefExpr *PRE =
- dyn_cast<ObjCPropertyRefExpr>(BinOp->getLHS()))
- PropSetters[PRE] = BinOp;
- else if (ObjCImplicitSetterGetterRefExpr *ISE =
- dyn_cast<ObjCImplicitSetterGetterRefExpr>(BinOp->getLHS()))
- PropSetters[ISE] = BinOp;
+ if (isa<ObjCPropertyRefExpr>(BinOp->getLHS()) ||
+ isa<ObjCImplicitSetterGetterRefExpr>(BinOp->getLHS()))
+ PropSetters[BinOp->getLHS()] = BinOp;
}
}
}
@@ -5402,18 +5399,15 @@ Stmt *RewriteObjC::RewriteFunctionBodyOrGlobalInitializer(Stmt *S) {
// expression, the entire assignment tree is rewritten into a property
// setter messaging. This involvs the RHS too. Do not attempt to rewrite
// RHS again.
- if (ObjCPropertyRefExpr *PRE = dyn_cast<ObjCPropertyRefExpr>(S))
- if (PropSetters[PRE]) {
- ++CI;
- continue;
- }
- if (ObjCImplicitSetterGetterRefExpr *ISE =
- dyn_cast<ObjCImplicitSetterGetterRefExpr>(S))
- if (PropSetters[ISE]) {
- ++CI;
- continue;
+ if (Expr *Exp = dyn_cast<Expr>(S))
+ if (isa<ObjCPropertyRefExpr>(Exp) ||
+ isa<ObjCImplicitSetterGetterRefExpr>(Exp)) {
+ if (PropSetters[Exp]) {
+ ++CI;
+ continue;
+ }
}
- }
+ }
if (BlockExpr *BE = dyn_cast<BlockExpr>(S)) {
llvm::SmallVector<BlockDeclRefExpr *, 8> InnerBlockDeclRefs;