From 9713e9b239058842a96a2723fe9c3743b0f4a01d Mon Sep 17 00:00:00 2001 From: apio Date: Tue, 1 Nov 2022 22:29:00 +0100 Subject: [PATCH] AST: Reorder constructors --- src/AST/BinaryOpNode.cpp | 2 +- src/AST/EmptyFunctionNode.cpp | 2 +- src/AST/ExprNode.cpp | 2 +- src/AST/StatementNode.cpp | 2 +- src/AST/SyscallNode.cpp | 15 +++++++++------ src/AST/UnaryOpNode.cpp | 2 +- 6 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/AST/BinaryOpNode.cpp b/src/AST/BinaryOpNode.cpp index c410af1..48b23b2 100644 --- a/src/AST/BinaryOpNode.cpp +++ b/src/AST/BinaryOpNode.cpp @@ -1,7 +1,7 @@ #include "BinaryOpNode.h" BinaryOpNode::BinaryOpNode(std::shared_ptr left, std::shared_ptr right) - : left(left), right(right), ExprNode() + : ExprNode(), left(left), right(right) { } diff --git a/src/AST/EmptyFunctionNode.cpp b/src/AST/EmptyFunctionNode.cpp index c64d672..9bfe771 100644 --- a/src/AST/EmptyFunctionNode.cpp +++ b/src/AST/EmptyFunctionNode.cpp @@ -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) diff --git a/src/AST/ExprNode.cpp b/src/AST/ExprNode.cpp index 281c985..d5e29b4 100644 --- a/src/AST/ExprNode.cpp +++ b/src/AST/ExprNode.cpp @@ -1,6 +1,6 @@ #include "ExprNode.h" -ExprNode::ExprNode(std::shared_ptr child) : child(child), ASTNode() +ExprNode::ExprNode(std::shared_ptr child) : ASTNode(), child(child) { } diff --git a/src/AST/StatementNode.cpp b/src/AST/StatementNode.cpp index 3bfa61c..b928537 100644 --- a/src/AST/StatementNode.cpp +++ b/src/AST/StatementNode.cpp @@ -1,6 +1,6 @@ #include "StatementNode.h" -StatementNode::StatementNode(std::shared_ptr child) : child(child), ASTNode() +StatementNode::StatementNode(std::shared_ptr child) : ASTNode(), child(child) { } diff --git a/src/AST/SyscallNode.cpp b/src/AST/SyscallNode.cpp index 985d4e1..5eb309f 100644 --- a/src/AST/SyscallNode.cpp +++ b/src/AST/SyscallNode.cpp @@ -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 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 arg1, std::shared_ptr 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 arg1, std::shared_ptr arg2, std::shared_ptr 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 arg1, std::shared_ptr arg2, std::shared_ptr arg3, std::shared_ptr 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 arg1, std::shared_ptr arg2, std::shared_ptr arg3, std::shared_ptr arg4, std::shared_ptr 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) { } diff --git a/src/AST/UnaryOpNode.cpp b/src/AST/UnaryOpNode.cpp index 1a0b67e..e4db829 100644 --- a/src/AST/UnaryOpNode.cpp +++ b/src/AST/UnaryOpNode.cpp @@ -1,6 +1,6 @@ #include "UnaryOpNode.h" -UnaryOpNode::UnaryOpNode(std::shared_ptr operand) : operand(operand), ExprNode() +UnaryOpNode::UnaryOpNode(std::shared_ptr operand) : ExprNode(), operand(operand) { }