[PATCH] D101635: [analyzer] Fix assertion in SVals.h

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 3 01:18:05 PDT 2021


NoQ added a comment.

In D101635#2731210 <https://reviews.llvm.org/D101635#2731210>, @steakhal wrote:

> Does anyone have an idea how to prevent such a silly mistake from happening again?

Maybe use more optionals? I.e., `castRegion` may fail, so let's change it to return `Optional<const MemRegion *>` where the pointer is always non-null when present? In many cases it's probably unnecessary but when a function can return null //for poorly predictable reasons// (eg., like in this case, the region turning out to have symbolic offset after a potentially unlimited number of unwraps) it's probably worth it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101635



More information about the cfe-commits mailing list