diff options
Diffstat (limited to 'node')
| -rw-r--r-- | node/ExprNode.cc | 22 | ||||
| -rw-r--r-- | node/FunctionNode.cc | 6 | ||||
| -rw-r--r-- | node/Node.hh | 2 | ||||
| -rw-r--r-- | node/StatementNode.cc | 6 |
4 files changed, 18 insertions, 18 deletions
diff --git a/node/ExprNode.cc b/node/ExprNode.cc index e75eda5..d785534 100644 --- a/node/ExprNode.cc +++ b/node/ExprNode.cc @@ -66,7 +66,7 @@ Value L2RCastingNode::CodeGen() { std::dynamic_pointer_cast<PointerType>(lvalue_->GetType()); if (type == nullptr) { Log(LogLevel::PCC_ERROR, - "type %s is not a valid pointer type, this lvalue can't be loaded", + "type {0} is not a valid pointer type, this lvalue can't be loaded", lvalue_->GetType()->GetCommonName()); } type_ = type->GetElementType(); @@ -87,7 +87,7 @@ Value PointerAccessNode::CodeGen() { std::dynamic_pointer_cast<PointerType>(lhs_->GetType()); if (pointer == nullptr) { Log(LogLevel::PCC_ERROR, - "type %s is not a valid type for pointer access operator[]", + "type {0} is not a valid type for pointer access operator[]", lhs_->GetType()->GetCommonName()); return nullptr; } @@ -114,7 +114,7 @@ Value ArrayAccessNode::CodeGen() { std::shared_ptr<Type> RightType = rhs_->GetType(); if (LeftType == nullptr) { Log(LogLevel::PCC_ERROR, - "type %s is not a valid type for array access operator[]", + "type {0} is not a valid type for array access operator[]", lhs_->GetType()->GetCommonName()); return nullptr; } @@ -147,7 +147,7 @@ Value ArrayAccessNode::CodeGen() { return builder->CreateInBoundsGEP(PointerValue, CastedRight); } Log(LogLevel::PCC_ERROR, - "type %s is not a valid lvalue type for array access operator[]", + "type {0} is not a valid lvalue type for array access operator[]", lhs_->GetType()->GetCommonName()); return nullptr; } @@ -162,7 +162,7 @@ Value DereferenceNode::CodeGen() { std::shared_ptr<PointerType> pointer = std::dynamic_pointer_cast<PointerType>(lhs_->GetType()); if (pointer == nullptr) { - Log(LogLevel::PCC_ERROR, "type %s is not a valid type for dereference", + Log(LogLevel::PCC_ERROR, "type {0} is not a valid type for dereference", lhs_->GetType()->GetCommonName()); return nullptr; } @@ -187,14 +187,14 @@ Value MemberAccessNode::CodeGen() { std::dynamic_pointer_cast<PointerType>(lhs_->GetType()); if (LeftType == nullptr) { Log(LogLevel::PCC_ERROR, - "type %s is not a valid type for member access", + "type {0} is not a valid type for member access", lhs_->GetType()->GetCommonName()); return nullptr; } std::shared_ptr<RecordType> LeftInner = std::dynamic_pointer_cast<RecordType>(LeftType->GetElementType()); if (LeftInner == nullptr) { - Log(LogLevel::PCC_ERROR, "type %s is not a record type", + Log(LogLevel::PCC_ERROR, "type {0} is not a record type", LeftType->GetElementType()->GetCommonName()); return nullptr; } @@ -229,14 +229,14 @@ Value FunctionCallNode::CodeGen() { Function function = context_->FindFunction(name_); std::shared_ptr<FunctionType> type = std::get<0>(function); if (type == nullptr) { - Log(LogLevel::PCC_ERROR, "call to undefined function %s", + Log(LogLevel::PCC_ERROR, "call to undefined function {0}", name_.c_str()); return nullptr; } const std::vector<std::shared_ptr<Type>>& ArgTypes = type->GetArgTypes(); if (type->IsVariadic() == false && ArgTypes.size() != args_.size()) { Log(LogLevel ::PCC_ERROR, - "argument number mismatch, %d wanted, %d given", ArgTypes.size(), + "argument number mismatch, {0} wanted, {1} given", ArgTypes.size(), args_.size()); return nullptr; } @@ -249,8 +249,8 @@ Value FunctionCallNode::CodeGen() { manager->CreateCast(ArgType, (*ArgIt)->GetType(), argv, context_); if (ConvertedArgv == nullptr) { Log(LogLevel ::PCC_ERROR, - "argument type mismatch, the function type is %s, an argument " - "of type %s needed", + "argument type mismatch, the function type is {0}, an argument " + "of type {1} needed", type->GetCommonName(), ArgType->GetCommonName()); } *ArgValueIt = ConvertedArgv; diff --git a/node/FunctionNode.cc b/node/FunctionNode.cc index 4fb5138..e2ab18f 100644 --- a/node/FunctionNode.cc +++ b/node/FunctionNode.cc @@ -47,7 +47,7 @@ Value FunctionNode::CodeGen() { context_->AddFunction(name_, {type, function}); llvm::BasicBlock* block = llvm::BasicBlock::Create(GlobalLLVMContext, name_, function); - Log(LogLevel::PCC_INFO, "generating function %s of type %s", name_.c_str(), + Log(LogLevel::PCC_INFO, "generating function {0} of type {0}", name_, type->GetCommonName()); builder->SetInsertPoint(block); context_->PushScope(&locals_); @@ -86,7 +86,7 @@ Value FunctionNode::CodeGen() { llvm::verifyFunction(*function, &MsgStream); MsgStream.flush(); if (!msg.empty()) { - Log(LogLevel::PCC_INFO, "%s", msg.c_str()); + Log(LogLevel::PCC_WARNING, "{0}", msg); } return nullptr; } @@ -117,7 +117,7 @@ Value ExternNode::CodeGen() { llvm::Function* function = llvm::cast<llvm::Function>(callee.getCallee()); function->setCallingConv(llvm::CallingConv::C); context_->AddFunction(name_, {type, function}); - Log(LogLevel::PCC_INFO, "extern function %s of type %s", name_.c_str(), + Log(LogLevel::PCC_INFO, "extern function {0} of type {1}", name_, type->GetCommonName()); return nullptr; } diff --git a/node/Node.hh b/node/Node.hh index c75126c..343f763 100644 --- a/node/Node.hh +++ b/node/Node.hh @@ -4,8 +4,8 @@ #include "BaseNode.hh" #include "DeclNode.hh" #include "ExprNode.hh" +#include "FunctionNode.hh" #include "LiteralNode.hh" #include "StatementNode.hh" -#include "FunctionNode.hh" #endif // !PCC_NODE_H diff --git a/node/StatementNode.cc b/node/StatementNode.cc index 07babe2..40c07af 100644 --- a/node/StatementNode.cc +++ b/node/StatementNode.cc @@ -36,7 +36,7 @@ Value AssignStatementNode::CodeGen() { std::dynamic_pointer_cast<PointerType>(lhs_->GetType()); if (LeftType == nullptr) { Log(LogLevel::PCC_ERROR, - "type %s is not a valid pointer type, can't store anything into " + "type {0} is not a valid pointer type, can't store anything into " "this lvalue", lhs_->GetType()->GetCommonName()); return nullptr; @@ -212,7 +212,7 @@ Value ForStatementNode::CodeGen() { std::dynamic_pointer_cast<PointerType>(variable_->GetType()); if (LoopPointer == nullptr) { Log(LogLevel::PCC_ERROR, - "type %s is not a valid pointer type, can't store anything into " + "type {0} is not a valid pointer type, can't store anything into " "this lvalue", variable_->GetType()->GetCommonName()); return nullptr; @@ -222,7 +222,7 @@ Value ForStatementNode::CodeGen() { LoopPointer->GetElementType()); if (LoopType == nullptr) { Log(LogLevel::PCC_ERROR, - "loop variable should have a integer-like type, not %s", + "loop variable should have a integer-like type, not {0}", LoopPointer->GetElementType()->GetCommonName()); return nullptr; } |
