[Lldb-commits] [lldb] r166450 - in /lldb/trunk: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp test/lang/c/struct_types/TestStructTypes.py test/lang/c/struct_types/main.c

Sean Callanan scallanan at apple.com
Mon Oct 22 16:56:48 PDT 2012


Author: spyffe
Date: Mon Oct 22 18:56:48 2012
New Revision: 166450

URL: http://llvm.org/viewvc/llvm-project?rev=166450&view=rev
Log:
Added support for zero-length arrays at the end
of structures, and added a testcase.

<rdar://problem/12551591>

Modified:
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
    lldb/trunk/test/lang/c/struct_types/TestStructTypes.py
    lldb/trunk/test/lang/c/struct_types/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=166450&r1=166449&r2=166450&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Mon Oct 22 18:56:48 2012
@@ -4085,8 +4085,7 @@
                     if (upper_bound > lower_bound)
                         num_elements = upper_bound - lower_bound + 1;
 
-                    if (num_elements > 0)
-                        element_orders.push_back (num_elements);
+                    element_orders.push_back (num_elements);
                 }
             }
             break;

Modified: lldb/trunk/test/lang/c/struct_types/TestStructTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/c/struct_types/TestStructTypes.py?rev=166450&r1=166449&r2=166450&view=diff
==============================================================================
--- lldb/trunk/test/lang/c/struct_types/TestStructTypes.py (original)
+++ lldb/trunk/test/lang/c/struct_types/TestStructTypes.py Mon Oct 22 18:56:48 2012
@@ -55,6 +55,11 @@
         self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
             substrs = [' resolved, hit count = 1'])
 
+        # The padding should be an array of size 0
+        self.expect("image lookup -t point_tag",
+            DATA_TYPES_DISPLAYED_CORRECTLY,
+            substrs = ['padding[0]'])
+
 
 if __name__ == '__main__':
     import atexit

Modified: lldb/trunk/test/lang/c/struct_types/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/c/struct_types/main.c?rev=166450&r1=166449&r2=166450&view=diff
==============================================================================
--- lldb/trunk/test/lang/c/struct_types/main.c (original)
+++ lldb/trunk/test/lang/c/struct_types/main.c Mon Oct 22 18:56:48 2012
@@ -10,15 +10,15 @@
 {
     struct point_tag {
         int x;
-        char padding[0];
         int y;
+        char padding[0];
     }; // Set break point at this line.
 
     struct rect_tag {
         struct point_tag bottom_left;
         struct point_tag top_right;
     };
-    struct point_tag pt = { 2, {}, 3 }; // This is the first executable statement.
-    struct rect_tag rect = {{1, {}, 2}, {3, {}, 4}};
+    struct point_tag pt = { 2, 3, {} }; // This is the first executable statement.
+    struct rect_tag rect = {{1, 2, {}}, {3, 4, {}}};
     return 0;
 }





More information about the lldb-commits mailing list