balazske marked 3 inline comments as done. balazske added a comment. In D135247#3993351 <https://reviews.llvm.org/D135247#3993351>, @NoQ wrote:
> Also, similarly to `getenv()`, in these cases domain-specific knowledge may > help suppress some unwanted reports. Eg., if a file has been opened > successfully, this doesn't technically mean that it'll be open successfully > again, but it makes it more likely, and the user does not necessarily care > about time-of-check-time-of-use races. So maybe it'd make sense to eventually > move some of that stuff to StreamChecker anyway. Maybe not, hard to tell, > need to see the results. This knowledge of "call history" can be implemented in an other checker, for the stream functions in `StreamChecker`, for `getenv` in a probably new checker (where the variable name could be stored). This `StdLibraryFunctionChecker` does not create the branch if the conditions (constraints) of a branch (summary case) are not satisfied. If another checker added branches in `evalCall` (for a success and failure case or only one of them) these are "selected" here only, not added. ================ Comment at: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:1060-1064 + } else if (NewState == State) { + if (const auto *D = dyn_cast_or_null<FunctionDecl>(Call.getDecl())) + if (const NoteTag *NT = + Case.getErrnoConstraint().describe(C, D->getNameAsString())) + C.addTransition(NewState, NT); ---------------- martong wrote: > balazske wrote: > > martong wrote: > > > Why do we need this change? > > It is possible that only the errno related state is changed, no new > > constraints are added (if the constraint is already here from `evalCall` > > but the errno was not set there, for example at `fclose` or other stream > > functions maybe no new state is created here). In such case the note tag is > > still needed. > Okay, please add that as a comment to this new hunk. The add of NoteTags could be improved. Probably a NoteTag should be displayed here if the return value (the "function call itself") is interesting. A text message should be specified for every function and the errno-related part added to it programatically if needed (if errno is interesting). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D135247/new/ https://reviews.llvm.org/D135247 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits