[PATCH] D122285: [analyzer] Add path note tags to standard library function summaries.

Bal√°zs Benics via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 6 01:50:44 PDT 2022


steakhal added inline comments.


================
Comment at: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:872-883
+    if (NewState && NewState != State) {
+      StringRef Note = Case.getNote();
+      const NoteTag *Tag = C.getNoteTag(
+          // Sorry couldn't help myself.
+          [Node, Note]() {
+            // Don't emit "Assuming..." note when we ended up
+            // knowing in advance which branch is taken.
----------------
I thought we mostly have one or two cases. If we have two cases, then the constraint should be the opposite of the other one.

If this is the case, when does `NewState && NewState != State` not imply `Node->succ_size() > 1` given that `Summary.getCases().size() >= 2`?


================
Comment at: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:1326-1330
           // The locale-specific range.
           .Case({ArgumentCondition(0U, WithinRange, {{128, UCharRangeMax}})})
           // Is not an unsigned char.
           .Case({ArgumentCondition(0U, OutOfRange, Range(0, UCharRangeMax)),
                  ReturnValueCondition(WithinRange, SingleValue(0))}));
----------------
Why don't we have notes for these cases?


================
Comment at: clang/test/Analysis/std-c-library-functions-path-notes.c:3
+// RUN:     -analyzer-checker=core,apiModeling \
+// RUN:     -analyzer-config assume-controlled-environment=false \
+// RUN:     -analyzer-output=text
----------------
This is the default value. What's the benefit of passing this?


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

https://reviews.llvm.org/D122285



More information about the cfe-commits mailing list