[PATCH] D101060: [Analyzer][StdLibraryFunctionsChecker] Describe arg constraints

Valeriy Savchenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 22 06:39:03 PDT 2021


vsavchenko added a comment.

Great job! Thanks!



================
Comment at: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:338-339
         }
+        llvm_unreachable("The constraint must be either a concrete value or "
+                         "encoded in an argument.");
       }();
----------------
Just a thought here, maybe we should assert `SizeArgN` instead then?


================
Comment at: clang/test/Analysis/std-c-library-functions-arg-constraints-notes.cpp:32
+    __buf_size_arg_constraint_concrete(buf); // \
+    // expected-note{{The size of the 0th arg should be equal to or less than the value of 10}} \
+    // expected-warning{{}}
----------------
Oof, I do understand that we are devs and enumerate things starting from 0. But this is supposed to be human-readable and humans start counting from 1.


================
Comment at: clang/test/Analysis/std-c-library-functions-arg-constraints.c:33
   // report-warning{{Function argument constraint is not satisfied}} \
+  // report-note{{}} \
   // bugpath-warning{{Function argument constraint is not satisfied}} \
----------------
What's up with these?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D101060/new/

https://reviews.llvm.org/D101060



More information about the cfe-commits mailing list