[PATCH] D157385: [clang][CFG] Cleanup functions
Timm Bäder via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 1 05:24:48 PDT 2023
tbaeder added inline comments.
================
Comment at: clang/lib/Analysis/CFG.cpp:1901-1902
appendLifetimeEnds(Block, VD, S);
- if (BuildOpts.AddImplicitDtors)
+ if (BuildOpts.AddImplicitDtors && !hasTrivialDestructor(VD))
appendAutomaticObjDtor(Block, VD, S);
+ if (HasCleanupAttr)
----------------
steakhal wrote:
> steakhal wrote:
> > This condition looks new. Is it an orthogonal improvement?
> Shouldn't the cleanup function run first, and then the dtor of the variable?
> This way the object is already "dead" even before reaching the cleanup handler.
> https://godbolt.org/z/sT65boooW
This check is needed because it's not implied anymore by the variable being in the list. It might be in there because it has a cleanup function.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D157385/new/
https://reviews.llvm.org/D157385
More information about the cfe-commits
mailing list