[PATCH] D107339: [analyzer] Retrieve a character from StringLiteral as an initializer for constant arrays.

Denys Petrov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 21 17:23:10 PDT 2021


ASDenysPetrov added inline comments.


================
Comment at: clang/lib/StaticAnalyzer/Core/RegionStore.cpp:1708-1710
+  // Handle StringLiteral.
+  if (const auto *SL = dyn_cast<StringLiteral>(Init))
+    return getSValFromStringLiteral(SL, Offset, R->getElementType());
----------------
martong wrote:
> I am wondering why this hunk is needed? `getSValFromInitListExpr` is handling this case at L1725, isn't it?
L1710 handles `const char x[] = "abc";`
L1725 handles `const char x[] = {"abc"};`
I think I should give an example in comments.


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

https://reviews.llvm.org/D107339



More information about the cfe-commits mailing list