[PATCH] D75163: [analyzer][StreamChecker] Adding precall and refactoring.
Balázs Kéri via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 27 08:21:51 PST 2020
balazske marked 10 inline comments as done.
balazske added a comment.
Error messages are now in similar form as the null stream pointer case.
================
Comment at: clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp:76-92
+ {{"fopen"}, {{}, &StreamChecker::evalFopen, ArgNone}},
+ {{"freopen", 3},
+ {&StreamChecker::preFreopen, &StreamChecker::evalFreopen, 2}},
+ {{"tmpfile"}, {{}, &StreamChecker::evalFopen, ArgNone}},
+ {{"fclose", 1},
+ {&StreamChecker::preDefault, &StreamChecker::evalFclose, 0}},
+ {{"fread", 4}, {&StreamChecker::preDefault, {}, 3}},
----------------
Szelethus wrote:
> Hmm, all of these braces are kinda hard to navigate, but its not too bad. Could you check whether changing them to `nullptr` improves readability? I'll leave it to your judgement.
`nullptr` looks better. (Missing value at "fseek" will be updated.)
================
Comment at: clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp:349-355
+ SymbolRef Sym = StreamVal.getAsSymbol();
if (!Sym)
- return State;
+ return nullptr;
const StreamState *SS = State->get<StreamMap>(Sym);
-
- // If the file stream is not tracked, return.
if (!SS)
+ return nullptr;
----------------
Szelethus wrote:
> Previously, we only returned a `nullptr` after generating a fatal error node. Why do we need to change this?
This is fixed.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D75163/new/
https://reviews.llvm.org/D75163
More information about the cfe-commits
mailing list