diff options
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/AST/Expr.cpp | 2 | ||||
| -rw-r--r-- | clang/lib/AST/ExprConstant.cpp | 10 | 
2 files changed, 12 insertions, 0 deletions
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp index 9e8958c0733..083bf3b8087 100644 --- a/clang/lib/AST/Expr.cpp +++ b/clang/lib/AST/Expr.cpp @@ -854,6 +854,8 @@ bool Expr::hasGlobalStorage() const {    switch (getStmtClass()) {    default:      return false; +  case BlockExprClass: +    return true;    case ParenExprClass:      return cast<ParenExpr>(this)->getSubExpr()->hasGlobalStorage();    case ImplicitCastExprClass: diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp index 327fff0c0b1..8fd75f1808e 100644 --- a/clang/lib/AST/ExprConstant.cpp +++ b/clang/lib/AST/ExprConstant.cpp @@ -156,6 +156,7 @@ public:    APValue VisitParenExpr(ParenExpr *E) { return Visit(E->getSubExpr()); }    APValue VisitDeclRefExpr(DeclRefExpr *E); +  APValue VisitBlockExpr(BlockExpr *E);    APValue VisitPredefinedExpr(PredefinedExpr *E) { return APValue(E, 0); }    APValue VisitCompoundLiteralExpr(CompoundLiteralExpr *E);    APValue VisitMemberExpr(MemberExpr *E); @@ -184,6 +185,14 @@ APValue LValueExprEvaluator::VisitDeclRefExpr(DeclRefExpr *E)    return APValue(E, 0);   } +APValue LValueExprEvaluator::VisitBlockExpr(BlockExpr *E) +{  +  if (E->hasBlockDeclRefExprs()) +    return APValue(); +     +  return APValue(E, 0); +} +  APValue LValueExprEvaluator::VisitCompoundLiteralExpr(CompoundLiteralExpr *E) {    if (E->isFileScope())      return APValue(E, 0); @@ -373,6 +382,7 @@ APValue PointerExprEvaluator::VisitCastExpr(const CastExpr* E) {    }    if (SubExpr->getType()->isFunctionType() || +      SubExpr->getType()->isBlockPointerType() ||        SubExpr->getType()->isArrayType()) {      APValue Result;      if (EvaluateLValue(SubExpr, Result, Info))  | 

