File tree Expand file tree Collapse file tree 3 files changed +14
-10
lines changed Expand file tree Collapse file tree 3 files changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -63,8 +63,8 @@ pub const APValueKind = enum(c_int) {
63
63
};
64
64
65
65
pub const APValue = extern struct {
66
- Kind : APValueKind ,
67
- Data : if (builtin.os.tag == .windows and ( builtin .abi == .msvc or builtin . abi == .itanium )) [ 52 ]u8 else [68 ]u8 ,
66
+ Kind : APValueKind align ( if ( builtin.cpu.arch == .x86 and builtin . os . tag != .windows ) 4 else 8 ) ,
67
+ Data : if (builtin.cpu.arch == .x86 and builtin .os . tag != .windows ) [ 44 ]u8 else [52 ]u8 ,
68
68
69
69
pub const getKind = ZigClangAPValue_getKind ;
70
70
extern fn ZigClangAPValue_getKind (* const APValue ) APValueKind ;
Original file line number Diff line number Diff line change @@ -2329,6 +2329,7 @@ static_assert((clang::UnaryExprOrTypeTrait)ZigClangUnaryExprOrTypeTrait_Kind::Zi
2329
2329
static_assert ((clang::UnaryExprOrTypeTrait)ZigClangUnaryExprOrTypeTrait_Kind::ZigClangUnaryExprOrTypeTrait_KindOpenMPRequiredSimdAlign == clang::UnaryExprOrTypeTrait::UETT_OpenMPRequiredSimdAlign, "");
2330
2330
2331
2331
static_assert (sizeof (ZigClangAPValue) == sizeof(clang::APValue), "");
2332
+ static_assert (alignof (ZigClangAPValue) == alignof(clang::APValue), "");
2332
2333
2333
2334
static_assert (sizeof (ZigClangSourceLocation) == sizeof(clang::SourceLocation), "");
2334
2335
static ZigClangSourceLocation bitcast (clang::SourceLocation src) {
Original file line number Diff line number Diff line change 9
9
#define ZIG_ZIG_CLANG_H
10
10
11
11
#include <inttypes.h>
12
+ #include <stdalign.h>
12
13
#include <stdbool.h>
13
14
#include <stddef.h>
14
15
@@ -65,16 +66,18 @@ enum ZigClangAPValueKind {
65
66
ZigClangAPValueAddrLabelDiff ,
66
67
};
67
68
68
- struct ZigClangAPValue {
69
- enum ZigClangAPValueKind Kind ;
70
- // experimentally-derived size of clang::APValue::DataType
71
- #if defined(_WIN32 ) && defined(_MSC_VER )
72
- char Data [52 ];
73
- #elif defined(__i386__ ) && !defined(_WIN32 )
74
- char Data [44 ];
69
+ #if defined(__i386__ ) && !defined(_WIN32 )
70
+ # define ZIG_CLANG_APVALUE_SIZE 44
71
+ # define ZIG_CLANG_APVALUE_ALIGN 4
75
72
#else
76
- char Data [52 ];
73
+ # define ZIG_CLANG_APVALUE_SIZE 52
74
+ # define ZIG_CLANG_APVALUE_ALIGN 8
77
75
#endif
76
+
77
+ struct alignas (ZIG_CLANG_APVALUE_ALIGN ) ZigClangAPValue {
78
+ enum ZigClangAPValueKind Kind ;
79
+ // experimentally-derived size of clang::APValue::DataType
80
+ char Data [ZIG_CLANG_APVALUE_SIZE ];
78
81
};
79
82
80
83
struct ZigClangExprEvalResult {
You can’t perform that action at this time.
0 commit comments