[clang] [LifetimeSafety] Overhaul CFG and analysis to also work with trivially destructed temporary objects (PR #177985)
Utkarsh Saxena via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 17 03:47:04 PST 2026
================
@@ -6037,6 +6080,25 @@ static void print_elem(raw_ostream &OS, StmtPrinterHelper &Helper,
OS << " (Lifetime ends)";
break;
+ case CFGElement::Kind::FullExprCleanup: {
+ auto MTEs = E.castAs<CFGFullExprCleanup>().getExpiringMTEs();
+ size_t MTECount = MTEs.size();
+ OS << "(FullExprCleanup collected " << MTECount
+ << (MTECount > 1 ? " MTEs: " : " MTE: ");
+ bool FirstMTE = true;
+ for (const MaterializeTemporaryExpr *MTE : MTEs) {
+ if (!FirstMTE)
+ OS << ", ";
+ if (!Helper.handledStmt(MTE->getSubExpr(), OS)) {
+ // Pretty print the sub-expresion as a fallback
+ MTE->printPretty(OS, &Helper, PrintingPolicy(Helper.getLangOpts()));
----------------
usx95 wrote:
I think this would print more than one line ? More than one line would disturb the CFG printing completely. Its ok if thats not the case.
Could you please add a test to print the same.
https://github.com/llvm/llvm-project/pull/177985
More information about the cfe-commits
mailing list