From abd56ef20bc8061bbecec29edd1301d324c2cb34 Mon Sep 17 00:00:00 2001 From: _ov4 Date: Sat, 17 Oct 2026 08:34:42 +0000 Subject: feat(classes): destroy stack objects at scope exit Co-Authored-By: Claude Opus 5.5 --- lib/CodeGen/FunctionGen.cc | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/CodeGen/FunctionGen.cc') diff --git a/lib/CodeGen/FunctionGen.cc b/lib/CodeGen/FunctionGen.cc index e344410..9d9f60d 100644 --- a/lib/CodeGen/FunctionGen.cc +++ b/lib/CodeGen/FunctionGen.cc @@ -89,6 +89,7 @@ void FunctionGen::createArgumentAllocas(Function *F, const std::vector TmpB(&F->getEntryBlock(), F->getEntryBlock().begin()); AllocaInst *Alloca = TmpB.CreateAlloca(ArgType, nullptr, P.Name); + // Shallow BYVAL copy. The common lifetime hook is the future copy-constructor point. Builder.CreateStore(ArgVal, Alloca); const TypeInfo *Info = Types.resolve(P.TypeName); if (Info && Info->IsClass) { @@ -98,6 +99,7 @@ void FunctionGen::createArgumentAllocas(Function *F, const std::vector