Define different struct size for APValue on Windows (thanks @Sahnvour)

This commit is contained in:
hryx 2019-06-29 14:34:00 -07:00
parent 247e567422
commit 0e38f7215b
No known key found for this signature in database
GPG Key ID: 6A2784E15D7D95D6
2 changed files with 9 additions and 2 deletions

View File

@ -1,3 +1,5 @@
const builtin = @import("builtin");
pub const struct_ZigClangAPSInt = @OpaqueType();
pub const struct_ZigClangAPFloat = @OpaqueType();
pub const struct_ZigClangASTContext = @OpaqueType();
@ -938,7 +940,7 @@ pub const struct_ZigClangExprEvalResult = extern struct {
pub const struct_ZigClangAPValue = extern struct {
Kind: ZigClangAPValue_ValueKind,
Data: [68]u8, // TODO: is there a way to statically assert that this matches the .h?
Data: if (builtin.os == .windows) [52]u8 else [68]u8,
};
pub const ZigClangAPValue_ValueKind = extern enum {

View File

@ -47,7 +47,12 @@ enum ZigClangAPValue_ValueKind {
struct ZigClangAPValue {
enum ZigClangAPValue_ValueKind Kind;
char Data[68]; // experimentally-derived size of clang::APValue::DataType
// experimentally-derived size of clang::APValue::DataType
#ifdef _WIN32
char Data[52];
#else
char Data[68];
#endif
};
struct ZigClangExprEvalResult {