Remove BlockDeclRefExpr and introduce a bit on DeclRefExpr to
track whether the referenced declaration comes from an enclosing local context. I'm amenable to suggestions about the exact meaning of this bit. llvm-svn: 152491
This commit is contained in:
@@ -48,8 +48,8 @@ class RootBlockObjCVarRewriter :
|
||||
BlockVarChecker(VarDecl *var) : Var(var) { }
|
||||
|
||||
bool TraverseImplicitCastExpr(ImplicitCastExpr *castE) {
|
||||
if (BlockDeclRefExpr *
|
||||
ref = dyn_cast<BlockDeclRefExpr>(castE->getSubExpr())) {
|
||||
if (DeclRefExpr *
|
||||
ref = dyn_cast<DeclRefExpr>(castE->getSubExpr())) {
|
||||
if (ref->getDecl() == Var) {
|
||||
if (castE->getCastKind() == CK_LValueToRValue)
|
||||
return true; // Using the value of the variable.
|
||||
@@ -62,7 +62,7 @@ class RootBlockObjCVarRewriter :
|
||||
return base::TraverseImplicitCastExpr(castE);
|
||||
}
|
||||
|
||||
bool VisitBlockDeclRefExpr(BlockDeclRefExpr *E) {
|
||||
bool VisitDeclRefExpr(DeclRefExpr *E) {
|
||||
if (E->getDecl() == Var)
|
||||
return false; // The reference of the variable, and not just its value,
|
||||
// is needed.
|
||||
|
||||
Reference in New Issue
Block a user