[clang] [CIR] Emit lifetime markers for temporaries (PR #236102)
Jiahao Guo via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 13 04:55:53 PST 2026
================
@@ -25,6 +25,52 @@
using namespace clang;
using namespace clang::CIRGen;
+void CallLifetimeEnd::emit(CIRGenFunction &cgf, Flags flags) {
+ cgf.emitLifetimeEndOp(addr.getLoc(), addr);
+}
+
+void CIRGenFunction::pushFullExprLifetimeEnd(Address addr) {
+ assert(addr.getDefiningOp<cir::AllocaOp>() &&
+ "lifetime cleanup requires the raw alloca address");
+ if (!isInConditionalBranch()) {
+ ehStack.pushCleanup<CallLifetimeEnd>(NormalEHLifetimeMarker,
+ addr.getPointer());
+ return;
+ }
+
+ Address activeFlag = createCleanupActiveFlag();
+ deferredConditionalCleanupStack.push_back(
----------------
E00N777 wrote:
I added some test cases for conditional expressions && non-trivial destructors.
https://github.com/llvm/llvm-project/pull/236102
More information about the cfe-commits
mailing list