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

Walter Erquinigo via lldb-commits lldb-commits at lists.llvm.org
Tue Sep 29 13:09:59 PDT 2020


Author: Walter Erquinigo
Date: 2020-09-29T13:09:52-07:00
New Revision: 92e1ebeaa1fe0e5461327d071c55167733834e60

URL: https://github.com/llvm/llvm-project/commit/92e1ebeaa1fe0e5461327d071c55167733834e60
DIFF: https://github.com/llvm/llvm-project/commit/92e1ebeaa1fe0e5461327d071c55167733834e60.diff

LOG: [trace] Fix destructor declaration

The destructor must be defined in the implementation class so that it
can be called, as Vedant Kumar pointed out in:

'''
What were your thoughts, re:

+class Trace : public PluginInterface {
+public:
+  ~Trace() override = default;

   Does this need to be `virtual ~Trace() = ...`?

      Otherwise, when a std::shared_ptr<Trace> is destroyed, the
      destructor for the derived TraceIntelPT instance won't run.
'''

Added: 
    

Modified: 
    lldb/include/lldb/Target/Trace.h
    lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h

Removed: 
    


################################################################################
diff  --git a/lldb/include/lldb/Target/Trace.h b/lldb/include/lldb/Target/Trace.h
index e4e9b1aa88a7..0aa2da7dbad4 100644
--- a/lldb/include/lldb/Target/Trace.h
+++ b/lldb/include/lldb/Target/Trace.h
@@ -35,8 +35,6 @@ namespace lldb_private {
 /// this information.
 class Trace : public PluginInterface {
 public:
-  ~Trace() override = default;
-
   /// Dump the trace data that this plug-in has access to.
   ///
   /// This function will dump all of the trace data for all threads in a user

diff  --git a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h
index edc781e08ad4..d221caff3c18 100644
--- a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h
+++ b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h
@@ -20,6 +20,8 @@ class TraceIntelPT : public lldb_private::Trace {
 public:
   void Dump(lldb_private::Stream *s) const override;
 
+  ~TraceIntelPT() override = default;
+
   /// PluginInterface protocol
   /// \{
   lldb_private::ConstString GetPluginName() override;


        


More information about the lldb-commits mailing list