Skip to content

Commit

Permalink
fix: Fixed extern functions clashing names, and trying to use wrong decl
Browse files Browse the repository at this point in the history
  • Loading branch information
alinalihassan committed May 7, 2022
1 parent aed2cd9 commit 238406d
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/liblesma/Backend/Codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -442,12 +442,9 @@ void Codegen::visit(ExternFuncDecl *node) {
paramTypes.push_back(visit(param.second));

FunctionType *FT = FunctionType::get(visit(node->getReturnType()), paramTypes, false);
Function *F = Function::Create(FT, Function::ExternalLinkage, node->getName(), *TheModule);
auto F = TheModule->getOrInsertFunction(node->getName(), FT);

for (auto &param: F->args())
param.setName(node->getParameters()[param.getArgNo()].first);

Scope->insertSymbol(node->getName(), F, F->getFunctionType());
Scope->insertSymbol(node->getName(), F.getCallee(), F.getFunctionType());
}

void Codegen::visit(Assignment *node) {
Expand Down

0 comments on commit 238406d

Please sign in to comment.