[clang] [clang] Trigger checkLifetimeEnd callback from CFGLifetimeEnds element (PR #201123)

Arseniy Zaostrovnykh via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 2 08:50:56 PDT 2026


================
@@ -57,12 +57,15 @@ class CFGElement {
   enum Kind {
     // main kind
     Initializer,
-    ScopeBegin,
-    ScopeEnd,
     NewAllocator,
-    LifetimeEnds,
     LoopExit,
     FullExprCleanup,
+    // scope marker kind
+    ScopeBegin,
+    ScopeEnd,
+    LifetimeEnds,
+    SCOPE_BEGIN = ScopeBegin,
+    SCOPE_END = LifetimeEnds,
----------------
necto wrote:

As far as I can tell, no, these particular `Kind`s (ScopeBegin, ScopeEnd, LifetimeEnds, NewAllocator, LoopExit, FullExprCleanup) were order-agnostic.
Before this patch, only elements between `Statement` and `CXXRecordTypedCall`; and elements between `AutomaticObjectDtor` and `TemporaryDtor` were dependent on being in a contiguous range. After this patch same applies to elements between `ScopeBegin` and `LifetimeEnds`.
Otherwise, all uses of this enum values were used for their absolute value and compared only for equality.

There is a nontrivial constraint on the number of bits: all kinds must fit into 4 bits that are broken across Data1 and Data2. Fortunately, I do not need to add any new kind, or otherwise change the integer range.

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


More information about the cfe-commits mailing list