diff options
| author | Nagi5Yeq <wu@x-nagi.com> | 2020-05-27 02:08:29 +0800 |
|---|---|---|
| committer | Nagi5Yeq <wu@x-nagi.com> | 2020-05-27 02:08:29 +0800 |
| commit | ba1e3fdd1eea618a38e56918912dc966d1e399a8 (patch) | |
| tree | 0abf1bf045529cc20da9312cbabe32ded31a0103 /node/FunctionNode.cc | |
| parent | e83990754f49ec6eba7b9e1a5ff80a6add5de3a1 (diff) | |
fix array, string, and constant nodes
Diffstat (limited to 'node/FunctionNode.cc')
| -rw-r--r-- | node/FunctionNode.cc | 7 |
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; } |
