[clang] [clang][CodeGen] Detect backward jumps for C lifetime markers (PR #238919)

Nick Desaulniers via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 4 13:48:17 PST 2026


================
@@ -6160,12 +6160,9 @@ LValue CodeGenFunction::EmitCompoundLiteralLValue(const CompoundLiteralExpr *E){
   const Expr *InitExpr = E->getInitializer();
   LValue Result = MakeAddrLValue(DeclPtr, E->getType(), AlignmentSource::Decl);
 
-  if (!getLangOpts().CPlusPlus) {
-    if (HaveInsertPoint() && !hasLabelBeenSeenInCurrentScope() &&
-        EmitLifetimeStart(DeclPtr.getBasePointer()))
-      pushCleanupAfterFullExpr<CallLifetimeEnd>(NormalEHLifetimeMarker,
-                                                DeclPtr);
-  }
+  if (!getLangOpts().CPlusPlus && HaveInsertPoint() &&
+      !Bypasses.IsBypassed(E) && EmitLifetimeStart(DeclPtr.getBasePointer()))
----------------
nickdesaulniers wrote:

Yeah, sorry, I wasn't certain about the test case `test_forward_goto_bypass` and got that case wrong, initially. Should be fixed up now.

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


More information about the cfe-commits mailing list