[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
Tue Aug 3 04:07:23 PDT 2021


ASDenysPetrov created this revision.
ASDenysPetrov added reviewers: NoQ, rsmith, martong, vsavchenko.
ASDenysPetrov added a project: clang.
Herald added subscribers: manas, steakhal, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware, xazax.hun.
ASDenysPetrov requested review of this revision.
Herald added a subscriber: cfe-commits.

Assuming that values of constant arrays never change, we can retrieve values for specific position(index) right from the initializer, if presented. Add support of handling `StringLiteral` in `RegionStoreManager::getConstantValFromConstArrayInitializer`. Retrieve a character code by index from `StringLiteral` which is an initializer of constant arrays in global and local scopes.
This patch also disables direct binding a string literal as `LazyCompoundVal` for constant arrays of local storage duration.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D107339

Files:
  clang/lib/StaticAnalyzer/Core/RegionStore.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107339.363684.patch
Type: text/x-patch
Size: 7267 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210803/bf66d095/attachment.bin>


More information about the cfe-commits mailing list