In ExprEvaluatorBase::VisitOpaqueValueExpr() add a sanity check to avoid

infinite recursion due to bad OpaqueValueExpr.

llvm-svn: 146237
This commit is contained in:
Argyrios Kyrtzidis 2011-12-09 02:44:48 +00:00
parent 10c7c9090e
commit fac35c0a9b

View File

@ -1557,9 +1557,16 @@ public:
RetTy VisitOpaqueValueExpr(const OpaqueValueExpr *E) { RetTy VisitOpaqueValueExpr(const OpaqueValueExpr *E) {
const CCValue *Value = Info.getOpaqueValue(E); const CCValue *Value = Info.getOpaqueValue(E);
if (!Value) if (!Value) {
return (E->getSourceExpr() ? StmtVisitorTy::Visit(E->getSourceExpr()) const Expr *Source = E->getSourceExpr();
: DerivedError(E)); if (!Source)
return DerivedError(E);
if (Source == E) { // sanity checking.
assert(0 && "OpaqueValueExpr recursively refers to itself");
return DerivedError(E);
}
return StmtVisitorTy::Visit(Source);
}
return DerivedSuccess(*Value, E); return DerivedSuccess(*Value, E);
} }