[PATCH] D101526: [analyzer][StdLibraryFunctionsChecker] Add NoteTags for applied arg constraints
Artem Dergachev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 29 16:45:44 PDT 2021
NoQ added inline comments.
================
Comment at: clang/test/Analysis/std-c-library-functions-arg-constraints-note-tags.cpp:16
+int test_note(int x, int y) {
+ __single_val_1(x); // expected-note{{Applied constraint: The 1st arg should be within the range [1, 1]}}
+ return y / (1 - x); // expected-warning{{Division by zero}} \
----------------
This has to be a user-friendly message.
* "Constraints" is compiler jargon.
* We cannot afford shortening "argument" to "arg".
* Generally, the less machine-generated it looks the better (":" is definitely robotic).
================
Comment at: clang/test/Analysis/std-c-library-functions-arg-constraints.c:42
int ret = isalnum(x);
+ // bugpath-note at -1{{Applied constraint: The 1st arg should be within the range [[-1, -1], [0, 255]]}}
(void)ret;
----------------
This isn't part of this patch but what do you think about `{-1} U [0, 255]`? Or, you know, `[-1, 255]`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D101526/new/
https://reviews.llvm.org/D101526
More information about the cfe-commits
mailing list