Author: echristo
Date: Tue Oct 21 15:39:34 2014
New Revision: 220320

URL: http://llvm.org/viewvc/llvm-project?rev=220320&view=rev
Log:
Move anonymous types declared in an anonymous union to
outside the anonymous union as it's a language extension
we don't normally support.

Modified:
    lldb/trunk/source/DataFormatters/NSIndexPath.cpp

Modified: lldb/trunk/source/DataFormatters/NSIndexPath.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/NSIndexPath.cpp?rev=220320&r1=220319&r2=220320&view=diff
==============================================================================
--- lldb/trunk/source/DataFormatters/NSIndexPath.cpp (original)
+++ lldb/trunk/source/DataFormatters/NSIndexPath.cpp Tue Oct 21 15:39:34 2014
@@ -189,102 +189,105 @@ protected:
                     return m_outsourced.GetIndexAtIndex (idx);
             }
         }
-        
-        union {
-            struct {
-            public:
-                void SetIndexes(uint64_t value, Process& p)
-                {
-                    m_indexes = value;
-                    _lengthForInlinePayload(p.GetAddressByteSize());
-                    m_process = &p;
-                }
-                
-                size_t
-                GetNumIndexes ()
-                {
-                    return m_count;
-                }
-                
-                lldb::ValueObjectSP
-                GetIndexAtIndex (size_t idx, const ClangASTType& desired_type)
-                {
-                    std::pair<uint64_t, bool> 
value(_indexAtPositionForInlinePayload(idx));
-                    if (!value.second)
-                        return nullptr;
-                    Value v;
-                    if (m_ptr_size == 8)
-                    {
-                        Scalar scalar( (unsigned long long)value.first );
-                        v = Value(scalar);
-                    }
-                    else
-                    {
-                        Scalar scalar( (unsigned int)value.first );
-                        v = Value(scalar);
-                    }
-                    v.SetClangType(desired_type);
-                    StreamString idx_name;
-                    idx_name.Printf("[%" PRIu64 "]", (uint64_t)idx);
-                    return ValueObjectConstResult::Create(m_process, v, 
ConstString(idx_name.GetData()));
-                }
-                
-            private:
-                uint64_t m_indexes;
-                size_t m_count;
-                uint32_t m_ptr_size;
-                Process *m_process;
-                
-                // cfr. Foundation for the details of this code
-                size_t _lengthForInlinePayload(uint32_t ptr_size) {
-                    m_ptr_size = ptr_size;
-                    if (m_ptr_size == 8)
-                        m_count = ((m_indexes >> 3) & 0x7);
-                    else
-                        m_count = ((m_indexes >> 3) & 0x3);
-                    return m_count;
-                }
-                
-                std::pair<uint64_t, bool>
-                _indexAtPositionForInlinePayload(size_t pos) {
-                    if (m_ptr_size == 8)
-                    {
-                        switch (pos) {
-                            case 5: return {((m_indexes >> 51) & 0x1ff),true};
-                            case 4: return {((m_indexes >> 42) & 0x1ff),true};
-                            case 3: return {((m_indexes >> 33) & 0x1ff),true};
-                            case 2: return {((m_indexes >> 24) & 0x1ff),true};
-                            case 1: return {((m_indexes >> 15) & 0x1ff),true};
-                            case 0: return {((m_indexes >>  6) & 0x1ff),true};
-                        }
-                    }
-                    else
-                    {
-                        switch (pos) {
-                            case 2: return {((m_indexes >> 23) & 0x1ff),true};
-                            case 1: return {((m_indexes >> 14) & 0x1ff),true};
-                            case 0: return {((m_indexes >>  5) & 0x1ff),true};
-                        }
-                    }
-                    return {0,false};
-                }
 
-            } m_inlined;
-            struct {
-                ValueObject *m_indexes;
-                size_t m_count;
-                
-                lldb::ValueObjectSP
-                GetIndexAtIndex (size_t idx)
-                {
-                    if (m_indexes)
-                    {
-                        ValueObjectSP 
index_sp(m_indexes->GetSyntheticArrayMemberFromPointer(idx, true));
-                        return index_sp;
-                    }
-                    return nullptr;
-                }
-            } m_outsourced;
+        struct InlinedIndexes {
+       public:
+         void SetIndexes(uint64_t value, Process& p)
+         {
+             m_indexes = value;
+             _lengthForInlinePayload(p.GetAddressByteSize());
+             m_process = &p;
+         }
+          
+         size_t
+         GetNumIndexes ()
+         {
+             return m_count;
+         }
+          
+         lldb::ValueObjectSP
+         GetIndexAtIndex (size_t idx, const ClangASTType& desired_type)
+         {
+             std::pair<uint64_t, bool> 
value(_indexAtPositionForInlinePayload(idx));
+             if (!value.second)
+                 return nullptr;
+             Value v;
+             if (m_ptr_size == 8)
+             {
+                 Scalar scalar( (unsigned long long)value.first );
+                 v = Value(scalar);
+             }
+             else
+             {
+                 Scalar scalar( (unsigned int)value.first );
+                 v = Value(scalar);
+             }
+             v.SetClangType(desired_type);
+             StreamString idx_name;
+             idx_name.Printf("[%" PRIu64 "]", (uint64_t)idx);
+             return ValueObjectConstResult::Create(m_process, v, 
ConstString(idx_name.GetData()));
+         }
+                
+         private:
+         uint64_t m_indexes;
+         size_t m_count;
+         uint32_t m_ptr_size;
+         Process *m_process;
+                
+         // cfr. Foundation for the details of this code
+         size_t _lengthForInlinePayload(uint32_t ptr_size) {
+             m_ptr_size = ptr_size;
+             if (m_ptr_size == 8)
+                 m_count = ((m_indexes >> 3) & 0x7);
+             else
+                 m_count = ((m_indexes >> 3) & 0x3);
+             return m_count;
+         }
+                
+         std::pair<uint64_t, bool>
+         _indexAtPositionForInlinePayload(size_t pos) {
+             if (m_ptr_size == 8)
+             {
+               switch (pos) {
+               case 5: return {((m_indexes >> 51) & 0x1ff),true};
+               case 4: return {((m_indexes >> 42) & 0x1ff),true};
+               case 3: return {((m_indexes >> 33) & 0x1ff),true};
+               case 2: return {((m_indexes >> 24) & 0x1ff),true};
+               case 1: return {((m_indexes >> 15) & 0x1ff),true};
+               case 0: return {((m_indexes >>  6) & 0x1ff),true};
+               }
+             }
+             else
+             {
+                 switch (pos) {
+                 case 2: return {((m_indexes >> 23) & 0x1ff),true};
+                 case 1: return {((m_indexes >> 14) & 0x1ff),true};
+                 case 0: return {((m_indexes >>  5) & 0x1ff),true};
+                 }
+             }
+             return {0,false};
+         }
+
+       };
+        struct OutsourcedIndexes {
+           ValueObject *m_indexes;
+           size_t m_count;
+                
+           lldb::ValueObjectSP
+           GetIndexAtIndex (size_t idx)
+           {
+               if (m_indexes)
+               {
+                   ValueObjectSP 
index_sp(m_indexes->GetSyntheticArrayMemberFromPointer(idx, true));
+                   return index_sp;
+               }
+               return nullptr;
+           }
+       };
+
+        union {
+           struct InlinedIndexes m_inlined;
+           struct OutsourcedIndexes m_outsourced;
         };
     } m_impl;
     


_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits

Reply via email to