[clang] [NFC][analyzer] Spread use of 'Expr*' instead of 'Stmt*' (PR #188319)

Balázs Benics via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 2 03:00:01 PDT 2026


================
@@ -297,17 +297,19 @@ void ExprEngine::processCallExit(ExplodedNode *CEBNode) {
   if (CE) {
     if (const ReturnStmt *RS = dyn_cast_or_null<ReturnStmt>(LastSt)) {
       const LocationContext *LCtx = CEBNode->getLocationContext();
+      // FIXME: This tries to look up the return statement in the environment,
+      // which is special cased to look up the subexpression RS->getRetValue()
+      // in environment. Instead of relying on this hack, pass
+      // RS->getRetValue() to getSVal() after checking it for nullness.
----------------
steakhal wrote:

Got it. Indeed we have a shorthand for grabbing the lvalue and then following it by a load from the store.
I can see this as breaking the mental model by mixing the store and env. I remember in my early days, it took me a while to destill this. These should be split apart.

Next speaking of these taking Stmts, I still feel that they are exprs modulo potential objective C quirks. Ifwre can make them accept exprs, we should nake them so.

https://github.com/llvm/llvm-project/pull/188319


More information about the cfe-commits mailing list