aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/Expr.cpp
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2009-12-03 20:31:57 +0000
committerEli Friedman <eli.friedman@gmail.com>2009-12-03 20:31:57 +0000
commitc013118155077cf8bdaef743c5dbce760114eed3 (patch)
tree6435f10f7e25d062b7feb12061bc9afee04c2ef5 /lib/AST/Expr.cpp
parentf7227709522ad70773467ffb2d620db0d43318d9 (diff)
Add recursion guards to ice-checking and evaluation for declrefs, so we
don't infinitely recurse for cases we can't evaluate. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90480 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/Expr.cpp')
-rw-r--r--lib/AST/Expr.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp
index 28f1bd92f3..2aca060444 100644
--- a/lib/AST/Expr.cpp
+++ b/lib/AST/Expr.cpp
@@ -1596,13 +1596,18 @@ static ICEDiag CheckICE(const Expr* E, ASTContext &Ctx) {
// constant expression (5.19). In that case, the member can appear
// in integral constant expressions.
if (Def->isOutOfLine()) {
- Dcl->setInitKnownICE(Ctx, false);
+ Dcl->setInitKnownICE(false);
return ICEDiag(2, cast<DeclRefExpr>(E)->getLocation());
}
-
+
+ if (Dcl->isCheckingICE()) {
+ return ICEDiag(2, cast<DeclRefExpr>(E)->getLocation());
+ }
+
+ Dcl->setCheckingICE();
ICEDiag Result = CheckICE(Init, Ctx);
// Cache the result of the ICE test.
- Dcl->setInitKnownICE(Ctx, Result.Val == 0);
+ Dcl->setInitKnownICE(Result.Val == 0);
return Result;
}
}