diff options
| author | Nagi5Yeq <wu@x-nagi.com> | 2020-05-30 15:52:36 +0800 |
|---|---|---|
| committer | Nagi5Yeq <wu@x-nagi.com> | 2020-05-30 15:52:36 +0800 |
| commit | 30726a1872c92d40424d496fc52043ca452d935f (patch) | |
| tree | 86ce09251183ee544033ba8bfa9f51199aa58628 /node/FunctionNode.cc | |
| parent | 4c9d2d541c90968db2065260dc94c3be9e8adef9 (diff) | |
support for array access (partial)
Diffstat (limited to 'node/FunctionNode.cc')
| -rw-r--r-- | node/FunctionNode.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/node/FunctionNode.cc b/node/FunctionNode.cc index 736007b..c85297b 100644 --- a/node/FunctionNode.cc +++ b/node/FunctionNode.cc @@ -50,7 +50,8 @@ Value FunctionNode::CodeGen() { for (auto&& arg : arguments_) { Value ArgValue = builder->CreateAlloca(std::get<1>(arg)->GetLLVMType()); builder->CreateStore(ArgIt++, ArgValue); - locals_.Add(std::get<0>(arg), {std::get<1>(arg), ArgValue}); + locals_.Add(std::get<0>(arg), + {manager->GetPointerType(std::get<1>(arg)), ArgValue}); } // alloc local variables for (auto&& decl : LocalDeclarations_) { @@ -61,7 +62,7 @@ Value FunctionNode::CodeGen() { if (IsVoid == false) { // create a variable with the same name as the function for return value rv = builder->CreateAlloca(ReturnType_->GetLLVMType()); - locals_.Add(name_, {ReturnType_, rv}); + locals_.Add(name_, {manager->GetPointerType(ReturnType_), rv}); } // push the function scope variables context_->PushScope(&locals_); |
