[Lldb-commits] [lldb] r355569 - Promote more debug-only assertions to regular assertions.

Adrian Prantl via lldb-commits lldb-commits at lists.llvm.org
Wed Mar 6 16:14:20 PST 2019


Author: adrian
Date: Wed Mar  6 16:14:20 2019
New Revision: 355569

URL: http://llvm.org/viewvc/llvm-project?rev=355569&view=rev
Log:
Promote more debug-only assertions to regular assertions.

Modified:
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
    lldb/trunk/source/Symbol/CompilerType.cpp
    lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp
    lldb/trunk/source/Symbol/LineTable.cpp
    lldb/trunk/source/Utility/DataExtractor.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=355569&r1=355568&r2=355569&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Wed Mar  6 16:14:20 2019
@@ -2843,7 +2843,7 @@ bool SymbolFileDWARF::DIEDeclContextsMat
     if (decl_ctx_die1.Tag() != decl_ctx_die2.Tag())
       return false;
   }
-#if defined LLDB_CONFIGURATION_DEBUG
+#ifndef NDEBUG
 
   // Make sure the top item in the decl context die array is always
   // DW_TAG_compile_unit or DW_TAG_partial_unit. If it isn't then

Modified: lldb/trunk/source/Symbol/CompilerType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/CompilerType.cpp?rev=355569&r1=355568&r2=355569&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/CompilerType.cpp (original)
+++ lldb/trunk/source/Symbol/CompilerType.cpp Wed Mar  6 16:14:20 2019
@@ -35,10 +35,8 @@ CompilerType::CompilerType(TypeSystem *t
 CompilerType::CompilerType(clang::ASTContext *ast, clang::QualType qual_type)
     : m_type(qual_type.getAsOpaquePtr()),
       m_type_system(ClangASTContext::GetASTContext(ast)) {
-#ifdef LLDB_CONFIGURATION_DEBUG
   if (m_type)
     assert(m_type_system != nullptr);
-#endif
 }
 
 CompilerType::~CompilerType() {}

Modified: lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp?rev=355569&r1=355568&r2=355569&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp (original)
+++ lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp Wed Mar  6 16:14:20 2019
@@ -40,9 +40,7 @@ GetGNUEHPointer(const DataExtractor &DE,
   uint64_t baseAddress = 0;
   uint64_t addressValue = 0;
   const uint32_t addr_size = DE.GetAddressByteSize();
-#ifdef LLDB_CONFIGURATION_DEBUG
   assert(addr_size == 4 || addr_size == 8);
-#endif
 
   bool signExtendValue = false;
   // Decode the base part or adjust our offset

Modified: lldb/trunk/source/Symbol/LineTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/LineTable.cpp?rev=355569&r1=355568&r2=355569&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/LineTable.cpp (original)
+++ lldb/trunk/source/Symbol/LineTable.cpp Wed Mar  6 16:14:20 2019
@@ -125,7 +125,7 @@ void LineTable::InsertSequence(LineSeque
       pos++;
   }
 
-#ifdef LLDB_CONFIGURATION_DEBUG
+#ifndef NDEBUG
   // If we aren't inserting at the beginning, the previous entry should
   // terminate a sequence.
   if (pos != begin_pos) {

Modified: lldb/trunk/source/Utility/DataExtractor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/DataExtractor.cpp?rev=355569&r1=355568&r2=355569&view=diff
==============================================================================
--- lldb/trunk/source/Utility/DataExtractor.cpp (original)
+++ lldb/trunk/source/Utility/DataExtractor.cpp Wed Mar  6 16:14:20 2019
@@ -136,9 +136,7 @@ DataExtractor::DataExtractor(const void
             length),
       m_byte_order(endian), m_addr_size(addr_size), m_data_sp(),
       m_target_byte_size(target_byte_size) {
-#ifdef LLDB_CONFIGURATION_DEBUG
   assert(addr_size == 4 || addr_size == 8);
-#endif
 }
 
 //----------------------------------------------------------------------
@@ -153,9 +151,7 @@ DataExtractor::DataExtractor(const DataB
     : m_start(nullptr), m_end(nullptr), m_byte_order(endian),
       m_addr_size(addr_size), m_data_sp(),
       m_target_byte_size(target_byte_size) {
-#ifdef LLDB_CONFIGURATION_DEBUG
   assert(addr_size == 4 || addr_size == 8);
-#endif
   SetData(data_sp);
 }
 
@@ -171,9 +167,7 @@ DataExtractor::DataExtractor(const DataE
     : m_start(nullptr), m_end(nullptr), m_byte_order(data.m_byte_order),
       m_addr_size(data.m_addr_size), m_data_sp(),
       m_target_byte_size(target_byte_size) {
-#ifdef LLDB_CONFIGURATION_DEBUG
   assert(m_addr_size == 4 || m_addr_size == 8);
-#endif
   if (data.ValidOffset(offset)) {
     offset_t bytes_available = data.GetByteSize() - offset;
     if (length > bytes_available)
@@ -186,9 +180,7 @@ DataExtractor::DataExtractor(const DataE
     : m_start(rhs.m_start), m_end(rhs.m_end), m_byte_order(rhs.m_byte_order),
       m_addr_size(rhs.m_addr_size), m_data_sp(rhs.m_data_sp),
       m_target_byte_size(rhs.m_target_byte_size) {
-#ifdef LLDB_CONFIGURATION_DEBUG
   assert(m_addr_size == 4 || m_addr_size == 8);
-#endif
 }
 
 //----------------------------------------------------------------------
@@ -276,9 +268,7 @@ lldb::offset_t DataExtractor::SetData(co
                                       offset_t data_offset,
                                       offset_t data_length) {
   m_addr_size = data.m_addr_size;
-#ifdef LLDB_CONFIGURATION_DEBUG
   assert(m_addr_size == 4 || m_addr_size == 8);
-#endif
   // If "data" contains shared pointer to data, then we can use that
   if (data.m_data_sp) {
     m_byte_order = data.m_byte_order;
@@ -706,16 +696,12 @@ long double DataExtractor::GetLongDouble
 // RETURNS the address that was extracted, or zero on failure.
 //------------------------------------------------------------------
 uint64_t DataExtractor::GetAddress(offset_t *offset_ptr) const {
-#ifdef LLDB_CONFIGURATION_DEBUG
   assert(m_addr_size == 4 || m_addr_size == 8);
-#endif
   return GetMaxU64(offset_ptr, m_addr_size);
 }
 
 uint64_t DataExtractor::GetAddress_unchecked(offset_t *offset_ptr) const {
-#ifdef LLDB_CONFIGURATION_DEBUG
   assert(m_addr_size == 4 || m_addr_size == 8);
-#endif
   return GetMaxU64_unchecked(offset_ptr, m_addr_size);
 }
 
@@ -728,9 +714,7 @@ uint64_t DataExtractor::GetAddress_unche
 // RETURNS the pointer that was extracted, or zero on failure.
 //------------------------------------------------------------------
 uint64_t DataExtractor::GetPointer(offset_t *offset_ptr) const {
-#ifdef LLDB_CONFIGURATION_DEBUG
   assert(m_addr_size == 4 || m_addr_size == 8);
-#endif
   return GetMaxU64(offset_ptr, m_addr_size);
 }
 




More information about the lldb-commits mailing list