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:
John McCall
2012-03-10 09:33:50 +00:00
parent 97f6f03c42
commit 113bee0536
49 changed files with 280 additions and 565 deletions

View File

@@ -3872,16 +3872,11 @@ static InvalidICRKind isInvalidICRSource(ASTContext &C, Expr *e,
}
// If we have a declaration reference, it had better be a local variable.
} else if (isa<DeclRefExpr>(e) || isa<BlockDeclRefExpr>(e)) {
} else if (isa<DeclRefExpr>(e)) {
if (!isAddressOf) return IIK_nonlocal;
VarDecl *var;
if (isa<DeclRefExpr>(e)) {
var = dyn_cast<VarDecl>(cast<DeclRefExpr>(e)->getDecl());
if (!var) return IIK_nonlocal;
} else {
var = cast<BlockDeclRefExpr>(e)->getDecl();
}
VarDecl *var = dyn_cast<VarDecl>(cast<DeclRefExpr>(e)->getDecl());
if (!var) return IIK_nonlocal;
return (var->hasLocalStorage() ? IIK_okay : IIK_nonlocal);