AST: Reorder constructors

This commit is contained in:
apio 2022-11-01 22:29:00 +01:00
parent 70f564fe58
commit 9713e9b239
6 changed files with 14 additions and 11 deletions

View File

@ -1,7 +1,7 @@
#include "BinaryOpNode.h"
BinaryOpNode::BinaryOpNode(std::shared_ptr<ExprNode> left, std::shared_ptr<ExprNode> right)
: left(left), right(right), ExprNode()
: ExprNode(), left(left), right(right)
{
}

View File

@ -6,7 +6,7 @@ EmptyFunctionNode::EmptyFunctionNode(FunctionPrototype prototype) : TopLevelNode
{
}
void EmptyFunctionNode::codegen(IRBuilder* generator, llvm::Module* module)
void EmptyFunctionNode::codegen([[maybe_unused]] IRBuilder* generator, llvm::Module* module)
{
llvm::Function* Function = module->getFunction(prototype.name);
if (!Function)

View File

@ -1,6 +1,6 @@
#include "ExprNode.h"
ExprNode::ExprNode(std::shared_ptr<ExprNode> child) : child(child), ASTNode()
ExprNode::ExprNode(std::shared_ptr<ExprNode> child) : ASTNode(), child(child)
{
}

View File

@ -1,6 +1,6 @@
#include "StatementNode.h"
StatementNode::StatementNode(std::shared_ptr<ExprNode> child) : child(child), ASTNode()
StatementNode::StatementNode(std::shared_ptr<ExprNode> child) : ASTNode(), child(child)
{
}

View File

@ -5,7 +5,10 @@
#include "llvm/IR/Function.h"
#include "llvm/IR/InlineAsm.h"
Syscall0Node::Syscall0Node(int syscall_number) : sys_num(syscall_number), ExprNode()
// FIXME: This API is HIGHLY Linux-specific. The right thing to be done should be to expose an inline assembly expression, to do this kind of stuff freely
// depending on the platform in core and any project that wants to use inline assembly, such as an OS kernel or embedded program :^)
Syscall0Node::Syscall0Node(int syscall_number) : ExprNode(), sys_num(syscall_number)
{
}
@ -14,7 +17,7 @@ Syscall0Node::~Syscall0Node()
}
Syscall1Node::Syscall1Node(int syscall_number, std::shared_ptr<ASTNode> arg1)
: sys_num(syscall_number), arg1(arg1), ExprNode()
: ExprNode(), sys_num(syscall_number), arg1(arg1)
{
}
@ -23,7 +26,7 @@ Syscall1Node::~Syscall1Node()
}
Syscall2Node::Syscall2Node(int syscall_number, std::shared_ptr<ASTNode> arg1, std::shared_ptr<ASTNode> arg2)
: sys_num(syscall_number), arg1(arg1), arg2(arg2), ExprNode()
: ExprNode(), sys_num(syscall_number), arg1(arg1), arg2(arg2)
{
}
@ -33,7 +36,7 @@ Syscall2Node::~Syscall2Node()
Syscall3Node::Syscall3Node(int syscall_number, std::shared_ptr<ASTNode> arg1, std::shared_ptr<ASTNode> arg2,
std::shared_ptr<ASTNode> arg3)
: sys_num(syscall_number), arg1(arg1), arg2(arg2), arg3(arg3), ExprNode()
: ExprNode(), sys_num(syscall_number), arg1(arg1), arg2(arg2), arg3(arg3)
{
}
@ -43,7 +46,7 @@ Syscall3Node::~Syscall3Node()
Syscall4Node::Syscall4Node(int syscall_number, std::shared_ptr<ASTNode> arg1, std::shared_ptr<ASTNode> arg2,
std::shared_ptr<ASTNode> arg3, std::shared_ptr<ASTNode> arg4)
: sys_num(syscall_number), arg1(arg1), arg2(arg2), arg3(arg3), arg4(arg4), ExprNode()
: ExprNode(), sys_num(syscall_number), arg1(arg1), arg2(arg2), arg3(arg3), arg4(arg4)
{
}
@ -53,7 +56,7 @@ Syscall4Node::~Syscall4Node()
Syscall5Node::Syscall5Node(int syscall_number, std::shared_ptr<ASTNode> arg1, std::shared_ptr<ASTNode> arg2,
std::shared_ptr<ASTNode> arg3, std::shared_ptr<ASTNode> arg4, std::shared_ptr<ASTNode> arg5)
: sys_num(syscall_number), arg1(arg1), arg2(arg2), arg3(arg3), arg4(arg4), arg5(arg5), ExprNode()
: ExprNode(), sys_num(syscall_number), arg1(arg1), arg2(arg2), arg3(arg3), arg4(arg4), arg5(arg5)
{
}

View File

@ -1,6 +1,6 @@
#include "UnaryOpNode.h"
UnaryOpNode::UnaryOpNode(std::shared_ptr<ExprNode> operand) : operand(operand), ExprNode()
UnaryOpNode::UnaryOpNode(std::shared_ptr<ExprNode> operand) : ExprNode(), operand(operand)
{
}