summaryrefslogtreecommitdiff
path: root/node/FunctionNode.cc
diff options
context:
space:
mode:
Diffstat (limited to 'node/FunctionNode.cc')
-rw-r--r--node/FunctionNode.cc7
1 files changed, 5 insertions, 2 deletions
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;
}