[clang] [NFC][analyzer] Improve tracking of the current Block & LocCtx (PR #185107)
DonĂ¡t Nagy via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 10 04:49:31 PDT 2026
================
@@ -216,6 +216,14 @@ void CoreEngine::dispatchWorkItem(ExplodedNode *Pred, ProgramPoint Loc,
return timeTraceMetadata(Pred, Loc);
}};
PrettyStackTraceLocationContext CrashInfo(Pred->getLocationContext());
+
+ // This work item is not necessarily related to the previous one, so
+ // the old current LocationContext and Block is no longer relevant.
+ // The new current LocationContext and Block should be set soon, but this
+ // guarantees that buggy access before that will trigger loud crashes instead
+ // of silently using stale data.
+ ExprEng.resetCurrLocationContextAndBlock();
----------------
NagyDonat wrote:
My first impression was that this would be too paranoid, but on a second thought I actually like this suggestion. I'll add an assertion in `setCurrLocationContextAndBlock()`.
https://github.com/llvm/llvm-project/pull/185107
More information about the cfe-commits
mailing list