diff options
| author | _ov4 <ov4@ov4.org> | 2026-10-18 08:07:50 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-10-18 08:07:50 +0000 |
| commit | 345e3d419eafb0e234aecb4a33f37efe2afbbf53 (patch) | |
| tree | 9330322103f26f15c6df91cbbd62bf5a1f6e72da /lib/CodeGen/ExceptionHandler.cc | |
| parent | 927e3fc0384c941f9ad313a28768660c3cdb1777 (diff) | |
feat(classes): add copy constructors and statement-scoped temporaries
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'lib/CodeGen/ExceptionHandler.cc')
| -rw-r--r-- | lib/CodeGen/ExceptionHandler.cc | 7 |
1 files changed, 4 insertions, 3 deletions
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<void()> &Destroy) { +void ExceptionHandler::fillCleanups(Function *F, const std::function<void(bool)> &Destroy) { IRBuilderBase::InsertPointGuard Guard(Builder); SaveAndRestore<FunctionState> StateGuard(States[F]); auto &Points = CleanupPoints[F]; @@ -107,7 +107,7 @@ void ExceptionHandler::fillCleanups(Function *F, const std::function<void()> &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); } |
