Minor tweak in GetValue to avoid an extra check for ParenExprs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46294 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Analysis/GRConstants.cpp b/Analysis/GRConstants.cpp
index 62b007a..e1e664e 100644
--- a/Analysis/GRConstants.cpp
+++ b/Analysis/GRConstants.cpp
@@ -555,19 +555,24 @@
}
ExprValue GRConstants::GetValue(const StateTy& St, Stmt* S) {
- if (Expr* E = dyn_cast<Expr>(S))
- S = E->IgnoreParens();
-
- switch (S->getStmtClass()) {
- case Stmt::DeclRefExprClass:
- return GetValue(St, LValueDecl(cast<DeclRefExpr>(S)->getDecl()));
+ for (;;) {
+ switch (S->getStmtClass()) {
+ case Stmt::ParenExprClass:
+ S = cast<ParenExpr>(S)->getSubExpr();
+ continue;
+
+ case Stmt::DeclRefExprClass:
+ return GetValue(St, LValueDecl(cast<DeclRefExpr>(S)->getDecl()));
- case Stmt::IntegerLiteralClass:
- return RValue::GetRValue(ValMgr, cast<IntegerLiteral>(S));
+ case Stmt::IntegerLiteralClass:
+ return RValue::GetRValue(ValMgr, cast<IntegerLiteral>(S));
- default:
- break;
- };
+ default:
+ break;
+ };
+
+ break;
+ }
StateTy::TreeTy* T = St.SlimFind(ValueKey(S, getCFG().isBlkExpr(S)));
return T ? T->getValue().second : InvalidValue();