From 345e3d419eafb0e234aecb4a33f37efe2afbbf53 Mon Sep 17 00:00:00 2001 From: _ov4 Date: Sun, 18 Oct 2026 08:07:50 +0000 Subject: feat(classes): add copy constructors and statement-scoped temporaries Co-Authored-By: Claude Opus 5.5 --- lib/CodeGen/ExceptionHandler.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lib/CodeGen/ExceptionHandler.cc') diff --git a/lib/CodeGen/ExceptionHandler.cc b/lib/CodeGen/ExceptionHandler.cc index 3f69417..c879a87 100644 --- a/lib/CodeGen/ExceptionHandler.cc +++ b/lib/CodeGen/ExceptionHandler.cc @@ -94,7 +94,7 @@ void ExceptionHandler::recordExit(Instruction *Before, bool Unwinding) { CleanupPoints[F].push_back({Before, States[F], Unwinding}); } -void ExceptionHandler::fillCleanups(Function *F, const std::function &Destroy) { +void ExceptionHandler::fillCleanups(Function *F, const std::function &Destroy) { IRBuilderBase::InsertPointGuard Guard(Builder); SaveAndRestore StateGuard(States[F]); auto &Points = CleanupPoints[F]; @@ -107,7 +107,7 @@ void ExceptionHandler::fillCleanups(Function *F, const std::function &De auto *Continuation = BB->splitBasicBlock(Point.Before->getIterator(), "after_destruction"); BB->getTerminator()->eraseFromParent(); Builder.SetInsertPoint(BB); - Destroy(); + Destroy(Point.TemporariesOnly); Builder.CreateBr(Continuation); } Points.clear(); @@ -133,7 +133,8 @@ BasicBlock *ExceptionHandler::emitUnwindDestination() { for (unsigned I = TargetDepth; I < State.CatchDepth; ++I) Builder.CreateCall(EndCatch); if (Handler) { Builder.CreateStore(Builder.CreateExtractValue(LP, 0), Handler->Exception); - Builder.CreateBr(Handler->Target); + auto *Branch = Builder.CreateBr(Handler->Target); + CleanupPoints[F].push_back({Branch, States[F], true, true}); } else { recordExit(Builder.CreateResume(LP), true); } -- cgit v1.3.1-4-g156e