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:
Daniel Bertalan 2025-05-12 15:18:18 +02:00 committed by Andrew Kaster
commit 6b08a52c8b
Notes: github-actions[bot] 2025-05-12 17:42:01 +00:00
3 changed files with 3 additions and 3 deletions

View file

@ -42,7 +42,7 @@ public:
{
}
virtual ~ConservativeVector() = default;
~ConservativeVector() = default;
ConservativeVector(ConservativeVector const& other)
: ConservativeVectorBase(*other.m_heap)

View file

@ -45,7 +45,7 @@ public:
{
}
virtual ~RootHashMap() = default;
~RootHashMap() = default;
virtual void gather_roots(HashMap<Cell*, GC::HeapRoot>& roots) const override
{

View file

@ -46,7 +46,7 @@ public:
{
}
virtual ~RootVector() = default;
~RootVector() = default;
RootVector(Heap& heap, ReadonlySpan<T> other)
: RootVectorBase(heap)