[clang] [NFC][analyzer] Refactor Environment to map Expr to SVal instead of Stmt to SVal (PR #193295)
Balázs Benics via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 21 12:48:50 PDT 2026
================
@@ -886,7 +886,12 @@ static ProgramStateRef checkElementNonNil(CheckerContext &C,
assert(ElemDecl->getInit() == nullptr);
ElementLoc = State->getLValue(ElemDecl, LCtx);
} else {
- ElementLoc = State->getSVal(Element, LCtx).getAs<Loc>();
+ const Expr *Ex = dyn_cast<Expr>(Element);
+ if (Ex) {
----------------
steakhal wrote:
I'd prefer an init-if stmt instead. Also keep trying the declarations DRY - in other words, if the type was already spelled on the line, just use `auto`.
https://github.com/llvm/llvm-project/pull/193295
More information about the cfe-commits
mailing list