summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/GRExprEngine.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-12-24 00:40:03 +0000
committerTed Kremenek <kremenek@apple.com>2009-12-24 00:40:03 +0000
commit589493227bea37357a1abbd69568ac8bb64cea37 (patch)
tree7860c79ed272037f34e18fce439f1c86c609e918 /clang/lib/Analysis/GRExprEngine.cpp
parent8b5dc12e52f1d8e8a422f034760fad24b825ad00 (diff)
downloadbcm5719-llvm-589493227bea37357a1abbd69568ac8bb64cea37.tar.gz
bcm5719-llvm-589493227bea37357a1abbd69568ac8bb64cea37.zip
Teach GRExprEngine to handle the initialization of the condition variable of a SwitchStmt.
llvm-svn: 92102
Diffstat (limited to 'clang/lib/Analysis/GRExprEngine.cpp')
-rw-r--r--clang/lib/Analysis/GRExprEngine.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/clang/lib/Analysis/GRExprEngine.cpp b/clang/lib/Analysis/GRExprEngine.cpp
index ceefea81f5c..d7486f85134 100644
--- a/clang/lib/Analysis/GRExprEngine.cpp
+++ b/clang/lib/Analysis/GRExprEngine.cpp
@@ -665,7 +665,7 @@ void GRExprEngine::Visit(Stmt* S, ExplodedNode* Pred, ExplodedNodeSet& Dst) {
case Stmt::IfStmtClass:
// This case isn't for branch processing, but for handling the
// initialization of a condition variable.
- VisitIfStmtCondInit(cast<IfStmt>(S), Pred, Dst);
+ VisitCondInit(cast<IfStmt>(S)->getConditionVariable(), S, Pred, Dst);
break;
case Stmt::InitListExprClass:
@@ -733,6 +733,12 @@ void GRExprEngine::Visit(Stmt* S, ExplodedNode* Pred, ExplodedNodeSet& Dst) {
case Stmt::StringLiteralClass:
VisitLValue(cast<StringLiteral>(S), Pred, Dst);
break;
+
+ case Stmt::SwitchStmtClass:
+ // This case isn't for branch processing, but for handling the
+ // initialization of a condition variable.
+ VisitCondInit(cast<SwitchStmt>(S)->getConditionVariable(), S, Pred, Dst);
+ break;
case Stmt::UnaryOperatorClass: {
UnaryOperator *U = cast<UnaryOperator>(S);
@@ -2230,12 +2236,10 @@ void GRExprEngine::VisitDeclStmt(DeclStmt *DS, ExplodedNode *Pred,
}
}
-void GRExprEngine::VisitIfStmtCondInit(IfStmt *IS, ExplodedNode *Pred,
- ExplodedNodeSet& Dst) {
-
- VarDecl* VD = IS->getConditionVariable();
- Expr* InitEx = VD->getInit();
+void GRExprEngine::VisitCondInit(VarDecl *VD, Stmt *S,
+ ExplodedNode *Pred, ExplodedNodeSet& Dst) {
+ Expr* InitEx = VD->getInit();
ExplodedNodeSet Tmp;
Visit(InitEx, Pred, Tmp);
@@ -2255,7 +2259,7 @@ void GRExprEngine::VisitIfStmtCondInit(IfStmt *IS, ExplodedNode *Pred,
Builder->getCurrentBlockCount());
}
- EvalBind(Dst, IS, IS, N, state,
+ EvalBind(Dst, S, S, N, state,
loc::MemRegionVal(state->getRegion(VD, LC)), InitVal, true);
}
}
OpenPOWER on IntegriCloud