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

Denys Petrov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 13 06:17:13 PDT 2021


ASDenysPetrov created this revision.
ASDenysPetrov added reviewers: NoQ, vsavchenko, steakhal, martong.
ASDenysPetrov added a project: clang.
Herald added subscribers: manas, 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.

Add support of handling `CompoundLiteralExpr` in `RegionStoreManager::getConstantValFromConstArrayInitializer`. Retrieve a value from `CompoundLiteralExpr` which is an initializer of constant arrays in global and local scopes. This patch also disables direct binding a compound literal for constant arrays of local storage duration.

Example:

  const int arr[8] = (const int[8]){1, 2, 3, 4}; // compound literal


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D108032

Files:
  clang/lib/AST/Expr.cpp
  clang/lib/StaticAnalyzer/Core/RegionStore.cpp
  clang/test/Analysis/compound-literals.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108032.366262.patch
Type: text/x-patch
Size: 13774 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210813/23f8ab01/attachment-0001.bin>


More information about the cfe-commits mailing list