diff options
author | Ted Kremenek <kremenek@apple.com> | 2012-02-17 23:13:45 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2012-02-17 23:13:45 +0000 |
commit | d519cae8aa275870b1d26013396b5e4f7462946a (patch) | |
tree | 2955f62b5e6fe95522fb2927a47bb23595d42a74 /clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp | |
parent | 81e2bf2b778ef3f74152cf559bedd264461f41ff (diff) | |
download | bcm5719-llvm-d519cae8aa275870b1d26013396b5e4f7462946a.tar.gz bcm5719-llvm-d519cae8aa275870b1d26013396b5e4f7462946a.zip |
Have conjured symbols depend on LocationContext, to add context sensitivity for functions called more than once.
llvm-svn: 150849
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp')
-rw-r--r-- | clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp index c1f804ce09b..3e1b6b0aec6 100644 --- a/clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp +++ b/clang/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; |