[PATCH] D124681: [Analyzer] Minor cleanups in StreamChecker
Marco Antognini via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon May 2 08:50:33 PDT 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf34639828f5a: [Analyzer] Minor cleanups in StreamChecker (authored by mantognini).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D124681/new/
https://reviews.llvm.org/D124681
Files:
clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
Index: clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
+++ clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
@@ -672,24 +672,19 @@
if (!IsFread || (OldSS->ErrorState != ErrorFEof)) {
ProgramStateRef StateNotFailed =
State->BindExpr(CE, C.getLocationContext(), *NMembVal);
- if (StateNotFailed) {
- StateNotFailed = StateNotFailed->set<StreamMap>(
- StreamSym, StreamState::getOpened(Desc));
- C.addTransition(StateNotFailed);
- }
+ StateNotFailed =
+ StateNotFailed->set<StreamMap>(StreamSym, StreamState::getOpened(Desc));
+ C.addTransition(StateNotFailed);
}
// Add transition for the failed state.
- Optional<NonLoc> RetVal = makeRetVal(C, CE).castAs<NonLoc>();
- assert(RetVal && "Value should be NonLoc.");
+ NonLoc RetVal = makeRetVal(C, CE).castAs<NonLoc>();
ProgramStateRef StateFailed =
- State->BindExpr(CE, C.getLocationContext(), *RetVal);
- if (!StateFailed)
- return;
- auto Cond = C.getSValBuilder()
- .evalBinOpNN(State, BO_LT, *RetVal, *NMembVal,
- C.getASTContext().IntTy)
- .getAs<DefinedOrUnknownSVal>();
+ State->BindExpr(CE, C.getLocationContext(), RetVal);
+ auto Cond =
+ C.getSValBuilder()
+ .evalBinOpNN(State, BO_LT, RetVal, *NMembVal, C.getASTContext().IntTy)
+ .getAs<DefinedOrUnknownSVal>();
if (!Cond)
return;
StateFailed = StateFailed->assume(*Cond, true);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124681.426427.patch
Type: text/x-patch
Size: 1602 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220502/59543ca0/attachment-0001.bin>
More information about the cfe-commits
mailing list