[Lldb-commits] [lldb] 7d1bf1c - [LLDB][NFC] Move some constructors to their cpp file

walter erquinigo via lldb-commits lldb-commits at lists.llvm.org
Tue Oct 17 15:51:06 PDT 2023


Author: walter erquinigo
Date: 2023-10-17T18:50:18-04:00
New Revision: 7d1bf1c5cf284ce1a18fe0ce4a4cf91f3e514866

URL: https://github.com/llvm/llvm-project/commit/7d1bf1c5cf284ce1a18fe0ce4a4cf91f3e514866
DIFF: https://github.com/llvm/llvm-project/commit/7d1bf1c5cf284ce1a18fe0ce4a4cf91f3e514866.diff

LOG: [LLDB][NFC] Move some constructors to their cpp file

CompilerType constructors rely on the NDEBUG macro, so it's better to move them to their cpp file so that the header doesn't get confused when this macro is used differently for other compilation units.

Added: 
    

Modified: 
    lldb/include/lldb/Symbol/CompilerType.h
    lldb/source/Symbol/CompilerType.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/include/lldb/Symbol/CompilerType.h b/lldb/include/lldb/Symbol/CompilerType.h
index 414db18e52ed71c..0a9533a1ac0efc1 100644
--- a/lldb/include/lldb/Symbol/CompilerType.h
+++ b/lldb/include/lldb/Symbol/CompilerType.h
@@ -42,10 +42,7 @@ class CompilerType {
   ///
   /// \see lldb_private::TypeSystemClang::GetType(clang::QualType)
   CompilerType(lldb::TypeSystemWP type_system,
-               lldb::opaque_compiler_type_t type)
-    : m_type_system(type_system), m_type(type) {
-    assert(Verify() && "verification failed");
-  }
+               lldb::opaque_compiler_type_t type);
 
   /// This is a minimal wrapper of a TypeSystem shared pointer as
   /// returned by CompilerType which conventien dyn_cast support.
@@ -88,10 +85,8 @@ class CompilerType {
     lldb::TypeSystemSP GetSharedPointer() const { return m_typesystem_sp; }
   };
 
-  CompilerType(TypeSystemSPWrapper type_system, lldb::opaque_compiler_type_t type)
-    : m_type_system(type_system.GetSharedPointer()), m_type(type) {
-    assert(Verify() && "verification failed");
-  }
+  CompilerType(TypeSystemSPWrapper type_system,
+               lldb::opaque_compiler_type_t type);
 
   CompilerType(const CompilerType &rhs)
       : m_type_system(rhs.m_type_system), m_type(rhs.m_type) {}

diff  --git a/lldb/source/Symbol/CompilerType.cpp b/lldb/source/Symbol/CompilerType.cpp
index 7732a66f49d8dbb..78cc8dad94a9c5f 100644
--- a/lldb/source/Symbol/CompilerType.cpp
+++ b/lldb/source/Symbol/CompilerType.cpp
@@ -951,6 +951,18 @@ bool CompilerType::GetValueAsScalar(const lldb_private::DataExtractor &data,
   return false;
 }
 
+CompilerType::CompilerType(CompilerType::TypeSystemSPWrapper type_system,
+                           lldb::opaque_compiler_type_t type)
+    : m_type_system(type_system.GetSharedPointer()), m_type(type) {
+  assert(Verify() && "verification failed");
+}
+
+CompilerType::CompilerType(lldb::TypeSystemWP type_system,
+                           lldb::opaque_compiler_type_t type)
+    : m_type_system(type_system), m_type(type) {
+  assert(Verify() && "verification failed");
+}
+
 #ifndef NDEBUG
 bool CompilerType::Verify() const {
   if (!IsValid())


        


More information about the lldb-commits mailing list