[Lldb-commits] [lldb] 3d9a9fa - [lldb] Remove a wrong assert in TestStructTypes that checks that empty structs in C always have size 0

Raphael Isemann via lldb-commits lldb-commits at lists.llvm.org
Thu Jul 22 08:06:00 PDT 2021


Author: Raphael Isemann
Date: 2021-07-22T16:56:50+02:00
New Revision: 3d9a9fa6911a5228ce799a7c639e94d322678934

URL: https://github.com/llvm/llvm-project/commit/3d9a9fa6911a5228ce799a7c639e94d322678934
DIFF: https://github.com/llvm/llvm-project/commit/3d9a9fa6911a5228ce799a7c639e94d322678934.diff

LOG: [lldb] Remove a wrong assert in TestStructTypes that checks that empty structs in C always have size 0

D105471 fixes the way we assign sizes to empty structs in C mode. Instead of
just giving them a size 0, we instead use the size we get from DWARF if possible.

After landing D105471 the TestStructTypes test started failing on Windows. The
tests checked that the size of an empty C struct is 0 while the size LLDB now
reports is 4 bytes. It turns out that 4 bytes are the actual size Clang is using
for C structs with the MicrosoftRecordLayoutBuilder. The commit that introduced
that behaviour is 00a061dccc6671c96412d7b28ab2012963208579.

This patch removes that specific check from TestStructTypes. Note that D105471
added a series of tests that already cover this case (and the added checks
automatically adjust to whatever size the target compiler chooses for empty
structs).

Added: 
    

Modified: 
    lldb/test/API/lang/c/struct_types/main.c

Removed: 
    


################################################################################
diff  --git a/lldb/test/API/lang/c/struct_types/main.c b/lldb/test/API/lang/c/struct_types/main.c
index 08ef0a703f22b..e683c49108976 100644
--- a/lldb/test/API/lang/c/struct_types/main.c
+++ b/lldb/test/API/lang/c/struct_types/main.c
@@ -22,7 +22,6 @@ int main (int argc, char const *argv[])
 
     struct {} empty;
     //% self.expect("frame variable empty", substrs = ["empty = {}"])
-    //% self.expect("expression -- sizeof(empty)", substrs = ["= 0"])
 
     struct rect_tag {
         struct point_tag bottom_left;


        


More information about the lldb-commits mailing list