Fix libcxx formatters for changes in r300140.

Summary:
LLVM r300140 changed the layout and field names of __compressed_pair, which
broke LLDB's std::vector, std::map and std::unsorted_map formatters.

This patch attempts to fix these formatters by having them interogate the
__compressed_pair values to determine whether they're pre- or post-r300140
variants, then access them accordingly.

Reviewers: jingham, EricWF

Reviewed By: jingham

Differential Revision: https://reviews.llvm.org/D32554

llvm-svn: 301493
diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp
index 50d4510..293d640 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp
@@ -219,6 +219,7 @@
     CalculateNumChildren() {
   static ConstString g___pair3_("__pair3_");
   static ConstString g___first_("__first_");
+  static ConstString g___value_("__value_");
 
   if (m_count != UINT32_MAX)
     return m_count;
@@ -227,7 +228,22 @@
   ValueObjectSP m_item(m_tree->GetChildMemberWithName(g___pair3_, true));
   if (!m_item)
     return 0;
-  m_item = m_item->GetChildMemberWithName(g___first_, true);
+
+  switch (m_item->GetCompilerType().GetNumDirectBaseClasses()) {
+  case 1:
+    // Assume a pre llvm r300140 __compressed_pair implementation:
+    m_item = m_item->GetChildMemberWithName(g___first_, true);
+    break;
+  case 2: {
+    // Assume a post llvm r300140 __compressed_pair implementation:
+    ValueObjectSP first_elem_parent = m_item->GetChildAtIndex(0, true);
+    m_item = first_elem_parent->GetChildMemberWithName(g___value_, true);
+    break;
+  }
+  default:
+    return false;
+  }
+
   if (!m_item)
     return 0;
   m_count = m_item->GetValueAsUnsigned(0);