From: Ted Kremenek Date: Thu, 24 Jan 2008 00:50:08 +0000 (+0000) Subject: Minor tweak in GetValue to avoid an extra check for ParenExprs. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=671c9e8147e35876de34706dc356988e7717f1bf;p=clang 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 62b007ab30..e1e664edb1 100644 --- a/Analysis/GRConstants.cpp +++ b/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(S)) - S = E->IgnoreParens(); - - switch (S->getStmtClass()) { - case Stmt::DeclRefExprClass: - return GetValue(St, LValueDecl(cast(S)->getDecl())); + for (;;) { + switch (S->getStmtClass()) { + case Stmt::ParenExprClass: + S = cast(S)->getSubExpr(); + continue; + + case Stmt::DeclRefExprClass: + return GetValue(St, LValueDecl(cast(S)->getDecl())); - case Stmt::IntegerLiteralClass: - return RValue::GetRValue(ValMgr, cast(S)); + case Stmt::IntegerLiteralClass: + return RValue::GetRValue(ValMgr, cast(S)); - default: - break; - }; + default: + break; + }; + + break; + } StateTy::TreeTy* T = St.SlimFind(ValueKey(S, getCFG().isBlkExpr(S))); return T ? T->getValue().second : InvalidValue();