summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS
diff options
context:
space:
mode:
authorNicholas-Baron <nicholas.baron.ten@gmail.com>2021-04-15 10:43:29 -0700
committerAndreas Kling <kling@serenityos.org>2021-04-15 20:57:13 +0200
commitc4ede3854236244fbcefd66b56579c9608ff0664 (patch)
tree58bf4a4c1973003c398f488589154030bae50d31 /Userland/Libraries/LibJS
parentb75d2d36e12d4f32c448b4ae352a8b5cc14f00a6 (diff)
downloadserenity-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/LibJS')
-rw-r--r--Userland/Libraries/LibJS/Console.h2
-rw-r--r--Userland/Libraries/LibJS/Runtime/Cell.h1
2 files changed, 3 insertions, 0 deletions
diff --git a/Userland/Libraries/LibJS/Console.h b/Userland/Libraries/LibJS/Console.h
index 0782ddf14d..600e14e9a1 100644
--- a/Userland/Libraries/LibJS/Console.h
+++ b/Userland/Libraries/LibJS/Console.h
@@ -93,6 +93,8 @@ public:
virtual Value count_reset() = 0;
protected:
+ virtual ~ConsoleClient() = default;
+
VM& vm();
GlobalObject& global_object() { return m_console.global_object(); }
diff --git a/Userland/Libraries/LibJS/Runtime/Cell.h b/Userland/Libraries/LibJS/Runtime/Cell.h
index df4a19f19a..9927ef2cc6 100644
--- a/Userland/Libraries/LibJS/Runtime/Cell.h
+++ b/Userland/Libraries/LibJS/Runtime/Cell.h
@@ -58,6 +58,7 @@ public:
protected:
virtual void visit_impl(Cell*) = 0;
+ virtual ~Visitor() = default;
};
virtual void visit_edges(Visitor&) { }