[Lldb-commits] [PATCH] D17107: [lldb] Unicode support on Win32

Zachary Turner via lldb-commits lldb-commits at lists.llvm.org
Thu Feb 11 11:52:29 PST 2016

zturner added inline comments.

Comment at: lldb/trunk/source/Host/common/FileSpec.cpp:108
@@ +107,3 @@
+        if (stat_result == 0)
+            *stats_ptr = *reinterpret_cast<struct stat *>(&file_stats);
+        return stat_result == 0;
cameron314 wrote:
> zturner wrote:
> > I don't think this line is correct.  The source and destination struct types do not always have the same layout, so I think you may need to copy the values out one by one.
> It's probably better if I copy the fields for the sake of forwards compatibility, but I checked the definitions of these structures and they should be 100% compatible. I'll make the change, though, the `reinterpret_cast` is really ugly.
Apparently the CRT uses a reinterpret_cast too.  As long as you put:

    static_assert(sizeof(struct stat) == sizeof(struct _stat64i32));

then the cast is probably fine.



More information about the lldb-commits mailing list