[PATCH] D104285: [analyzer] Retrieve a value from list initialization of constant array declaration in a global scope.

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 7 07:38:54 PDT 2021


aaron.ballman added a comment.

Some minor drive-by nits, but this looks sensible to me.



================
Comment at: clang/lib/StaticAnalyzer/Core/RegionStore.cpp:1692-1694
+            const bool IsOneDimensionalArray =
+                !isa<ConstantArrayType>(CAT->getElementType());
+            if (IsOneDimensionalArray) {
----------------



================
Comment at: clang/lib/StaticAnalyzer/Core/RegionStore.cpp:1696-1698
+              const uint64_t I = static_cast<uint64_t>(Idx.getExtValue());
+              // Use `getZExtValue` because array extent can not be negative.
+              const uint64_t Extent = CAT->getSize().getZExtValue();
----------------



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

https://reviews.llvm.org/D104285



More information about the cfe-commits mailing list