From ef9f478179e0a7db81e7bba7359b70d68e6b10c9 Mon Sep 17 00:00:00 2001 From: Shaikh Ubaid Date: Sun, 14 Apr 2024 10:57:49 +0530 Subject: [PATCH] LLVM: Fix prototype declaration for _lpython_get_argc() --- src/libasr/codegen/asr_to_llvm.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/libasr/codegen/asr_to_llvm.cpp b/src/libasr/codegen/asr_to_llvm.cpp index c23f2f616c..f8b9d7e407 100644 --- a/src/libasr/codegen/asr_to_llvm.cpp +++ b/src/libasr/codegen/asr_to_llvm.cpp @@ -9316,17 +9316,11 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor llvm::Function *fn = module->getFunction("_lpython_get_argc"); if(!fn) { llvm::FunctionType *function_type = llvm::FunctionType::get( - llvm::Type::getVoidTy(context), { - llvm::Type::getInt32Ty(context)->getPointerTo() - }, false); + llvm::Type::getInt32Ty(context), {}, false); fn = llvm::Function::Create(function_type, llvm::Function::ExternalLinkage, "_lpython_get_argc", *module); } - llvm::AllocaInst *result = builder->CreateAlloca( - llvm::Type::getInt32Ty(context), nullptr); - std::vector args = {result}; - builder->CreateCall(fn, args); - tmp = CreateLoad(result); + tmp = builder->CreateCall(fn, {}); return; } else if (func_name == "achar") { // TODO: make achar just StringChr