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

2020-10-03 Thread Walter Erquinigo via lldb-commits
But what about the case Vedant mentioned?

>Otherwise, when a std::shared_ptr 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? 

On 9/30/20, 5:56 AM, "Pavel Labath"  wrote:

On 29/09/2020 22:09, Walter Erquinigo via lldb-commits wrote:
> The destructor must be defined in the implementation class so that it
> can be called

That doesn't sound right. Each class automatically gets a destructor if
it does not declare one itself. "~Foo() override = default" is
completely equivalent to omitting the destructor completely, if the base
destructor is virtual (which is true in this case, because the classes
inherit from PluginInterface).

pl

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


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

2020-10-01 Thread Pavel Labath via lldb-commits
On 30/09/2020 20:25, Walter Erquinigo wrote:
> But what about the case Vedant mentioned?
> 
>>Otherwise, when a std::shared_ptr 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
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


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

2020-09-30 Thread Pavel Labath via lldb-commits
On 29/09/2020 22:09, Walter Erquinigo via lldb-commits wrote:
> The destructor must be defined in the implementation class so that it
> can be called

That doesn't sound right. Each class automatically gets a destructor if
it does not declare one itself. "~Foo() override = default" is
completely equivalent to omitting the destructor completely, if the base
destructor is virtual (which is true in this case, because the classes
inherit from PluginInterface).

pl
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits