This revision was automatically updated to reflect the committed changes.
Closed by commit rL291895: Remove a couple of Stream flags (authored by labath).

Changed prior to commit:
  https://reviews.llvm.org/D28616?vs=84143&id=84267#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D28616

Files:
  lldb/trunk/include/lldb/Core/Stream.h
  lldb/trunk/source/Core/Log.cpp
  lldb/trunk/source/Core/SearchFilter.cpp
  lldb/trunk/source/Core/Stream.cpp
  lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
  lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
  lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
  lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp
  lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
  lldb/trunk/source/Symbol/Declaration.cpp

Index: lldb/trunk/source/Symbol/Declaration.cpp
===================================================================
--- lldb/trunk/source/Symbol/Declaration.cpp
+++ lldb/trunk/source/Symbol/Declaration.cpp
@@ -42,7 +42,7 @@
 
 bool Declaration::DumpStopContext(Stream *s, bool show_fullpaths) const {
   if (m_file) {
-    if (show_fullpaths || s->GetVerbose())
+    if (show_fullpaths)
       *s << m_file;
     else
       m_file.GetFilename().Dump(s);
Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
===================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
@@ -430,10 +430,6 @@
       } else {
         // See if the DIE is in this compile unit?
         if (cu && dumpInfo->die_offset < cu->GetNextCompileUnitOffset()) {
-          // This DIE is in this compile unit!
-          if (s->GetVerbose())
-            cu->Dump(s); // Dump the compile unit for the DIE in verbose mode
-
           return next_offset;
           //  // We found our compile unit that contains our DIE, just skip to
           //  dumping the requested DIE...
Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
===================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
@@ -324,11 +324,8 @@
   bool abbr_offset_OK =
       m_dwarf2Data->get_debug_abbrev_data().ValidOffset(GetAbbrevOffset());
   bool addr_size_OK = ((m_addr_size == 4) || (m_addr_size == 8));
-  bool verbose = s->GetVerbose();
   if (valid_offset && length_OK && version_OK && addr_size_OK &&
       abbr_offset_OK) {
-    if (verbose)
-      s->Printf("    0x%8.8x: OK\n", m_offset);
     return true;
   } else {
     s->Printf("    0x%8.8x: ", m_offset);
Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
===================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
@@ -406,8 +406,6 @@
   uint64_t uvalue = Unsigned();
   bool cu_relative_offset = false;
 
-  bool verbose = s.GetVerbose();
-
   switch (m_form) {
   case DW_FORM_addr:
     s.Address(uvalue, sizeof(uint64_t));
@@ -476,8 +474,6 @@
   case DW_FORM_strp: {
     const char *dbg_str = AsCString();
     if (dbg_str) {
-      if (verbose)
-        s.Printf(" .debug_str[0x%8.8x] = ", (uint32_t)uvalue);
       s.QuotedCString(dbg_str);
     } else {
       s.PutHex32(uvalue);
@@ -496,28 +492,18 @@
   }
   case DW_FORM_ref1:
     cu_relative_offset = true;
-    if (verbose)
-      s.Printf("cu + 0x%2.2x", (uint8_t)uvalue);
     break;
   case DW_FORM_ref2:
     cu_relative_offset = true;
-    if (verbose)
-      s.Printf("cu + 0x%4.4x", (uint16_t)uvalue);
     break;
   case DW_FORM_ref4:
     cu_relative_offset = true;
-    if (verbose)
-      s.Printf("cu + 0x%4.4x", (uint32_t)uvalue);
     break;
   case DW_FORM_ref8:
     cu_relative_offset = true;
-    if (verbose)
-      s.Printf("cu + 0x%8.8" PRIx64, uvalue);
     break;
   case DW_FORM_ref_udata:
     cu_relative_offset = true;
-    if (verbose)
-      s.Printf("cu + 0x%" PRIx64, uvalue);
     break;
 
   // All DW_FORM_indirect attributes should be resolved prior to calling this
@@ -535,9 +521,6 @@
   if (cu_relative_offset) {
     assert(m_cu); // CU must be valid for DW_FORM_ref forms that are compile
                   // unit relative or we will get this wrong
-    if (verbose)
-      s.PutCString(" => ");
-
     s.Printf("{0x%8.8" PRIx64 "}", uvalue + m_cu->GetOffset());
   }
 }
Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp
===================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp
@@ -82,7 +82,6 @@
                             lldb::offset_t *offset_ptr,
                             dw_addr_t cu_base_addr) {
   uint32_t addr_size = s.GetAddressByteSize();
-  bool verbose = s.GetVerbose();
 
   dw_addr_t base_addr = cu_base_addr;
   while (
@@ -95,10 +94,6 @@
       begin = LLDB_INVALID_ADDRESS;
 
     s.Indent();
-    if (verbose) {
-      s.AddressRange(begin, end, sizeof(dw_addr_t), " offsets = ");
-    }
-
     if (begin == 0 && end == 0) {
       s.PutCString(" End");
       break;
@@ -111,8 +106,7 @@
       dw_addr_t begin_addr = begin + base_addr;
       dw_addr_t end_addr = end + base_addr;
 
-      s.AddressRange(begin_addr, end_addr, sizeof(dw_addr_t),
-                     verbose ? " ==> addrs = " : NULL);
+      s.AddressRange(begin_addr, end_addr, sizeof(dw_addr_t), NULL);
     }
   }
 }
Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
===================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
@@ -666,13 +666,9 @@
     SymbolFileDWARF *dwarf2Data, const DWARFCompileUnit *cu,
     const DWARFDataExtractor &debug_info_data, lldb::offset_t *offset_ptr,
     Stream &s, dw_attr_t attr, dw_form_t form) {
-  bool verbose = s.GetVerbose();
   bool show_form = s.GetFlags().Test(DWARFDebugInfo::eDumpFlag_ShowForm);
 
-  if (verbose)
-    s.Offset(*offset_ptr);
-  else
-    s.Printf("            ");
+  s.Printf("            ");
   s.Indent(DW_AT_value_to_name(attr));
 
   if (show_form) {
@@ -694,68 +690,39 @@
 
   s.PutCString("( ");
 
-  // Always dump form value if verbose is enabled
-  if (verbose) {
-    form_value.Dump(s);
-  }
-
   // Check to see if we have any special attribute formatters
   switch (attr) {
   case DW_AT_stmt_list:
-    if (verbose)
-      s.PutCString(" ( ");
     s.Printf("0x%8.8" PRIx64, form_value.Unsigned());
-    if (verbose)
-      s.PutCString(" )");
     break;
 
   case DW_AT_language:
-    if (verbose)
-      s.PutCString(" ( ");
     s.PutCString(DW_LANG_value_to_name(form_value.Unsigned()));
-    if (verbose)
-      s.PutCString(" )");
     break;
 
   case DW_AT_encoding:
-    if (verbose)
-      s.PutCString(" ( ");
     s.PutCString(DW_ATE_value_to_name(form_value.Unsigned()));
-    if (verbose)
-      s.PutCString(" )");
     break;
 
   case DW_AT_frame_base:
   case DW_AT_location:
   case DW_AT_data_member_location: {
     const uint8_t *blockData = form_value.BlockData();
     if (blockData) {
-      if (!verbose)
-        form_value.Dump(s);
-
       // Location description is inlined in data in the form value
       DWARFDataExtractor locationData(debug_info_data,
                                       (*offset_ptr) - form_value.Unsigned(),
                                       form_value.Unsigned());
-      if (verbose)
-        s.PutCString(" ( ");
       DWARFExpression::PrintDWARFExpression(
           s, locationData, DWARFCompileUnit::GetAddressByteSize(cu), 4, false);
-      if (verbose)
-        s.PutCString(" )");
     } else {
       // We have a location list offset as the value that is
       // the offset into the .debug_loc section that describes
       // the value over it's lifetime
       uint64_t debug_loc_offset = form_value.Unsigned();
       if (dwarf2Data) {
-        if (!verbose)
-          form_value.Dump(s);
         DWARFExpression::PrintDWARFLocationList(
             s, cu, dwarf2Data->get_debug_loc_data(), debug_loc_offset);
-      } else {
-        if (!verbose)
-          form_value.Dump(s);
       }
     }
   } break;
@@ -765,35 +732,25 @@
     uint64_t abstract_die_offset = form_value.Reference();
     form_value.Dump(s);
     //  *ostrm_ptr << HEX32 << abstract_die_offset << " ( ";
-    if (verbose)
-      s.PutCString(" ( ");
     GetName(dwarf2Data, cu, abstract_die_offset, s);
-    if (verbose)
-      s.PutCString(" )");
   } break;
 
   case DW_AT_type: {
     uint64_t type_die_offset = form_value.Reference();
-    if (!verbose)
-      form_value.Dump(s);
     s.PutCString(" ( ");
     AppendTypeName(dwarf2Data, cu, type_die_offset, s);
     s.PutCString(" )");
   } break;
 
   case DW_AT_ranges: {
-    if (!verbose)
-      form_value.Dump(s);
     lldb::offset_t ranges_offset = form_value.Unsigned();
     dw_addr_t base_addr = cu ? cu->GetBaseAddress() : 0;
     if (dwarf2Data)
       DWARFDebugRanges::Dump(s, dwarf2Data->get_debug_ranges_data(),
                              &ranges_offset, base_addr);
   } break;
 
   default:
-    if (!verbose)
-      form_value.Dump(s);
     break;
   }
 
Index: lldb/trunk/source/Core/Stream.cpp
===================================================================
--- lldb/trunk/source/Core/Stream.cpp
+++ lldb/trunk/source/Core/Stream.cpp
@@ -340,16 +340,6 @@
 void Stream::SetAddressByteSize(uint32_t addr_size) { m_addr_size = addr_size; }
 
 //------------------------------------------------------------------
-// Returns true if the verbose flag bit is set in this stream.
-//------------------------------------------------------------------
-bool Stream::GetVerbose() const { return m_flags.Test(eVerbose); }
-
-//------------------------------------------------------------------
-// Returns true if the debug flag bit is set in this stream.
-//------------------------------------------------------------------
-bool Stream::GetDebug() const { return m_flags.Test(eDebug); }
-
-//------------------------------------------------------------------
 // The flags get accessor
 //------------------------------------------------------------------
 Flags &Stream::GetFlags() { return m_flags; }
@@ -400,7 +390,7 @@
 size_t Stream::PutNHex8(size_t n, uint8_t uvalue) {
   size_t bytes_written = 0;
   for (size_t i = 0; i < n; ++i)
-    bytes_written += _PutHex8(uvalue, m_flags.Test(eAddPrefix));
+    bytes_written += _PutHex8(uvalue, false);
   return bytes_written;
 }
 
@@ -423,57 +413,49 @@
   return bytes_written;
 }
 
-size_t Stream::PutHex8(uint8_t uvalue) {
-  return _PutHex8(uvalue, m_flags.Test(eAddPrefix));
-}
+size_t Stream::PutHex8(uint8_t uvalue) { return _PutHex8(uvalue, false); }
 
 size_t Stream::PutHex16(uint16_t uvalue, ByteOrder byte_order) {
   if (byte_order == eByteOrderInvalid)
     byte_order = m_byte_order;
 
-  bool add_prefix = m_flags.Test(eAddPrefix);
   size_t bytes_written = 0;
   if (byte_order == eByteOrderLittle) {
-    for (size_t byte = 0; byte < sizeof(uvalue); ++byte, add_prefix = false)
-      bytes_written += _PutHex8((uint8_t)(uvalue >> (byte * 8)), add_prefix);
+    for (size_t byte = 0; byte < sizeof(uvalue); ++byte)
+      bytes_written += _PutHex8((uint8_t)(uvalue >> (byte * 8)), false);
   } else {
-    for (size_t byte = sizeof(uvalue) - 1; byte < sizeof(uvalue);
-         --byte, add_prefix = false)
-      bytes_written += _PutHex8((uint8_t)(uvalue >> (byte * 8)), add_prefix);
+    for (size_t byte = sizeof(uvalue) - 1; byte < sizeof(uvalue); --byte)
+      bytes_written += _PutHex8((uint8_t)(uvalue >> (byte * 8)), false);
   }
   return bytes_written;
 }
 
 size_t Stream::PutHex32(uint32_t uvalue, ByteOrder byte_order) {
   if (byte_order == eByteOrderInvalid)
     byte_order = m_byte_order;
 
-  bool add_prefix = m_flags.Test(eAddPrefix);
   size_t bytes_written = 0;
   if (byte_order == eByteOrderLittle) {
-    for (size_t byte = 0; byte < sizeof(uvalue); ++byte, add_prefix = false)
-      bytes_written += _PutHex8((uint8_t)(uvalue >> (byte * 8)), add_prefix);
+    for (size_t byte = 0; byte < sizeof(uvalue); ++byte)
+      bytes_written += _PutHex8((uint8_t)(uvalue >> (byte * 8)), false);
   } else {
-    for (size_t byte = sizeof(uvalue) - 1; byte < sizeof(uvalue);
-         --byte, add_prefix = false)
-      bytes_written += _PutHex8((uint8_t)(uvalue >> (byte * 8)), add_prefix);
+    for (size_t byte = sizeof(uvalue) - 1; byte < sizeof(uvalue); --byte)
+      bytes_written += _PutHex8((uint8_t)(uvalue >> (byte * 8)), false);
   }
   return bytes_written;
 }
 
 size_t Stream::PutHex64(uint64_t uvalue, ByteOrder byte_order) {
   if (byte_order == eByteOrderInvalid)
     byte_order = m_byte_order;
 
-  bool add_prefix = m_flags.Test(eAddPrefix);
   size_t bytes_written = 0;
   if (byte_order == eByteOrderLittle) {
-    for (size_t byte = 0; byte < sizeof(uvalue); ++byte, add_prefix = false)
-      bytes_written += _PutHex8((uint8_t)(uvalue >> (byte * 8)), add_prefix);
+    for (size_t byte = 0; byte < sizeof(uvalue); ++byte)
+      bytes_written += _PutHex8((uint8_t)(uvalue >> (byte * 8)), false);
   } else {
-    for (size_t byte = sizeof(uvalue) - 1; byte < sizeof(uvalue);
-         --byte, add_prefix = false)
-      bytes_written += _PutHex8((uint8_t)(uvalue >> (byte * 8)), add_prefix);
+    for (size_t byte = sizeof(uvalue) - 1; byte < sizeof(uvalue); --byte)
+      bytes_written += _PutHex8((uint8_t)(uvalue >> (byte * 8)), false);
   }
   return bytes_written;
 }
Index: lldb/trunk/source/Core/SearchFilter.cpp
===================================================================
--- lldb/trunk/source/Core/SearchFilter.cpp
+++ lldb/trunk/source/Core/SearchFilter.cpp
@@ -433,13 +433,7 @@
 
 void SearchFilterByModule::GetDescription(Stream *s) {
   s->PutCString(", module = ");
-  if (s->GetVerbose()) {
-    char buffer[2048];
-    m_module_spec.GetPath(buffer, 2047);
-    s->PutCString(buffer);
-  } else {
-    s->PutCString(m_module_spec.GetFilename().AsCString("<Unknown>"));
-  }
+  s->PutCString(m_module_spec.GetFilename().AsCString("<Unknown>"));
 }
 
 uint32_t SearchFilterByModule::GetFilterRequiredItems() {
@@ -591,27 +585,15 @@
   size_t num_modules = m_module_spec_list.GetSize();
   if (num_modules == 1) {
     s->Printf(", module = ");
-    if (s->GetVerbose()) {
-      char buffer[2048];
-      m_module_spec_list.GetFileSpecAtIndex(0).GetPath(buffer, 2047);
-      s->PutCString(buffer);
-    } else {
-      s->PutCString(
-          m_module_spec_list.GetFileSpecAtIndex(0).GetFilename().AsCString(
-              "<Unknown>"));
-    }
+    s->PutCString(
+        m_module_spec_list.GetFileSpecAtIndex(0).GetFilename().AsCString(
+            "<Unknown>"));
   } else {
     s->Printf(", modules(%" PRIu64 ") = ", (uint64_t)num_modules);
     for (size_t i = 0; i < num_modules; i++) {
-      if (s->GetVerbose()) {
-        char buffer[2048];
-        m_module_spec_list.GetFileSpecAtIndex(i).GetPath(buffer, 2047);
-        s->PutCString(buffer);
-      } else {
-        s->PutCString(
-            m_module_spec_list.GetFileSpecAtIndex(i).GetFilename().AsCString(
-                "<Unknown>"));
-      }
+      s->PutCString(
+          m_module_spec_list.GetFileSpecAtIndex(i).GetFilename().AsCString(
+              "<Unknown>"));
       if (i != num_modules - 1)
         s->PutCString(", ");
     }
@@ -827,27 +809,15 @@
   size_t num_modules = m_module_spec_list.GetSize();
   if (num_modules == 1) {
     s->Printf(", module = ");
-    if (s->GetVerbose()) {
-      char buffer[2048];
-      m_module_spec_list.GetFileSpecAtIndex(0).GetPath(buffer, 2047);
-      s->PutCString(buffer);
-    } else {
-      s->PutCString(
-          m_module_spec_list.GetFileSpecAtIndex(0).GetFilename().AsCString(
-              "<Unknown>"));
-    }
+    s->PutCString(
+        m_module_spec_list.GetFileSpecAtIndex(0).GetFilename().AsCString(
+            "<Unknown>"));
   } else if (num_modules > 0) {
     s->Printf(", modules(%" PRIu64 ") = ", static_cast<uint64_t>(num_modules));
     for (size_t i = 0; i < num_modules; i++) {
-      if (s->GetVerbose()) {
-        char buffer[2048];
-        m_module_spec_list.GetFileSpecAtIndex(i).GetPath(buffer, 2047);
-        s->PutCString(buffer);
-      } else {
-        s->PutCString(
-            m_module_spec_list.GetFileSpecAtIndex(i).GetFilename().AsCString(
-                "<Unknown>"));
-      }
+      s->PutCString(
+          m_module_spec_list.GetFileSpecAtIndex(i).GetFilename().AsCString(
+              "<Unknown>"));
       if (i != num_modules - 1)
         s->PutCString(", ");
     }
Index: lldb/trunk/source/Core/Log.cpp
===================================================================
--- lldb/trunk/source/Core/Log.cpp
+++ lldb/trunk/source/Core/Log.cpp
@@ -343,28 +343,13 @@
   }
 }
 
-bool Log::GetVerbose() const {
-  // FIXME: This has to be centralized between the stream and the log...
-  if (m_options.Test(LLDB_LOG_OPTION_VERBOSE))
-    return true;
-
-  // Make a copy of our stream shared pointer in case someone disables our
-  // log while we are logging and releases the stream
-  StreamSP stream_sp(m_stream_sp);
-  if (stream_sp)
-    return stream_sp->GetVerbose();
-  return false;
-}
+bool Log::GetVerbose() const { return m_options.Test(LLDB_LOG_OPTION_VERBOSE); }
 
 //------------------------------------------------------------------
 // Returns true if the debug flag bit is set in this stream.
 //------------------------------------------------------------------
 bool Log::GetDebug() const {
-  // Make a copy of our stream shared pointer in case someone disables our
-  // log while we are logging and releases the stream
-  StreamSP stream_sp(m_stream_sp);
-  if (stream_sp)
-    return stream_sp->GetDebug();
+  // TODO: remove and clean up callers
   return false;
 }
 
Index: lldb/trunk/include/lldb/Core/Stream.h
===================================================================
--- lldb/trunk/include/lldb/Core/Stream.h
+++ lldb/trunk/include/lldb/Core/Stream.h
@@ -33,11 +33,7 @@
   /// \a m_flags bit values.
   //------------------------------------------------------------------
   enum {
-    eVerbose = (1 << 0),   ///< If set, verbose logging is enabled
-    eDebug = (1 << 1),     ///< If set, debug logging is enabled
-    eAddPrefix = (1 << 2), ///< Add number prefixes for binary, octal and hex
-                           ///when eBinary is clear
-    eBinary = (1 << 3) ///< Get and put data as binary instead of as the default
+    eBinary = (1 << 0) ///< Get and put data as binary instead of as the default
                        ///string mode.
   };
 
@@ -385,15 +381,6 @@
   uint32_t GetAddressByteSize() const;
 
   //------------------------------------------------------------------
-  /// Test if debug logging is enabled.
-  ///
-  /// @return
-  //      \b true if the debug flag bit is set in this stream, \b
-  //      false otherwise.
-  //------------------------------------------------------------------
-  bool GetDebug() const;
-
-  //------------------------------------------------------------------
   /// The flags accessor.
   ///
   /// @return
@@ -426,15 +413,6 @@
   int GetIndentLevel() const;
 
   //------------------------------------------------------------------
-  /// Test if verbose logging is enabled.
-  ///
-  /// @return
-  //      \b true if the verbose flag bit is set in this stream, \b
-  //      false otherwise.
-  //------------------------------------------------------------------
-  bool GetVerbose() const;
-
-  //------------------------------------------------------------------
   /// Indent the current line in the stream.
   ///
   /// Indent the current line using the current indentation level and
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to