Woops... Guess I am just gonna reformat the entire file...<div><br /></div><div>Sorry about that!<br /><br /><span>On 10/03/16 04:43 PM, <b class="name">Zachary Turner </b> <zturner@google.com> wrote:</span><blockquote cite="mid:CAAErz9j1_vBj5FqYgz0i8r70M9So9CA4MPyd_YNTdevD1KTRdQ@mail.gmail.com" class="iwcQuote" style="border-left: 1px solid #00F; padding-left: 13px; margin-left: 0;" type="cite"><div class="mimetype-text-html"><div dir="ltr">Was this clang-formatted?  some of these lines look way longer than 80 columns.</div><br /><div class="gmail_quote"><div dir="ltr">On Mon, Oct 3, 2016 at 4:41 PM Enrico Granata via lldb-commits <<a href="mailto:lldb-commits@lists.llvm.org">lldb-commits@lists.llvm.org</a>> wrote:<br /></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: enrico<br class="gmail_msg" />
Date: Mon Oct  3 18:33:00 2016<br class="gmail_msg" />
New Revision: 283160<br class="gmail_msg" />
<br class="gmail_msg" />
URL: <a class="gmail_msg" href="http://llvm.org/viewvc/llvm-project?rev=283160&view=rev" rel="noreferrer" target="1">http://llvm.org/viewvc/llvm-project?rev=283160&view=rev</a><br class="gmail_msg" />
Log:<br class="gmail_msg" />
Changes to the std::multimap formatter to make it work against trunk libc++<br class="gmail_msg" />
<br class="gmail_msg" />
Fixes rdar://28237486<br class="gmail_msg" />
<br class="gmail_msg" />
<br class="gmail_msg" />
Modified:<br class="gmail_msg" />
    lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp<br class="gmail_msg" />
<br class="gmail_msg" />
Modified: lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp<br class="gmail_msg" />
URL: <a class="gmail_msg" href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp?rev=283160&r1=283159&r2=283160&view=diff" rel="noreferrer" target="1">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp?rev=283160&r1=283159&r2=283160&view=diff</a><br class="gmail_msg" />
==============================================================================<br class="gmail_msg" />
--- lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp (original)<br class="gmail_msg" />
+++ lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp Mon Oct  3 18:33:00 2016<br class="gmail_msg" />
@@ -39,21 +39,21 @@ public:<br class="gmail_msg" />
     static ConstString g_left("__left_");<br class="gmail_msg" />
     if (!m_entry_sp)<br class="gmail_msg" />
       return m_entry_sp;<br class="gmail_msg" />
-    return m_entry_sp->GetChildMemberWithName(g_left, true);<br class="gmail_msg" />
+    return m_entry_sp->GetSyntheticChildAtOffset(0, m_entry_sp->GetCompilerType(), true);<br class="gmail_msg" />
   }<br class="gmail_msg" />
<br class="gmail_msg" />
   ValueObjectSP right() const {<br class="gmail_msg" />
     static ConstString g_right("__right_");<br class="gmail_msg" />
     if (!m_entry_sp)<br class="gmail_msg" />
       return m_entry_sp;<br class="gmail_msg" />
-    return m_entry_sp->GetChildMemberWithName(g_right, true);<br class="gmail_msg" />
+    return m_entry_sp->GetSyntheticChildAtOffset(m_entry_sp->GetProcessSP()->GetAddressByteSize(), m_entry_sp->GetCompilerType(), true);<br class="gmail_msg" />
   }<br class="gmail_msg" />
<br class="gmail_msg" />
   ValueObjectSP parent() const {<br class="gmail_msg" />
     static ConstString g_parent("__parent_");<br class="gmail_msg" />
     if (!m_entry_sp)<br class="gmail_msg" />
       return m_entry_sp;<br class="gmail_msg" />
-    return m_entry_sp->GetChildMemberWithName(g_parent, true);<br class="gmail_msg" />
+    return m_entry_sp->GetSyntheticChildAtOffset(2*m_entry_sp->GetProcessSP()->GetAddressByteSize(), m_entry_sp->GetCompilerType(), true);<br class="gmail_msg" />
   }<br class="gmail_msg" />
<br class="gmail_msg" />
   uint64_t value() const {<br class="gmail_msg" />
@@ -231,6 +231,8 @@ size_t lldb_private::formatters::LibcxxS<br class="gmail_msg" />
<br class="gmail_msg" />
 bool lldb_private::formatters::LibcxxStdMapSyntheticFrontEnd::GetDataType() {<br class="gmail_msg" />
   static ConstString g___value_("__value_");<br class="gmail_msg" />
+  static ConstString g_tree_("__tree_");<br class="gmail_msg" />
+  static ConstString g_pair3("__pair3_");<br class="gmail_msg" />
<br class="gmail_msg" />
   if (m_element_type.GetOpaqueQualType() && m_element_type.GetTypeSystem())<br class="gmail_msg" />
     return true;<br class="gmail_msg" />
@@ -241,10 +243,21 @@ bool lldb_private::formatters::LibcxxStd<br class="gmail_msg" />
   if (!deref || error.Fail())<br class="gmail_msg" />
     return false;<br class="gmail_msg" />
   deref = deref->GetChildMemberWithName(g___value_, true);<br class="gmail_msg" />
+  if (deref) {<br class="gmail_msg" />
+      m_element_type = deref->GetCompilerType();<br class="gmail_msg" />
+      return true;<br class="gmail_msg" />
+  }<br class="gmail_msg" />
+  lldb::TemplateArgumentKind kind;<br class="gmail_msg" />
+  deref = m_backend.GetChildAtNamePath( {g_tree_, g_pair3} );<br class="gmail_msg" />
   if (!deref)<br class="gmail_msg" />
     return false;<br class="gmail_msg" />
-  m_element_type = deref->GetCompilerType();<br class="gmail_msg" />
-  return true;<br class="gmail_msg" />
+  m_element_type = deref->GetCompilerType().GetTemplateArgument(1, kind).GetTemplateArgument(1, kind);<br class="gmail_msg" />
+  if (!m_element_type)<br class="gmail_msg" />
+    return false;<br class="gmail_msg" />
+  std::string name; uint64_t bit_offset_ptr; uint32_t bitfield_bit_size_ptr; bool is_bitfield_ptr;<br class="gmail_msg" />
+  m_element_type = m_element_type.GetFieldAtIndex(0, name, &bit_offset_ptr, &bitfield_bit_size_ptr, &is_bitfield_ptr);<br class="gmail_msg" />
+  m_element_type = m_element_type.GetTypedefedType();<br class="gmail_msg" />
+  return m_element_type.IsValid();<br class="gmail_msg" />
 }<br class="gmail_msg" />
<br class="gmail_msg" />
 void lldb_private::formatters::LibcxxStdMapSyntheticFrontEnd::GetValueOffset(<br class="gmail_msg" />
@@ -255,10 +268,32 @@ void lldb_private::formatters::LibcxxStd<br class="gmail_msg" />
     return;<br class="gmail_msg" />
   CompilerType node_type(node->GetCompilerType());<br class="gmail_msg" />
   uint64_t bit_offset;<br class="gmail_msg" />
-  if (node_type.GetIndexOfFieldWithName("__value_", nullptr, &bit_offset) ==<br class="gmail_msg" />
-      UINT32_MAX)<br class="gmail_msg" />
-    return;<br class="gmail_msg" />
-  m_skip_size = bit_offset / 8u;<br class="gmail_msg" />
+  if (node_type.GetIndexOfFieldWithName("__value_", nullptr, &bit_offset) !=<br class="gmail_msg" />
+      UINT32_MAX) {<br class="gmail_msg" />
+    m_skip_size = bit_offset / 8u;<br class="gmail_msg" />
+  }<br class="gmail_msg" />
+  else {<br class="gmail_msg" />
+    ClangASTContext *ast_ctx = llvm::dyn_cast_or_null<ClangASTContext>(node_type.GetTypeSystem());<br class="gmail_msg" />
+    if (!ast_ctx)<br class="gmail_msg" />
+      return;<br class="gmail_msg" />
+    CompilerType tree_node_type = ast_ctx->CreateStructForIdentifier(ConstString(), {<br class="gmail_msg" />
+      {"ptr0",ast_ctx->GetBasicType(lldb::eBasicTypeVoid).GetPointerType()},<br class="gmail_msg" />
+      {"ptr1",ast_ctx->GetBasicType(lldb::eBasicTypeVoid).GetPointerType()},<br class="gmail_msg" />
+      {"ptr2",ast_ctx->GetBasicType(lldb::eBasicTypeVoid).GetPointerType()},<br class="gmail_msg" />
+      {"cw",ast_ctx->GetBasicType(lldb::eBasicTypeBool)},<br class="gmail_msg" />
+      {"payload",m_element_type}<br class="gmail_msg" />
+    });<br class="gmail_msg" />
+    std::string child_name;<br class="gmail_msg" />
+    uint32_t child_byte_size;<br class="gmail_msg" />
+    int32_t child_byte_offset = 0;<br class="gmail_msg" />
+    uint32_t child_bitfield_bit_size;<br class="gmail_msg" />
+    uint32_t child_bitfield_bit_offset;<br class="gmail_msg" />
+    bool child_is_base_class;<br class="gmail_msg" />
+    bool child_is_deref_of_parent;<br class="gmail_msg" />
+    uint64_t language_flags;<br class="gmail_msg" />
+    if (tree_node_type.GetChildCompilerTypeAtIndex(nullptr, 4, true, true, true, child_name, child_byte_size, child_byte_offset, child_bitfield_bit_size, child_bitfield_bit_offset, child_is_base_class, child_is_deref_of_parent, nullptr, language_flags).IsValid())<br class="gmail_msg" />
+      m_skip_size = (uint32_t)child_byte_offset;<br class="gmail_msg" />
+  }<br class="gmail_msg" />
 }<br class="gmail_msg" />
<br class="gmail_msg" />
 lldb::ValueObjectSP<br class="gmail_msg" />
@@ -301,7 +336,12 @@ lldb_private::formatters::LibcxxStdMapSy<br class="gmail_msg" />
         return lldb::ValueObjectSP();<br class="gmail_msg" />
       }<br class="gmail_msg" />
       GetValueOffset(iterated_sp);<br class="gmail_msg" />
-      iterated_sp = iterated_sp->GetChildMemberWithName(g___value_, true);<br class="gmail_msg" />
+      auto child_sp = iterated_sp->GetChildMemberWithName(g___value_, true);<br class="gmail_msg" />
+      if (child_sp)<br class="gmail_msg" />
+        iterated_sp = child_sp;<br class="gmail_msg" />
+      else<br class="gmail_msg" />
+        iterated_sp = iterated_sp->GetSyntheticChildAtOffset(<br class="gmail_msg" />
+                                                             m_skip_size, m_element_type, true);<br class="gmail_msg" />
       if (!iterated_sp) {<br class="gmail_msg" />
         m_tree = nullptr;<br class="gmail_msg" />
         return lldb::ValueObjectSP();<br class="gmail_msg" />
<br class="gmail_msg" />
<br class="gmail_msg" />
_______________________________________________<br class="gmail_msg" />
lldb-commits mailing list<br class="gmail_msg" />
<a class="gmail_msg" href="mailto:lldb-commits@lists.llvm.org">lldb-commits@lists.llvm.org</a><br class="gmail_msg" />
<a class="gmail_msg" href="http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits" rel="noreferrer" target="1">http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits</a><br class="gmail_msg" />
</blockquote></div>
</div></blockquote>-- <br signature="separator" /><div class="">Thanks,</div><div class=""><i class="">- Enrico</i><br class="" />📩 egranata@<font class="" color="#ff2600"></font>.com ☎️ 27683</div><div><br /></div></div>