From ba1e3fdd1eea618a38e56918912dc966d1e399a8 Mon Sep 17 00:00:00 2001 From: Nagi5Yeq Date: Wed, 27 May 2020 02:08:29 +0800 Subject: fix array, string, and constant nodes --- node/FunctionNode.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'node/FunctionNode.cc') diff --git a/node/FunctionNode.cc b/node/FunctionNode.cc index e22c8b6..6352b5b 100644 --- a/node/FunctionNode.cc +++ b/node/FunctionNode.cc @@ -64,12 +64,15 @@ Value FunctionNode::CodeGen() { // push the function scope variables context_->PushScope(&locals_); body_->CodeGen(); - builder->CreateRet(rv); + builder->CreateRet(builder->CreateLoad(type_->GetLLVMType(), rv)); context_->PopScope(); std::string msg; llvm::raw_string_ostream MsgStream(msg); llvm::verifyFunction(*function, &MsgStream); - Log(LogLevel::PCC_INFO, "%s", msg.c_str()); + MsgStream.flush(); + if (!msg.empty()) { + Log(LogLevel::PCC_INFO, "%s", msg.c_str()); + } return nullptr; } -- cgit