[cfe-commits] r146237 - /cfe/trunk/lib/AST/ExprConstant.cpp
Argyrios Kyrtzidis
akyrtzi at gmail.com
Thu Dec 8 18:44:48 PST 2011
Author: akirtzidis
Date: Thu Dec 8 20:44:48 2011
New Revision: 146237
URL: http://llvm.org/viewvc/llvm-project?rev=146237&view=rev
Log:
In ExprEvaluatorBase::VisitOpaqueValueExpr() add a sanity check to avoid
infinite recursion due to bad OpaqueValueExpr.
Modified:
cfe/trunk/lib/AST/ExprConstant.cpp
Modified: cfe/trunk/lib/AST/ExprConstant.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprConstant.cpp?rev=146237&r1=146236&r2=146237&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ExprConstant.cpp (original)
+++ cfe/trunk/lib/AST/ExprConstant.cpp Thu Dec 8 20:44:48 2011
@@ -1557,9 +1557,16 @@
RetTy VisitOpaqueValueExpr(const OpaqueValueExpr *E) {
const CCValue *Value = Info.getOpaqueValue(E);
- if (!Value)
- return (E->getSourceExpr() ? StmtVisitorTy::Visit(E->getSourceExpr())
- : DerivedError(E));
+ if (!Value) {
+ const Expr *Source = E->getSourceExpr();
+ 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);
}
More information about the cfe-commits
mailing list