[Lldb-commits] [lldb] r286176 - Simplify the PrintableRepresentationSpecialCases code; we never used the ePrintableRepresentationSpecialCasesOnly value and with enum classes the names doesn't need to be that long

Enrico Granata via lldb-commits lldb-commits at lists.llvm.org
Mon Nov 7 15:32:22 PST 2016


Author: enrico
Date: Mon Nov  7 17:32:20 2016
New Revision: 286176

URL: http://llvm.org/viewvc/llvm-project?rev=286176&view=rev
Log:
Simplify the PrintableRepresentationSpecialCases code; we never used the ePrintableRepresentationSpecialCasesOnly value and with enum classes the names doesn't need to be that long


Modified:
    lldb/trunk/include/lldb/Core/ValueObject.h
    lldb/trunk/source/Core/FormatEntity.cpp
    lldb/trunk/source/Core/ValueObject.cpp
    lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp
    lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxx.cpp
    lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp
    lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp

Modified: lldb/trunk/include/lldb/Core/ValueObject.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObject.h?rev=286176&r1=286175&r2=286176&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ValueObject.h (original)
+++ lldb/trunk/include/lldb/Core/ValueObject.h Mon Nov  7 17:32:20 2016
@@ -536,10 +536,9 @@ public:
       ValueObjectRepresentationStyle val_obj_display,
       lldb::Format custom_format);
 
-  enum PrintableRepresentationSpecialCases {
-    ePrintableRepresentationSpecialCasesDisable = 0,
-    ePrintableRepresentationSpecialCasesAllow = 1,
-    ePrintableRepresentationSpecialCasesOnly = 3
+  enum class PrintableRepresentationSpecialCases : bool {
+    eDisable = false,
+    eAllow = true
   };
 
   bool
@@ -548,7 +547,7 @@ public:
                                   eValueObjectRepresentationStyleSummary,
                               lldb::Format custom_format = lldb::eFormatInvalid,
                               PrintableRepresentationSpecialCases special =
-                                  ePrintableRepresentationSpecialCasesAllow,
+                                  PrintableRepresentationSpecialCases::eAllow,
                               bool do_dump_error = true);
   bool GetValueIsValid() const;
 

Modified: lldb/trunk/source/Core/FormatEntity.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/FormatEntity.cpp?rev=286176&r1=286175&r2=286176&view=diff
==============================================================================
--- lldb/trunk/source/Core/FormatEntity.cpp (original)
+++ lldb/trunk/source/Core/FormatEntity.cpp Mon Nov  7 17:32:20 2016
@@ -874,7 +874,7 @@ static bool DumpValue(Stream &s, const S
       {
         target->DumpPrintableRepresentation(
             s, val_obj_display, custom_format,
-            ValueObject::ePrintableRepresentationSpecialCasesDisable);
+            ValueObject::PrintableRepresentationSpecialCases::eDisable);
       }
       return true;
     }
@@ -1676,8 +1676,7 @@ bool FormatEntity::Format(const Entry &e
                       ss, ValueObject::ValueObjectRepresentationStyle::
                               eValueObjectRepresentationStyleSummary,
                       eFormatDefault,
-                      ValueObject::PrintableRepresentationSpecialCases::
-                          ePrintableRepresentationSpecialCasesAllow,
+                      ValueObject::PrintableRepresentationSpecialCases::eAllow,
                       false);
               }
 

Modified: lldb/trunk/source/Core/ValueObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=286176&r1=286175&r2=286176&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObject.cpp (original)
+++ lldb/trunk/source/Core/ValueObject.cpp Mon Nov  7 17:32:20 2016
@@ -1279,10 +1279,9 @@ bool ValueObject::DumpPrintableRepresent
 
   Flags flags(GetTypeInfo());
 
-  bool allow_special = ((special & ePrintableRepresentationSpecialCasesAllow) ==
-                        ePrintableRepresentationSpecialCasesAllow);
-  bool only_special = ((special & ePrintableRepresentationSpecialCasesOnly) ==
-                       ePrintableRepresentationSpecialCasesOnly);
+  bool allow_special =
+      (special == ValueObject::PrintableRepresentationSpecialCases::eAllow);
+  const bool only_special = false;
 
   if (allow_special) {
     if (flags.AnySet(eTypeIsArray | eTypeIsPointer) &&

Modified: lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp?rev=286176&r1=286175&r2=286176&view=diff
==============================================================================
--- lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp (original)
+++ lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp Mon Nov  7 17:32:20 2016
@@ -762,7 +762,7 @@ bool ValueObjectPrinter::PrintChildrenOn
         child_sp->DumpPrintableRepresentation(
             *m_stream, ValueObject::eValueObjectRepresentationStyleSummary,
             m_options.m_format,
-            ValueObject::ePrintableRepresentationSpecialCasesDisable);
+            ValueObject::PrintableRepresentationSpecialCases::eDisable);
       }
     }
 

Modified: lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxx.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxx.cpp?rev=286176&r1=286175&r2=286176&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxx.cpp (original)
+++ lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxx.cpp Mon Nov  7 17:32:20 2016
@@ -59,7 +59,8 @@ bool lldb_private::formatters::LibcxxSma
       if (pointee_sp->DumpPrintableRepresentation(
               stream, ValueObject::eValueObjectRepresentationStyleSummary,
               lldb::eFormatInvalid,
-              ValueObject::ePrintableRepresentationSpecialCasesDisable, false))
+              ValueObject::PrintableRepresentationSpecialCases::eDisable,
+              false))
         print_pointee = true;
     }
     if (!print_pointee)

Modified: lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp?rev=286176&r1=286175&r2=286176&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp (original)
+++ lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp Mon Nov  7 17:32:20 2016
@@ -420,7 +420,8 @@ bool lldb_private::formatters::LibStdcpp
     if (pointee_sp->DumpPrintableRepresentation(
             stream, ValueObject::eValueObjectRepresentationStyleSummary,
             lldb::eFormatInvalid,
-            ValueObject::ePrintableRepresentationSpecialCasesDisable, false)) {
+            ValueObject::PrintableRepresentationSpecialCases::eDisable,
+            false)) {
       return true;
     }
   }

Modified: lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp?rev=286176&r1=286175&r2=286176&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp (original)
+++ lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp Mon Nov  7 17:32:20 2016
@@ -135,7 +135,7 @@ bool LibStdcppUniquePtrSyntheticFrontEnd
       if (m_obj_obj->DumpPrintableRepresentation(
               stream, ValueObject::eValueObjectRepresentationStyleSummary,
               lldb::eFormatInvalid,
-              ValueObject::ePrintableRepresentationSpecialCasesDisable,
+              ValueObject::PrintableRepresentationSpecialCases::eDisable,
               false)) {
         print_pointee = true;
       }




More information about the lldb-commits mailing list