[Lldb-commits] [PATCH] D147252: [lldb][NFC] Move various constructor definitions from .h to .cpp

River Riddle via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Mar 30 11:44:01 PDT 2023


rriddle created this revision.
Herald added a subscriber: bollu.
Herald added a project: All.
rriddle requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

I ran into issues with linking downstream language plugin to liblldb in
debug builds, hitting link time errors of form:

  undefined reference to `vtable for  lldb_private::<Insert LLDB class here>'

Anchoring the vtable to the .cpp files resolved those issues.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D147252

Files:
  lldb/include/lldb/Expression/ExpressionVariable.h
  lldb/include/lldb/Expression/Materializer.h
  lldb/include/lldb/Symbol/TypeSystem.h
  lldb/source/Expression/ExpressionVariable.cpp
  lldb/source/Expression/Materializer.cpp
  lldb/source/Symbol/TypeSystem.cpp


Index: lldb/source/Symbol/TypeSystem.cpp
===================================================================
--- lldb/source/Symbol/TypeSystem.cpp
+++ lldb/source/Symbol/TypeSystem.cpp
@@ -36,6 +36,7 @@
 bool LanguageSet::Empty() const { return bitvector.none(); }
 bool LanguageSet::operator[](unsigned i) const { return bitvector[i]; }
 
+TypeSystem::TypeSystem() = default;
 TypeSystem::~TypeSystem() = default;
 
 static TypeSystemSP CreateInstanceHelper(lldb::LanguageType language,
Index: lldb/source/Expression/Materializer.cpp
===================================================================
--- lldb/source/Expression/Materializer.cpp
+++ lldb/source/Expression/Materializer.cpp
@@ -1598,5 +1598,7 @@
   m_process_address = LLDB_INVALID_ADDRESS;
 }
 
+Materializer::PersistentVariableDelegate::PersistentVariableDelegate() =
+    default;
 Materializer::PersistentVariableDelegate::~PersistentVariableDelegate() =
     default;
Index: lldb/source/Expression/ExpressionVariable.cpp
===================================================================
--- lldb/source/Expression/ExpressionVariable.cpp
+++ lldb/source/Expression/ExpressionVariable.cpp
@@ -15,6 +15,8 @@
 
 using namespace lldb_private;
 
+ExpressionVariable::ExpressionVariable(LLVMCastKind kind)
+    : m_flags(0), m_kind(kind) {}
 ExpressionVariable::~ExpressionVariable() = default;
 
 uint8_t *ExpressionVariable::GetValueBytes() {
@@ -30,6 +32,8 @@
   return nullptr;
 }
 
+PersistentExpressionState::PersistentExpressionState(LLVMCastKind kind)
+    : m_kind(kind) {}
 PersistentExpressionState::~PersistentExpressionState() = default;
 
 lldb::addr_t PersistentExpressionState::LookupSymbol(ConstString name) {
Index: lldb/include/lldb/Symbol/TypeSystem.h
===================================================================
--- lldb/include/lldb/Symbol/TypeSystem.h
+++ lldb/include/lldb/Symbol/TypeSystem.h
@@ -77,6 +77,7 @@
                    public std::enable_shared_from_this<TypeSystem> {
 public:
   // Constructors and Destructors
+  TypeSystem();
   ~TypeSystem() override;
 
   // LLVM RTTI support
Index: lldb/include/lldb/Expression/Materializer.h
===================================================================
--- lldb/include/lldb/Expression/Materializer.h
+++ lldb/include/lldb/Expression/Materializer.h
@@ -69,6 +69,7 @@
 
   class PersistentVariableDelegate {
   public:
+    PersistentVariableDelegate();
     virtual ~PersistentVariableDelegate();
     virtual ConstString GetName() = 0;
     virtual void DidDematerialize(lldb::ExpressionVariableSP &variable) = 0;
Index: lldb/include/lldb/Expression/ExpressionVariable.h
===================================================================
--- lldb/include/lldb/Expression/ExpressionVariable.h
+++ lldb/include/lldb/Expression/ExpressionVariable.h
@@ -29,8 +29,7 @@
 
   LLVMCastKind getKind() const { return m_kind; }
 
-  ExpressionVariable(LLVMCastKind kind) : m_flags(0), m_kind(kind) {}
-
+  ExpressionVariable(LLVMCastKind kind);
   virtual ~ExpressionVariable();
 
   std::optional<uint64_t> GetByteSize() { return m_frozen_sp->GetByteSize(); }
@@ -208,8 +207,7 @@
 
   LLVMCastKind getKind() const { return m_kind; }
 
-  PersistentExpressionState(LLVMCastKind kind) : m_kind(kind) {}
-
+  PersistentExpressionState(LLVMCastKind kind);
   virtual ~PersistentExpressionState();
 
   virtual lldb::ExpressionVariableSP


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147252.509758.patch
Type: text/x-patch
Size: 3384 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230330/3aab1d4a/attachment-0001.bin>


More information about the lldb-commits mailing list