[Lldb-commits] [lldb] 92e1ebe - [trace] Fix destructor declaration

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Thu Oct 1 05:46:32 PDT 2020


On 30/09/2020 20:25, Walter Erquinigo wrote:
> But what about the case Vedant mentioned?
> 
>>    Otherwise, when a std::shared_ptr<Trace> is destroyed, the destructor for the derived TraceIntelPT instance won't run.
> 
> Or is C++ smart enough to pick the destructor from TraceIntelPT class in this case? 

Well, yes. Once a base class has a virtual distructor, the destructors
of all derived classes will be virtual (no matter how they are
declared). The virtualness guarantees that the destructor of the actual
(runtime) class type gets invoked.

pl


More information about the lldb-commits mailing list