aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CodeGen.cc
diff options
context:
space:
mode:
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);