[cfe-commits] r112931 - /cfe/trunk/lib/Checker/StreamChecker.cpp
Ted Kremenek
kremenek at apple.com
Thu Sep 2 18:07:04 PDT 2010
Author: kremenek
Date: Thu Sep 2 20:07:04 2010
New Revision: 112931
URL: http://llvm.org/viewvc/llvm-project?rev=112931&view=rev
Log:
Remove bogus assertions.
Modified:
cfe/trunk/lib/Checker/StreamChecker.cpp
Modified: cfe/trunk/lib/Checker/StreamChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/StreamChecker.cpp?rev=112931&r1=112930&r2=112931&view=diff
==============================================================================
--- cfe/trunk/lib/Checker/StreamChecker.cpp (original)
+++ cfe/trunk/lib/Checker/StreamChecker.cpp Thu Sep 2 20:07:04 2010
@@ -235,15 +235,16 @@
const GRState *stateNotNull, *stateNull;
llvm::tie(stateNotNull, stateNull) = CM.AssumeDual(state, RetVal);
- SymbolRef Sym = RetVal.getAsSymbol();
- assert(Sym);
+ if (SymbolRef Sym = RetVal.getAsSymbol()) {
+ // if RetVal is not NULL, set the symbol's state to Opened.
+ stateNotNull =
+ stateNotNull->set<StreamState>(Sym,StreamState::getOpened(CE));
+ stateNull =
+ stateNull->set<StreamState>(Sym, StreamState::getOpenFailed(CE));
- // if RetVal is not NULL, set the symbol's state to Opened.
- stateNotNull = stateNotNull->set<StreamState>(Sym,StreamState::getOpened(CE));
- stateNull = stateNull->set<StreamState>(Sym, StreamState::getOpenFailed(CE));
-
- C.addTransition(stateNotNull);
- C.addTransition(stateNull);
+ C.addTransition(stateNotNull);
+ C.addTransition(stateNull);
+ }
}
void StreamChecker::Fclose(CheckerContext &C, const CallExpr *CE) {
@@ -370,7 +371,8 @@
const GRState *state,
CheckerContext &C) {
SymbolRef Sym = state->getSVal(CE->getArg(0)).getAsSymbol();
- assert(Sym);
+ if (!Sym)
+ return state;
const StreamState *SS = state->get<StreamState>(Sym);
More information about the cfe-commits
mailing list