diff options
author | Lenny Maiorani <lenny@serenityos.org> | 2022-03-23 21:05:02 -0600 |
---|---|---|
committer | Brian Gianforcaro <b.gianfo@gmail.com> | 2022-03-24 20:09:26 -0700 |
commit | dd0593453920a16a45ba2c703c11d44867675c9f (patch) | |
tree | 498f63f76b811d113558c35b3a9e2f53948d6198 /Userland | |
parent | 0b7baa7e5a556f82988ad4f6b39fed8cd38ae9fd (diff) | |
download | serenity-dd0593453920a16a45ba2c703c11d44867675c9f.zip |
Shell: Use default constructors/destructors
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#cother-other-default-operation-rules
"The compiler is more likely to get the default semantics right and
you cannot implement these functions better than the compiler."
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Shell/AST.cpp | 32 | ||||
-rw-r--r-- | Userland/Shell/AST.h | 18 | ||||
-rw-r--r-- | Userland/Shell/Execution.h | 2 | ||||
-rw-r--r-- | Userland/Shell/SyntaxHighlighter.cpp | 4 | ||||
-rw-r--r-- | Userland/Shell/SyntaxHighlighter.h | 4 |
5 files changed, 12 insertions, 48 deletions
diff --git a/Userland/Shell/AST.cpp b/Userland/Shell/AST.cpp index f069b2c5a7..1a29492541 100644 --- a/Userland/Shell/AST.cpp +++ b/Userland/Shell/AST.cpp @@ -408,10 +408,6 @@ Vector<Line::CompletionSuggestion> Node::complete_for_editor(Shell& shell, size_ return Node::complete_for_editor(shell, offset, { nullptr, nullptr, nullptr }); } -Node::~Node() -{ -} - void And::dump(int level) const { Node::dump(level); @@ -463,10 +459,6 @@ And::And(Position position, NonnullRefPtr<Node> left, NonnullRefPtr<Node> right, set_is_syntax_error(m_right->syntax_error_node()); } -And::~And() -{ -} - void ListConcatenate::dump(int level) const { Node::dump(level); @@ -580,10 +572,6 @@ ListConcatenate::ListConcatenate(Position position, Vector<NonnullRefPtr<Node>> } } -ListConcatenate::~ListConcatenate() -{ -} - void Background::dump(int level) const { Node::dump(level); @@ -617,10 +605,6 @@ Background::Background(Position position, NonnullRefPtr<Node> command) set_is_syntax_error(m_command->syntax_error_node()); } -Background::~Background() -{ -} - void BarewordLiteral::dump(int level) const { Node::dump(level); @@ -673,10 +657,6 @@ BarewordLiteral::BarewordLiteral(Position position, String text) { } -BarewordLiteral::~BarewordLiteral() -{ -} - void BraceExpansion::dump(int level) const { Node::dump(level); @@ -732,10 +712,6 @@ BraceExpansion::BraceExpansion(Position position, NonnullRefPtrVector<Node> entr } } -BraceExpansion::~BraceExpansion() -{ -} - void CastToCommand::dump(int level) const { Node::dump(level); @@ -799,10 +775,6 @@ CastToCommand::CastToCommand(Position position, NonnullRefPtr<Node> inner) set_is_syntax_error(m_inner->syntax_error_node()); } -CastToCommand::~CastToCommand() -{ -} - void CastToList::dump(int level) const { Node::dump(level); @@ -865,10 +837,6 @@ CastToList::CastToList(Position position, RefPtr<Node> inner) set_is_syntax_error(m_inner->syntax_error_node()); } -CastToList::~CastToList() -{ -} - void CloseFdRedirection::dump(int level) const { Node::dump(level); diff --git a/Userland/Shell/AST.h b/Userland/Shell/AST.h index eea365db0a..7e9abeec8f 100644 --- a/Userland/Shell/AST.h +++ b/Userland/Shell/AST.h @@ -420,7 +420,7 @@ public: } virtual String class_name() const { return "Node"; } Node(Position); - virtual ~Node(); + virtual ~Node() = default; virtual bool is_bareword() const { return false; } virtual bool is_command() const { return false; } @@ -531,7 +531,7 @@ protected: class And final : public Node { public: And(Position, NonnullRefPtr<Node>, NonnullRefPtr<Node>, Position and_position); - virtual ~And(); + virtual ~And() = default; virtual void visit(NodeVisitor& visitor) override { visitor.visit(this); } const NonnullRefPtr<Node>& left() const { return m_left; } @@ -553,7 +553,7 @@ private: class ListConcatenate final : public Node { public: ListConcatenate(Position, Vector<NonnullRefPtr<Node>>); - virtual ~ListConcatenate(); + virtual ~ListConcatenate() = default; virtual void visit(NodeVisitor& visitor) override { visitor.visit(this); } const Vector<NonnullRefPtr<Node>> list() const { return m_list; } @@ -573,7 +573,7 @@ private: class Background final : public Node { public: Background(Position, NonnullRefPtr<Node>); - virtual ~Background(); + virtual ~Background() = default; virtual void visit(NodeVisitor& visitor) override { visitor.visit(this); } const NonnullRefPtr<Node>& command() const { return m_command; } @@ -591,7 +591,7 @@ private: class BarewordLiteral final : public Node { public: BarewordLiteral(Position, String); - virtual ~BarewordLiteral(); + virtual ~BarewordLiteral() = default; virtual void visit(NodeVisitor& visitor) override { visitor.visit(this); } const String& text() const { return m_text; } @@ -610,7 +610,7 @@ private: class BraceExpansion final : public Node { public: BraceExpansion(Position, NonnullRefPtrVector<Node>); - virtual ~BraceExpansion(); + virtual ~BraceExpansion() = default; virtual void visit(NodeVisitor& visitor) override { visitor.visit(this); } const NonnullRefPtrVector<Node>& entries() const { return m_entries; } @@ -628,7 +628,7 @@ private: class CastToCommand final : public Node { public: CastToCommand(Position, NonnullRefPtr<Node>); - virtual ~CastToCommand(); + virtual ~CastToCommand() = default; virtual void visit(NodeVisitor& visitor) override { visitor.visit(this); } const NonnullRefPtr<Node>& inner() const { return m_inner; } @@ -650,7 +650,7 @@ private: class CastToList final : public Node { public: CastToList(Position, RefPtr<Node>); - virtual ~CastToList(); + virtual ~CastToList() = default; virtual void visit(NodeVisitor& visitor) override { visitor.visit(this); } const RefPtr<Node>& inner() const { return m_inner; } @@ -733,7 +733,7 @@ public: , m_kind(kind) { } - virtual ~ContinuationControl() { } + virtual ~ContinuationControl() = default; virtual void visit(NodeVisitor& visitor) override { visitor.visit(this); } ContinuationKind continuation_kind() const { return m_kind; } diff --git a/Userland/Shell/Execution.h b/Userland/Shell/Execution.h index 47c23a3e09..0437700a30 100644 --- a/Userland/Shell/Execution.h +++ b/Userland/Shell/Execution.h @@ -17,7 +17,7 @@ namespace Shell { class FileDescriptionCollector { public: - FileDescriptionCollector() { } + FileDescriptionCollector() = default; ~FileDescriptionCollector(); void collect(); diff --git a/Userland/Shell/SyntaxHighlighter.cpp b/Userland/Shell/SyntaxHighlighter.cpp index da670e4f84..619fe2429b 100644 --- a/Userland/Shell/SyntaxHighlighter.cpp +++ b/Userland/Shell/SyntaxHighlighter.cpp @@ -581,8 +581,4 @@ bool SyntaxHighlighter::token_types_equal(u64 token0, u64 token1) const return token0 == token1; } -SyntaxHighlighter::~SyntaxHighlighter() -{ -} - } diff --git a/Userland/Shell/SyntaxHighlighter.h b/Userland/Shell/SyntaxHighlighter.h index 5cc860cf4d..b2c7e22510 100644 --- a/Userland/Shell/SyntaxHighlighter.h +++ b/Userland/Shell/SyntaxHighlighter.h @@ -12,8 +12,8 @@ namespace Shell { class SyntaxHighlighter : public Syntax::Highlighter { public: - SyntaxHighlighter() { } - virtual ~SyntaxHighlighter() override; + SyntaxHighlighter() = default; + virtual ~SyntaxHighlighter() override = default; virtual bool is_identifier(u64) const override; virtual bool is_navigatable(u64) const override; |