aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/FunctionGen.cc
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-10-17 06:54:32 +0000
committer_ov4 <ov4@ov4.org>2026-10-17 06:54:32 +0000
commit74b6d06711afd3efbbc47436f1491900994313f3 (patch)
treeb9050214b147cd2b1b54fd27e75d669bf6146e48 /lib/CodeGen/FunctionGen.cc
parent39661855c0816ac248be437704c76f58359cb5f0 (diff)
feat(classes): allocate objects with NEW and rebind named class variables
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'lib/CodeGen/FunctionGen.cc')
-rw-r--r--lib/CodeGen/FunctionGen.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/CodeGen/FunctionGen.cc b/lib/CodeGen/FunctionGen.cc
index d5bc5d4..e344410 100644
--- a/lib/CodeGen/FunctionGen.cc
+++ b/lib/CodeGen/FunctionGen.cc
@@ -90,7 +90,14 @@ void FunctionGen::createArgumentAllocas(Function *F, const std::vector<ParamDecl
AllocaInst *Alloca = TmpB.CreateAlloca(ArgType, nullptr, P.Name);
Builder.CreateStore(ArgVal, Alloca);
- Symbols[P.Name] = {Alloca, P.TypeName, false};
+ const TypeInfo *Info = Types.resolve(P.TypeName);
+ if (Info && Info->IsClass) {
+ AllocaInst *Slot = TmpB.CreateAlloca(PointerType::getUnqual(Context), nullptr, P.Name + ".ref");
+ Builder.CreateStore(Alloca, Slot);
+ Symbols[P.Name] = {Slot, P.TypeName, false, nullptr, 0, true};
+ } else {
+ Symbols[P.Name] = {Alloca, P.TypeName, false};
+ }
}
}