[clang] [NFC][analyzer] Clean up CheckerContext::addTransitionImpl (PR #231180)

Donát Nagy via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 13 06:55:15 PDT 2026


NagyDonat wrote:

> Commit 7 justifies dropping Tag ? Tag : Location.getTag() with "Location.withTag(Location.getTag()) is the same as Location". Strictly, that isn't true. ProgramPoint::withTag rebuilds the point without its ElemRef, while operator== and Profile both compare ElemRef (ProgramPoint.h:137-139, :192-194). For PreImplicitCall/PostImplicitCall points (CallEvent.cpp:320-321), a null-Tag generateErrorNode()/generateNonFatalErrorNode() used to create a node without the ElemRef.

This is a good catch by the AI – `ProgramPoint:withTag` intended to only change the `Tag` (the comment before it explicitly states this), but when d65379c8d4768ddae143672f5d4827acafe22553 introduced the extra data member `ElemRef` (in 2023), it failed to update `withTag`, so since then `withTag` "eats" the `ElemRef` field of the `ProgramPoint`s that it modifies.

This is an ugly bug, so I'll quickly create a separate commit to fix it.



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


More information about the cfe-commits mailing list