summaryrefslogtreecommitdiff
path: root/node
diff options
context:
space:
mode:
authorNagi5Yeq <wu@x-nagi.com>2020-06-01 14:06:48 +0800
committerNagi5Yeq <wu@x-nagi.com>2020-06-01 14:06:48 +0800
commit31d35de96576d2cddc134cdd0646ce4966052ae3 (patch)
tree1df4283f87c57e8e1d9e22959f1c389b9f274d62 /node
parent1e993f800921d2a49ad0c71375512a9209347321 (diff)
disable formatv for LLVM release lacks of RTTI support
Diffstat (limited to 'node')
-rw-r--r--node/ExprNode.cc22
-rw-r--r--node/FunctionNode.cc6
-rw-r--r--node/StatementNode.cc6
3 files changed, 17 insertions, 17 deletions
diff --git a/node/ExprNode.cc b/node/ExprNode.cc
index d785534..e75eda5 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 {0} is not a valid pointer type, this lvalue can't be loaded",
+ "type %s 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 {0} is not a valid type for pointer access operator[]",
+ "type %s 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 {0} is not a valid type for array access operator[]",
+ "type %s 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 {0} is not a valid lvalue type for array access operator[]",
+ "type %s 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 {0} is not a valid type for dereference",
+ Log(LogLevel::PCC_ERROR, "type %s 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 {0} is not a valid type for member access",
+ "type %s 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 {0} is not a record type",
+ Log(LogLevel::PCC_ERROR, "type %s 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 {0}",
+ Log(LogLevel::PCC_ERROR, "call to undefined function %s",
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, {0} wanted, {1} given", ArgTypes.size(),
+ "argument number mismatch, %d wanted, %d 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 {0}, an argument "
- "of type {1} needed",
+ "argument type mismatch, the function type is %s, an argument "
+ "of type %s needed",
type->GetCommonName(), ArgType->GetCommonName());
}
*ArgValueIt = ConvertedArgv;
diff --git a/node/FunctionNode.cc b/node/FunctionNode.cc
index 0dcafb1..4fb5138 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 {0} of type {1}", name_,
+ Log(LogLevel::PCC_INFO, "generating function %s of type %s", name_.c_str(),
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_WARNING, "{0}", msg);
+ Log(LogLevel::PCC_INFO, "%s", msg.c_str());
}
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 {0} of type {1}", name_,
+ Log(LogLevel::PCC_INFO, "extern function %s of type %s", name_.c_str(),
type->GetCommonName());
return nullptr;
}
diff --git a/node/StatementNode.cc b/node/StatementNode.cc
index 40c07af..07babe2 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 {0} is not a valid pointer type, can't store anything into "
+ "type %s 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 {0} is not a valid pointer type, can't store anything into "
+ "type %s 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 {0}",
+ "loop variable should have a integer-like type, not %s",
LoopPointer->GetElementType()->GetCommonName());
return nullptr;
}