diff options
Diffstat (limited to 'lib/CodeGen/FunctionGen.cc')
| -rw-r--r-- | lib/CodeGen/FunctionGen.cc | 9 |
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}; + } } } |
