summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ExprClassification.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2012-03-10 09:33:50 +0000
committerJohn McCall <rjmccall@apple.com>2012-03-10 09:33:50 +0000
commit113bee05361d648adb51edd0e2ec281432d2009f (patch)
treed5af8b7b0a95c04343a9f2e8f7fe40e8c769b656 /clang/lib/AST/ExprClassification.cpp
parent97f6f03c42f32a5edf59a27b56940f68c89d146b (diff)
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
Diffstat (limited to 'clang/lib/AST/ExprClassification.cpp')
-rw-r--r--clang/lib/AST/ExprClassification.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/clang/lib/AST/ExprClassification.cpp b/clang/lib/AST/ExprClassification.cpp
index 00160a007379..7c402c98e41a 100644
--- a/clang/lib/AST/ExprClassification.cpp
+++ b/clang/lib/AST/ExprClassification.cpp
@@ -189,9 +189,6 @@ static Cl::Kinds ClassifyInternal(ASTContext &Ctx, const Expr *E) {
return isa<FunctionDecl>(cast<DeclRefExpr>(E)->getDecl())
? Cl::CL_PRValue : Cl::CL_LValue;
return ClassifyDecl(Ctx, cast<DeclRefExpr>(E)->getDecl());
- // We deal with names referenced from blocks the same way.
- case Expr::BlockDeclRefExprClass:
- return ClassifyDecl(Ctx, cast<BlockDeclRefExpr>(E)->getDecl());
// Member access is complex.
case Expr::MemberExprClass:
@@ -565,8 +562,11 @@ static Cl::ModifiableType IsModifiable(ASTContext &Ctx, const Expr *E,
// it is not marked __block, e.g.
// void takeclosure(void (^C)(void));
// void func() { int x = 1; takeclosure(^{ x = 7; }); }
- if (const BlockDeclRefExpr *BDR = dyn_cast<BlockDeclRefExpr>(E)) {
- if (!BDR->isByRef() && isa<VarDecl>(BDR->getDecl()))
+ if (const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(E)) {
+ if (DRE->refersToEnclosingLocal() &&
+ isa<VarDecl>(DRE->getDecl()) &&
+ cast<VarDecl>(DRE->getDecl())->hasLocalStorage() &&
+ !DRE->getDecl()->hasAttr<BlocksAttr>())
return Cl::CM_NotBlockQualified;
}