summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/Analysis/GRConstants.cpp27
1 files changed, 16 insertions, 11 deletions
diff --git a/clang/Analysis/GRConstants.cpp b/clang/Analysis/GRConstants.cpp
index 62b007ab30b..e1e664edb12 100644
--- a/clang/Analysis/GRConstants.cpp
+++ b/clang/Analysis/GRConstants.cpp
@@ -555,19 +555,24 @@ ExprValue GRConstants::GetValue(const StateTy& St, const LValue& LV) {
}
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();
OpenPOWER on IntegriCloud