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

Gabor Marton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 22 00:25:17 PDT 2021


martong 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());
----------------
ASDenysPetrov wrote:
> 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.
Okay, thanks for the explanation.

> I think I should give an example in comments.
Yes, that's a good idea!



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

https://reviews.llvm.org/D107339



More information about the cfe-commits mailing list