aboutsummaryrefslogtreecommitdiff
path: root/lib/StaticAnalyzer/Core/ExprEngineC.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2012-02-17 23:13:45 +0000
committerTed Kremenek <kremenek@apple.com>2012-02-17 23:13:45 +0000
commit3133f79cf451e6302dd05262b4bb53a3e4fd6300 (patch)
tree613e236257e18add8ade22ee2805c154bd1b15aa /lib/StaticAnalyzer/Core/ExprEngineC.cpp
parentd8a8a3b6ad7c786dfcf341b080bd19b5d4b84b5b (diff)
Have conjured symbols depend on LocationContext, to add context sensitivity for functions called more than once.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150849 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Core/ExprEngineC.cpp')
-rw-r--r--lib/StaticAnalyzer/Core/ExprEngineC.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/lib/StaticAnalyzer/Core/ExprEngineC.cpp b/lib/StaticAnalyzer/Core/ExprEngineC.cpp
index c1f804ce09..3e1b6b0aec 100644
--- a/lib/StaticAnalyzer/Core/ExprEngineC.cpp
+++ b/lib/StaticAnalyzer/Core/ExprEngineC.cpp
@@ -46,7 +46,7 @@ void ExprEngine::VisitBinaryOperator(const BinaryOperator* B,
// FIXME: Handle structs.
if (RightV.isUnknown()) {
unsigned Count = currentBuilderContext->getCurrentBlockCount();
- RightV = svalBuilder.getConjuredSymbolVal(NULL, B->getRHS(), Count);
+ RightV = svalBuilder.getConjuredSymbolVal(NULL, B->getRHS(), LCtx, Count);
}
// Simulate the effects of a "store": bind the value of the RHS
// to the L-Value represented by the LHS.
@@ -131,8 +131,8 @@ void ExprEngine::VisitBinaryOperator(const BinaryOperator* B,
// The symbolic value is actually for the type of the left-hand side
// expression, not the computation type, as this is the value the
// LValue on the LHS will bind to.
- LHSVal = svalBuilder.getConjuredSymbolVal(NULL, B->getRHS(), LTy,
- Count);
+ LHSVal = svalBuilder.getConjuredSymbolVal(NULL, B->getRHS(), LCtx,
+ LTy, Count);
// However, we need to convert the symbol to the computation type.
Result = svalBuilder.evalCast(LHSVal, CTy, LTy);
@@ -298,12 +298,10 @@ void ExprEngine::VisitCast(const CastExpr *CastE, const Expr *Ex,
QualType resultType = CastE->getType();
if (CastE->isLValue())
resultType = getContext().getPointerType(resultType);
-
+ const LocationContext *LCtx = Pred->getLocationContext();
SVal result =
- svalBuilder.getConjuredSymbolVal(NULL, CastE, resultType,
+ svalBuilder.getConjuredSymbolVal(NULL, CastE, LCtx, resultType,
currentBuilderContext->getCurrentBlockCount());
-
- const LocationContext *LCtx = Pred->getLocationContext();
ProgramStateRef state = Pred->getState()->BindExpr(CastE, LCtx,
result);
Bldr.generateNode(CastE, Pred, state);
@@ -376,7 +374,7 @@ void ExprEngine::VisitDeclStmt(const DeclStmt *DS, ExplodedNode *Pred,
// Recover some path-sensitivity if a scalar value evaluated to
// UnknownVal.
if (InitVal.isUnknown()) {
- InitVal = svalBuilder.getConjuredSymbolVal(NULL, InitEx,
+ InitVal = svalBuilder.getConjuredSymbolVal(NULL, InitEx, LC,
currentBuilderContext->getCurrentBlockCount());
}
B.takeNodes(N);
@@ -724,7 +722,7 @@ void ExprEngine::VisitIncrementDecrementOperator(const UnaryOperator* U,
// Conjure a new symbol if necessary to recover precision.
if (Result.isUnknown()){
DefinedOrUnknownSVal SymVal =
- svalBuilder.getConjuredSymbolVal(NULL, Ex,
+ svalBuilder.getConjuredSymbolVal(NULL, Ex, LCtx,
currentBuilderContext->getCurrentBlockCount());
Result = SymVal;