[Lldb-commits] [lldb] r169759 - in /lldb/trunk: examples/synthetic/gnu_libstdcpp.py examples/synthetic/libcxx.py source/Core/CXXFormatterFunctions.cpp

Enrico Granata egranata at apple.com
Mon Dec 10 11:55:54 PST 2012


Author: enrico
Date: Mon Dec 10 13:55:53 2012
New Revision: 169759

URL: http://llvm.org/viewvc/llvm-project?rev=169759&view=rev
Log:
<rdar://problem/12848118>

Making MightHaveChildren() always return true regardless for our own data formatters
This is meant to optimize performance for common most-often-not-empty container classes


Modified:
    lldb/trunk/examples/synthetic/gnu_libstdcpp.py
    lldb/trunk/examples/synthetic/libcxx.py
    lldb/trunk/source/Core/CXXFormatterFunctions.cpp

Modified: lldb/trunk/examples/synthetic/gnu_libstdcpp.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/synthetic/gnu_libstdcpp.py?rev=169759&r1=169758&r2=169759&view=diff
==============================================================================
--- lldb/trunk/examples/synthetic/gnu_libstdcpp.py (original)
+++ lldb/trunk/examples/synthetic/gnu_libstdcpp.py Mon Dec 10 13:55:53 2012
@@ -133,24 +133,6 @@
 			pass
 
 	def has_children(self):
-		logger = lldb.formatters.Logger.Logger()
-		if self.count == None:
-			self.update ()
-			try:
-				next_val = self.next.GetValueAsUnsigned(0)
-				prev_val = self.prev.GetValueAsUnsigned(0)
-				if next_val == 0 or prev_val == 0:
-					return False
-				if next_val == self.node_address:
-					return False
-				# skip all the advanced logic to detect the exact count of children
-				# in the interest of speed from this point on, we MIGHT have children
-				# our loop detection logic will still make nothing show up :)
-				return True
-			except:
-				return False
-		if self.count == 0:
-			return False
 		return True
 
 class StdVectorSynthProvider:
@@ -249,7 +231,7 @@
 			
 
 	def has_children(self):
-		return self.num_children() > 0
+		return True
 
 
 class StdMapSynthProvider:
@@ -434,7 +416,7 @@
 			return x;
 
 	def has_children(self):
-		return self.num_children() > 0
+		return True
 
 _map_capping_size = 255
 _list_capping_size = 255

Modified: lldb/trunk/examples/synthetic/libcxx.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/synthetic/libcxx.py?rev=169759&r1=169758&r2=169759&view=diff
==============================================================================
--- lldb/trunk/examples/synthetic/libcxx.py (original)
+++ lldb/trunk/examples/synthetic/libcxx.py Mon Dec 10 13:55:53 2012
@@ -125,8 +125,7 @@
 			pass
 
 	def has_children(self):
-		# retrieving the count is quick enough on a std::vector
-		return self.num_children() > 0
+		return True
 
 # Just an example: the actual summary is produced by a summary string: size=${svar%#}
 def stdvector_SummaryProvider(valobj,dict):
@@ -322,24 +321,6 @@
 			pass
 
 	def has_children(self):
-		logger = lldb.formatters.Logger.Logger()
-		if self.count == None:
-			self.update()
-			try:
-				next_val = self.head.GetValueAsUnsigned(0)
-				prev_val = self.tail.GetValueAsUnsigned(0)
-				if next_val == 0 or prev_val == 0:
-					return False
-				if next_val == self.node_address:
-					return False
-				# skip all the advanced logic to detect the exact count of children
-				# in the interest of speed from this point on, we MIGHT have children
-				# our loop detection logic will still make nothing show up :)
-				return True
-			except:
-				return 0;
-		if self.count == 0:
-			return False
 		return True
 
 
@@ -504,7 +485,7 @@
 			return 0;
 
 	def has_children(self):
-		return self.num_children_impl() > 0
+		return True
 
 	def get_data_type(self):
 		logger = lldb.formatters.Logger.Logger()
@@ -629,9 +610,7 @@
         return min(self.count, _deque_capping_size)
 
     def has_children(self):
-        if self.cont is None:
-            self.update()
-        return self.count > 0
+        return True
 
     def get_child_index(self,name):
         logger = lldb.formatters.Logger.Logger()

Modified: lldb/trunk/source/Core/CXXFormatterFunctions.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/CXXFormatterFunctions.cpp?rev=169759&r1=169758&r2=169759&view=diff
==============================================================================
--- lldb/trunk/source/Core/CXXFormatterFunctions.cpp (original)
+++ lldb/trunk/source/Core/CXXFormatterFunctions.cpp Mon Dec 10 13:55:53 2012
@@ -833,9 +833,7 @@
 bool
 lldb_private::formatters::NSArrayMSyntheticFrontEnd::MightHaveChildren ()
 {
-    if (!m_data_32 && !m_data_64)
-        Update ();
-    return CalculateNumChildren();
+    return true;
 }
 
 static uint32_t
@@ -950,9 +948,7 @@
 bool
 lldb_private::formatters::NSArrayISyntheticFrontEnd::MightHaveChildren ()
 {
-    if (!m_data_ptr)
-        Update ();
-    return CalculateNumChildren();
+    return true;
 }
 
 lldb::ValueObjectSP
@@ -1052,7 +1048,7 @@
 bool
 lldb_private::formatters::NSArrayCodeRunningSyntheticFrontEnd::MightHaveChildren ()
 {
-    return CalculateNumChildren() > 0;
+    return true;
 }
 
 uint32_t
@@ -1149,7 +1145,7 @@
 bool
 lldb_private::formatters::NSDictionaryCodeRunningSyntheticFrontEnd::MightHaveChildren ()
 {
-    return CalculateNumChildren() > 0;
+    return true;
 }
 
 uint32_t
@@ -1247,9 +1243,7 @@
 bool
 lldb_private::formatters::NSDictionaryISyntheticFrontEnd::MightHaveChildren ()
 {
-    if (!m_data_32 && !m_data_64)
-        Update ();
-    return CalculateNumChildren();
+    return true;
 }
 
 lldb::ValueObjectSP
@@ -1396,9 +1390,7 @@
 bool
 lldb_private::formatters::NSDictionaryMSyntheticFrontEnd::MightHaveChildren ()
 {
-    if (!m_data_32 && !m_data_64)
-        Update ();
-    return CalculateNumChildren();
+    return true;
 }
 
 lldb::ValueObjectSP





More information about the lldb-commits mailing list