[clang] [LifetimeSafety] Overhaul CFG and analysis to also work with trivially destructed temporary objects (PR #177985)
Abhinav Pradeep via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 12 03:20:29 PST 2026
================
@@ -5125,6 +5156,8 @@ CFGBlock *CFGBuilder::VisitForTemporaryDtors(Stmt *E, bool ExternallyDestructed,
case Stmt::MaterializeTemporaryExprClass: {
const MaterializeTemporaryExpr* MTE = cast<MaterializeTemporaryExpr>(E);
ExternallyDestructed = (MTE->getStorageDuration() != SD_FullExpression);
+ if (BuildOpts.AddLifetime && !ExternallyDestructed)
+ Context.track(MTE);
----------------
AbhinavPradeep wrote:
Nope that is an unnecessary check, will remove it. I had written `track` before thinking about the call sites so had a weaker precondition in mind.
https://github.com/llvm/llvm-project/pull/177985
More information about the cfe-commits
mailing list