mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-29 13:46:31 +00:00
LibGC: Make destructors non-virtual where possible
`ConservativeVector`, `RootVector` and `RootHashMap` are final types, and their base classes have a protected destructor, so when their destructor is called, the static and dynamic types will be the same (can't destruct them through a pointer to a base or derived class). Therefore, there is no need for a virtual destructor. This fixes the newly introduced `-Wunnecessary-virtual-specifier` Clang warning (llvm/llvm-project#131188).
This commit is contained in:
parent
c48a78e37f
commit
6b08a52c8b
Notes:
github-actions[bot]
2025-05-12 17:42:01 +00:00
Author: https://github.com/BertalanD
Commit: 6b08a52c8b
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4703
Reviewed-by: https://github.com/ADKaster ✅
3 changed files with 3 additions and 3 deletions
|
@ -42,7 +42,7 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~ConservativeVector() = default;
|
~ConservativeVector() = default;
|
||||||
|
|
||||||
ConservativeVector(ConservativeVector const& other)
|
ConservativeVector(ConservativeVector const& other)
|
||||||
: ConservativeVectorBase(*other.m_heap)
|
: ConservativeVectorBase(*other.m_heap)
|
||||||
|
|
|
@ -45,7 +45,7 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~RootHashMap() = default;
|
~RootHashMap() = default;
|
||||||
|
|
||||||
virtual void gather_roots(HashMap<Cell*, GC::HeapRoot>& roots) const override
|
virtual void gather_roots(HashMap<Cell*, GC::HeapRoot>& roots) const override
|
||||||
{
|
{
|
||||||
|
|
|
@ -46,7 +46,7 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~RootVector() = default;
|
~RootVector() = default;
|
||||||
|
|
||||||
RootVector(Heap& heap, ReadonlySpan<T> other)
|
RootVector(Heap& heap, ReadonlySpan<T> other)
|
||||||
: RootVectorBase(heap)
|
: RootVectorBase(heap)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue