aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CodeGen.cc
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-10-17 08:34:42 +0000
committer_ov4 <ov4@ov4.org>2026-10-17 08:34:42 +0000
commitabd56ef20bc8061bbecec29edd1301d324c2cb34 (patch)
tree8da9a14372a60d4df8bf58693c62c187765e7240 /lib/CodeGen/CodeGen.cc
parent59e3c50bcd58130e81e1f57b21d6e57b4d4aba6d (diff)
feat(classes): destroy stack objects at scope exit
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'lib/CodeGen/CodeGen.cc')
-rw-r--r--lib/CodeGen/CodeGen.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/CodeGen/CodeGen.cc b/lib/CodeGen/CodeGen.cc
index 68dec5c..8117434 100644
--- a/lib/CodeGen/CodeGen.cc
+++ b/lib/CodeGen/CodeGen.cc
@@ -74,6 +74,10 @@ CodeGen::CodeGen() {
/*MakeCopy=*/P.Mode == PassMode::ByVal, *this);
});
+ FuncGen->setCopyRegistrar([this](Value *Addr, const std::string &TypeName, int Line) {
+ activateStackObject(registerStackObject(Addr, TypeName, Line, false, true));
+ });
+
SetupExternalFunctions();
}
@@ -185,6 +189,7 @@ void CodeGen::compile(const std::vector<std::unique_ptr<StmtAST>> &Statements) {
Builder->CreateRet(ConstantInt::get(*TheContext, APInt(32, 0)));
}
+ finishStackObjects(F);
auto *Exception = Exceptions->popHandler();
Builder->SetInsertPoint(UnhandledBB);
Exceptions->beginCatch(Exception);