[clang] [analyzer] Fix CFG elements order when AddLifetime is enabled (PR #243630)

Benedek Kaibas via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 18 12:46:36 PST 2026


================
@@ -1993,14 +1993,11 @@ void CFGBuilder::addAutomaticObjDestruction(LocalScope::const_iterator B,
     return;
 
   SmallVector<VarDecl *, 10> DeclsNeedDestruction;
----------------
benedekaibas wrote:

> Should we reconsider the name of this variable, given that now it holds all variables?

Yes, `DeclsNeedDestruction` is no longer accurate. Applied changes here: [e31be40](https://github.com/llvm/llvm-project/pull/243630/commits/e31be408d07194ecf6ba2b2443d0b8868626024d)

> Do we even need these B and E, and then recreate a range from these? Should we pass the range directly into this fn?

I think this can work. Based on your comment I started experimenting whether I can simplify `addAutomaticObjHandling` and also passing either the range directly to the `addAutomaticObjDestruction` function or passing the `VarDecl`.

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


More information about the cfe-commits mailing list