[PATCH] D106681: [analyzer][NFC] Move a block from `getBindingForElement` to separate functions

Denys Petrov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 20 01:54:42 PDT 2021


ASDenysPetrov added inline comments.


================
Comment at: clang/lib/StaticAnalyzer/Core/RegionStore.cpp:1686-1689
+  // Array's declaration should have an initializer.
+  const Expr *Init = VD->getAnyInitializer();
+  if (!Init)
+    return None;
----------------
ASDenysPetrov wrote:
> steakhal wrote:
> > This should have been checked at L1642 to preserve the original behavior.
> > As of now, the code might return `UndefinedVal` at L1683 or `Unknown` at L1659, which is probably different than the original behavior - unless you prove otherwise.
> `Unknown` at L1659 comes from `RegionStoreManager::getBindingForFieldOrElementCommon`. As you can see, there is a snippet in here:
> ```
>     if (hasSymbolicIndex)
>       return UnknownVal();
> ```
> 
UndefinedVal at L1683 preserves exactly the previous behaviour.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106681



More information about the cfe-commits mailing list