[clang] [NFC][analyzer] Improve tracking of the current Block & LocCtx (PR #185107)

Gábor Horváth via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 9 02:28:49 PDT 2026


Xazax-hun wrote:

> Before this commit, this information was accessed via the field const NodeBuilderContext *currBldrCtx of ExprEngine which usually points to a NodeBuilderContext instantiated as a local variable in some random method of the engine.

I wonder if this design actually had a couple of reasons/advantages:
* When we start to process a new block or enter a new function, we really are forced to create these locals and pass them along. With the proposed design, it is possible to forget to do that and just automatically use the field that is not up to date.
* The current block and the location context are not always meaningful. What is the current block when we are processing an edge? Or what is the current block when we are doing some AST-based (not path sensitive) checks?

I definitely think there is some room for improvements/simplification, but the design where the location context and the current block is created closely to the location where we first need it and than passed along is not a bad design in my opinion as it can make certain classes of errors harder to make. 

That being said, it is possible @haoNoQ or @steakhal disagrees with me. 

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


More information about the cfe-commits mailing list