[Lldb-commits] [PATCH] D104283: [lldb] Fix libstdc++ 11's std::unique_ptr affecting LLDB testsuite TestDataFormatterStdUniquePtr.py

Jan Kratochvil via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Jun 15 02:21:56 PDT 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGfffb97509511: [lldb] Fix libstdc++ 11's std::unique_ptr affecting LLDB testsuiteā€¦ (authored by jankratochvil).

Changed prior to commit:
  https://reviews.llvm.org/D104283?vs=352053&id=352076#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104283/new/

https://reviews.llvm.org/D104283

Files:
  lldb/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp


Index: lldb/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp
===================================================================
--- lldb/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp
+++ lldb/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp
@@ -99,9 +99,17 @@
   if (ptr_obj)
     m_ptr_obj = ptr_obj->Clone(ConstString("pointer")).get();
 
-  ValueObjectSP del_obj = tuple_frontend->GetChildAtIndex(1);
-  if (del_obj)
-    m_del_obj = del_obj->Clone(ConstString("deleter")).get();
+  // Add a 'deleter' child if there was a non-empty deleter type specified.
+  //
+  // The object might have size=1 in the TypeSystem but occupies no dedicated
+  // storage due to no_unique_address, so infer the actual size from the total
+  // size of the unique_ptr class. If sizeof(unique_ptr) == sizeof(void*) then
+  // the deleter is empty and should be hidden.
+  if (tuple_sp->GetByteSize() > ptr_obj->GetByteSize()) {
+    ValueObjectSP del_obj = tuple_frontend->GetChildAtIndex(1);
+    if (del_obj)
+      m_del_obj = del_obj->Clone(ConstString("deleter")).get();
+  }
 
   if (m_ptr_obj) {
     Status error;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104283.352076.patch
Type: text/x-patch
Size: 1147 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210615/f91d7f0f/attachment.bin>


More information about the lldb-commits mailing list