[Lldb-commits] [lldb] r167473 - in /lldb/trunk: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp test/lang/c/bitfields/TestBitfields.py test/lang/c/bitfields/main.c

Greg Clayton gclayton at apple.com
Tue Nov 6 10:22:59 PST 2012


Author: gclayton
Date: Tue Nov  6 12:22:59 2012
New Revision: 167473

URL: http://llvm.org/viewvc/llvm-project?rev=167473&view=rev
Log:
Added unnamed bitfields to our bitfield test.


Modified:
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
    lldb/trunk/test/lang/c/bitfields/TestBitfields.py
    lldb/trunk/test/lang/c/bitfields/main.c

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=167473&r1=167472&r2=167473&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Tue Nov  6 12:22:59 2012
@@ -1813,7 +1813,6 @@
                                         
                                         if (unnamed_bit_size > 0)
                                         {
-                                            //printf ("0x%8.8x: Unnamed bitfield added bit_size = 0x%x, bit_offset = 0x%x\n", die->GetOffset(), unnamed_bit_size, unnamed_bit_offset);
                                             clang::FieldDecl *unnamed_bitfield_decl = GetClangASTContext().AddFieldToRecordType (class_clang_type,
                                                                                                                                  NULL,
                                                                                                                                  member_type->GetClangLayoutType(),

Modified: lldb/trunk/test/lang/c/bitfields/TestBitfields.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/c/bitfields/TestBitfields.py?rev=167473&r1=167472&r2=167473&view=diff
==============================================================================
--- lldb/trunk/test/lang/c/bitfields/TestBitfields.py (original)
+++ lldb/trunk/test/lang/c/bitfields/TestBitfields.py Tue Nov  6 12:22:59 2012
@@ -113,15 +113,14 @@
         frame = thread.GetFrameAtIndex(0)
         bits = frame.FindVariable("bits")
         self.DebugSBValue(bits)
-        self.assertTrue(bits.GetTypeName() == "Bits" and
-                        bits.GetNumChildren() == 8 and
-                        bits.GetByteSize() == 32,
-                        "(Bits)bits with byte size of 32 and 8 children")
+        self.assertTrue(bits.GetTypeName() == 'Bits', "bits.GetTypeName() == 'Bits'");
+        self.assertTrue(bits.GetNumChildren() == 10, "bits.GetNumChildren() == 10");
+        self.assertTrue(bits.GetByteSize() == 32, "bits.GetByteSize() == 32");
 
         # Notice the pattern of int(b1.GetValue(), 0).  We pass a base of 0
         # so that the proper radix is determined based on the contents of the
         # string.
-        b1 = bits.GetChildAtIndex(0)
+        b1 = bits.GetChildMemberWithName("b1")
         self.DebugSBValue(b1)
         self.assertTrue(b1.GetName() == "b1" and
                         b1.GetTypeName() == "uint32_t:1" and
@@ -129,7 +128,7 @@
                         int(b1.GetValue(), 0) == 1,
                         'bits.b1 has type uint32_t:1, is in scope, and == 1')
 
-        b7 = bits.GetChildAtIndex(6)
+        b7 = bits.GetChildMemberWithName("b7")
         self.DebugSBValue(b7)
         self.assertTrue(b7.GetName() == "b7" and
                         b7.GetTypeName() == "uint32_t:7" and
@@ -137,7 +136,7 @@
                         int(b7.GetValue(), 0) == 127,
                         'bits.b7 has type uint32_t:7, is in scope, and == 127')
 
-        four = bits.GetChildAtIndex(7)
+        four = bits.GetChildMemberWithName("four")
         self.DebugSBValue(four)
         self.assertTrue(four.GetName() == "four" and
                         four.GetTypeName() == "uint32_t:4" and

Modified: lldb/trunk/test/lang/c/bitfields/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/c/bitfields/main.c?rev=167473&r1=167472&r2=167473&view=diff
==============================================================================
--- lldb/trunk/test/lang/c/bitfields/main.c (original)
+++ lldb/trunk/test/lang/c/bitfields/main.c Tue Nov  6 12:22:59 2012
@@ -12,9 +12,12 @@
 {
     struct Bits
     {
-        uint32_t    b1 : 1,
+        uint32_t    : 1, // Unnamed bitfield
+                    b1 : 1,
                     b2 : 2,
+                    : 2, // Unnamed bitfield
                     b3 : 3,
+                    : 2, // Unnamed bitfield (this will get removed)
                     b4 __attribute__ ((align(16))),
                     b5 : 5,
                     b6 : 6,





More information about the lldb-commits mailing list