mstorsjo wrote:

This static assert fails on 32 bit Windows: 
https://github.com/mstorsjo/llvm-mingw/actions/runs/26795477370/job/79006149129

It seems like the class ends up with size 56 rather than 52 on 32 bit Windows 
(while it does match the expected 80 bytes on 64 bit Windows). Both mingw style 
builds, with Itanium C++ ABI, and MSVC C++ ABI, seem to end up at the same 56 
bytes for this class. I haven't looked closely at why this happens. The main 
difference usually is in how bitfields are packed, but the one case of bitfield 
here seems like it should behave the same as on unix.

We can go with a fix like this:
```diff
diff --git a/lldb/include/lldb/Symbol/Symbol.h 
b/lldb/include/lldb/Symbol/Symbol.h
index 2f232346a282..92100d9a68e5 100644
--- a/lldb/include/lldb/Symbol/Symbol.h
+++ b/lldb/include/lldb/Symbol/Symbol.h
@@ -365,10 +365,17 @@ static_assert(
     sizeof(lldb_private::Symbol) == 80,
     "Symbol is a high volume data type, size must be increased with care");
 #elif __SIZEOF_POINTER__ == 4
+#ifdef _WIN32
+static_assert(
+    sizeof(lldb_private::Symbol) == 56,
+    "Symbol is a high volume data type, size must be increased with care");
+#endif
+#else
 static_assert(
     sizeof(lldb_private::Symbol) == 52,
     "Symbol is a high volume data type, size must be increased with care");
 #endif
+#endif
 
 namespace llvm {
 namespace json {
```
Or we could just do a `#elif __SIZEOF_POINTER__ == 4 && !defined(_WIN32)` and 
simply not bother with tracking the size specifically on 32 bit Windows (as few 
probably care about that these days) - the static asserts for other platforms 
probably are enough for keeping track of not accidentally inflating the class 
anyway.

https://github.com/llvm/llvm-project/pull/200919
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to