]> granicus.if.org Git - clang/commitdiff
Minor tweak in GetValue to avoid an extra check for ParenExprs.
authorTed Kremenek <kremenek@apple.com>
Thu, 24 Jan 2008 00:50:08 +0000 (00:50 +0000)
committerTed Kremenek <kremenek@apple.com>
Thu, 24 Jan 2008 00:50:08 +0000 (00:50 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46294 91177308-0d34-0410-b5e6-96231b3b80d8

Analysis/GRConstants.cpp

index 62b007ab30b3e6f4f0770262a6e75efaeaac7248..e1e664edb12496c0e4c55b225ec3aebc2af11a40 100644 (file)
@@ -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();