[PATCH] D153612: [clang][analyzer] Add and change NoteTags in StdLibraryFunctionsChecker.
Balázs Kéri via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 23 02:46:11 PDT 2023
balazske added inline comments.
================
Comment at: clang/test/Analysis/errno-stdlibraryfunctions-notes.c:17
access("path", 0);
- // expected-note at -1{{Assuming that function 'access' is successful, in this case the value 'errno' may be undefined after the call and should not be used}}
+ // expected-note at -1{{Assuming that the call fails}}
+ access("path", 0);
----------------
This is the type of note that looks not necessary and even confusing. It could be any case of failure or success, the failure is chosen. This does not matter for the end result but can be confusing for users (one may think that there is a connection to the found bug).
================
Comment at: clang/test/Analysis/std-c-library-functions-path-notes.c:72
+ return 0;
+ int l = islower(c);
+ f = fileno(f1); // \
----------------
Here no note is shown. Probably because the summary of `islower` has cases without note, these notes should be added.
================
Comment at: clang/test/Analysis/stream-errno-note.c:24
void check_tmpfile(void) {
FILE *F = tmpfile();
+ // expected-note at -1{{'errno' may be undefined after successful call to 'tmpfile'}}
----------------
At this place a note 'Assuming that the call is successful' should be displayed. But this is not working because `StreamChecker` is enabled. `StreamChecker` makes a state split before `StdCLibraryFunctionsChecker` for `tmpfile` failure and success, then in `StdCLibraryFunctionsChecker` the successor count is 1 and the note is not added. Probably the logic can be improved by finding the first node that belongs to the `CallEvent`. Or count how many cases are applied before adding the note tags.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D153612/new/
https://reviews.llvm.org/D153612
More information about the cfe-commits
mailing list