[PATCH] D130470: [clang][analyzer] Add more wide-character functions to CStringChecker

Balázs Kéri via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 28 09:12:06 PDT 2022


balazske added inline comments.


================
Comment at: clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp:1334
+                                 bool IsWide) const {
   // void *memmove(void *dst, const void *src, size_t n);
   // The return value is the address of the destination buffer.
----------------
steakhal wrote:
> Do you think we should also update these comments?
> It no longer matches to only this function.
These are only for "reference" purpose and already not exact declarations (no `restricted`). The wide version is similar, does not look not necessary to repeat here.


================
Comment at: clang/test/Analysis/wstring.c:372-376
+  // else
+  //   analyzer_assert_unknown(n == 0);
+
+  // We can't do the above comparison because n has already been constrained.
+  // On one path n == 0, on the other n != 0.
----------------
martong wrote:
> This comment is probably outdated (I know it has been copied from `bstring.c` but still). Perhaps we should have the `else` branch now not just here but also in `bstring.c`.
`clang_analyzer_eval(n == 0)` is `TRUE` and `FALSE`, not `UNKNOWN` here. `n` can be 0 or non-0 but it is connected to values of `a` and `b` too.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130470



More information about the cfe-commits mailing list