[PATCH] D107073: [analyzer] Disable direct binding from list initialization for constant arrays of local storage duration.

Denys Petrov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 29 07:03:31 PDT 2021


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

Ignore direct bindings for constant arrays of local storage duration with list initialization. Constant arrays don't change their values during a lifetime. Therefore, we don't have to bind values directly for each array element. Retrieve values from list initialization on-demand as it currently works for arrays of global storage duration (See https://reviews.llvm.org/D106681 for details).

Example: `const int arr[42] = {1,2,3,4};`.
We can get values directly from list initializaion in any time, no matter whether the array has **global** or **local** storage duration. Previously it works only for **global** arrays.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D107073

Files:
  clang/lib/StaticAnalyzer/Core/RegionStore.cpp
  clang/test/Analysis/initialization.c
  clang/test/Analysis/initialization.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107073.362759.patch
Type: text/x-patch
Size: 9258 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210729/9b1c1bab/attachment.bin>


More information about the cfe-commits mailing list