aboutsummaryrefslogtreecommitdiff
path: root/lib/StaticAnalyzer/Checkers/SimpleStreamChecker.cpp
diff options
context:
space:
mode:
authorAnna Zaks <ganna@apple.com>2012-10-30 04:17:40 +0000
committerAnna Zaks <ganna@apple.com>2012-10-30 04:17:40 +0000
commit360b29c52a4c10f9d4c031d84d962ed2a4d58263 (patch)
treebc3dde4ef8284e3f1bc12e11d56b3e112e17291e /lib/StaticAnalyzer/Checkers/SimpleStreamChecker.cpp
parentac150f2619efcadbf23acd6e86695b5412723eb1 (diff)
[analyzer] Fix a bug in REGISTER_MAP_WITH_PROGRAMSTATE
The ImmutableMap should not be the key into the GDM map as there could be several entries with the same map type. Thanks, Jordan. This complicates the usage of the macro a bit. When we want to retrieve the whole map, we need to use another name. Currently, I set it to be Name ## Ty as in "type of the map we are storing in the ProgramState". git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167000 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Checkers/SimpleStreamChecker.cpp')
-rw-r--r--lib/StaticAnalyzer/Checkers/SimpleStreamChecker.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/StaticAnalyzer/Checkers/SimpleStreamChecker.cpp b/lib/StaticAnalyzer/Checkers/SimpleStreamChecker.cpp
index 50b9fe02d1..5721b1041e 100644
--- a/lib/StaticAnalyzer/Checkers/SimpleStreamChecker.cpp
+++ b/lib/StaticAnalyzer/Checkers/SimpleStreamChecker.cpp
@@ -106,9 +106,7 @@ void SimpleStreamChecker::checkPreStmt(const CallExpr *Call,
CheckerContext &C) const {
initIdentifierInfo(C.getASTContext());
- if (C.getCalleeIdentifier(Call) != IIfclose)
- return;
- if (Call->getNumArgs() != 1)
+ if (C.getCalleeIdentifier(Call) != IIfclose || Call->getNumArgs() != 1)
return;
// Get the symbolic value corresponding to the file handle.
@@ -130,9 +128,9 @@ void SimpleStreamChecker::checkPreStmt(const CallExpr *Call,
void SimpleStreamChecker::checkDeadSymbols(SymbolReaper &SymReaper,
CheckerContext &C) const {
ProgramStateRef State = C.getState();
- StreamMap TrackedStreams = State->get<StreamMap>();
+ StreamMapTy TrackedStreams = State->get<StreamMap>();
SymbolVector LeakedStreams;
- for (StreamMap::iterator I = TrackedStreams.begin(),
+ for (StreamMapTy::iterator I = TrackedStreams.begin(),
E = TrackedStreams.end(); I != E; ++I) {
SymbolRef Sym = I->first;
if (SymReaper.isDead(Sym)) {
@@ -154,9 +152,9 @@ void SimpleStreamChecker::checkDeadSymbols(SymbolReaper &SymReaper,
ProgramStateRef SimpleStreamChecker::evalAssume(ProgramStateRef State,
SVal Cond,
bool Assumption) const {
- StreamMap TrackedStreams = State->get<StreamMap>();
+ StreamMapTy TrackedStreams = State->get<StreamMap>();
SymbolVector LeakedStreams;
- for (StreamMap::iterator I = TrackedStreams.begin(),
+ for (StreamMapTy::iterator I = TrackedStreams.begin(),
E = TrackedStreams.end(); I != E; ++I) {
SymbolRef Sym = I->first;
if (State->getConstraintManager().isNull(State, Sym).isTrue())