[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
Mon Oct 4 06:38:43 PDT 2021


ASDenysPetrov added inline comments.


================
Comment at: clang/lib/StaticAnalyzer/Core/RegionStore.cpp:1641
+  // FIXME: Take array dimension into account to prevent exceeding its size.
+  const int64_t I = Idx.getExtValue();
+  uint32_t Code =
----------------
martong wrote:
> steakhal wrote:
> > You could use the `uint64_t` type here, and spare the subsequent explicit cast. This operation would be safe since `Idx` must be non-negative here.
> +1 for using `uint64_t` if possible
`SL->getCodeUnit` returns `uint32_t`, so I decided to keep the result value consistent if any changes required in the future.


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

https://reviews.llvm.org/D107339



More information about the cfe-commits mailing list