diff options
author | Nicholas-Baron <nicholas.baron.ten@gmail.com> | 2021-04-15 10:43:29 -0700 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-04-15 20:57:13 +0200 |
commit | c4ede3854236244fbcefd66b56579c9608ff0664 (patch) | |
tree | 58bf4a4c1973003c398f488589154030bae50d31 /Userland/Libraries/LibX86/Instruction.h | |
parent | b75d2d36e12d4f32c448b4ae352a8b5cc14f00a6 (diff) | |
download | serenity-c4ede3854236244fbcefd66b56579c9608ff0664.zip |
Everything: Add `-Wnon-virtual-dtor` flag
This flag warns on classes which have `virtual` functions but do not
have a `virtual` destructor.
This patch adds both the flag and missing destructors. The access level
of the destructors was determined by a two rules of thumb:
1. A destructor should have a similar or lower access level to that of a
constructor.
2. Having a `private` destructor implicitly deletes the default
constructor, which is probably undesirable for "interface" types
(classes with only virtual functions and no data).
In short, most of the added destructors are `protected`, unless the
compiler complained about access.
Diffstat (limited to 'Userland/Libraries/LibX86/Instruction.h')
-rw-r--r-- | Userland/Libraries/LibX86/Instruction.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Userland/Libraries/LibX86/Instruction.h b/Userland/Libraries/LibX86/Instruction.h index 1c29ce65dd..24473a1754 100644 --- a/Userland/Libraries/LibX86/Instruction.h +++ b/Userland/Libraries/LibX86/Instruction.h @@ -41,6 +41,9 @@ typedef void (Interpreter::*InstructionHandler)(const Instruction&); class SymbolProvider { public: virtual String symbolicate(FlatPtr, u32* offset = nullptr) const = 0; + +protected: + virtual ~SymbolProvider() = default; }; template<typename T> @@ -316,6 +319,9 @@ public: virtual u16 read16() = 0; virtual u32 read32() = 0; virtual u64 read64() = 0; + +protected: + virtual ~InstructionStream() = default; }; class SimpleInstructionStream final : public InstructionStream { |