[PATCH] D101526: [analyzer][StdLibraryFunctionsChecker] Add NoteTags for applied arg constraints

Gabor Marton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 26 07:35:05 PDT 2022


martong added a comment.

In D101526#3883871 <https://reviews.llvm.org/D101526#3883871>, @NoQ wrote:

> Looks great to me, thanks!!

Thanks for the review!



================
Comment at: clang/test/Analysis/std-c-library-functions-arg-constraints-notes.cpp:32-33
     __buf_size_arg_constraint_concrete(buf); // \
-    // expected-note{{The size of the 1st arg should be equal to or less than the value of 10}} \
+    // expected-note{{The size of the 1st argument should be equal to or greater than the value of 10}} \
     // expected-warning{{}}
     break;
----------------
NoQ wrote:
> The warning is the same as the note here right?
> 
> Our warnings traditionally describe the problem (the 1st argument *is* less than 10, and this *is* bad because...), not how things "should" be. I guess we can think more about that later.
No, actually, the warning is different, it does not contain the text "should be". In this case this is it:
```
 Line 31: Function argument constraint is not satisfied, constraint: BufferSize [alpha.unix.StdCLibraryFunctionArgs]
```
And then the notes basically further explain how the constraint is not satisfied.

I did not put the check for the warnings here because this test file is responsible for checking the notes only, hence it has the name `std-c-library-functions-arg-constraints-notes.cpp`.
The warnings are directly tested in `std-c-library-functions-arg-constraints.c`, however, I have to admit, probably we should have even more specific checks for the warning messages there.


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