Skip to content

Commit

Permalink
Call declare_local_vars() in a subroutine
Browse files Browse the repository at this point in the history
  • Loading branch information
certik committed Aug 24, 2020
1 parent 5889145 commit cdd783b
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions src/lfortran/codegen/asr_to_llvm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,18 +300,7 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor<ASRToLLVMVisitor>

declare_args(x, *F);

for (auto &item : x.m_symtab->scope) {
if (item.second->type == ASR::asrType::var) {
ASR::var_t *v2 = (ASR::var_t*)(item.second);
ASR::Variable_t *v = (ASR::Variable_t *)v2;
if (!is_arg_dummy(v->m_intent)) {
// TODO: we are assuming integer here:
llvm::AllocaInst *ptr = builder->CreateAlloca(
llvm::Type::getInt64Ty(context), nullptr, v->m_name);
llvm_symtab[std::string(v->m_name)] = ptr;
}
}
}
declare_local_vars(x);

for (size_t i=0; i<x.n_body; i++) {
this->visit_stmt(*x.m_body[i]);
Expand Down

0 comments on commit cdd783b

Please sign in to comment.