mirror of
https://github.com/ziglang/zig.git
synced 2026-01-03 03:53:20 +00:00
LLVM: Assign correct values to enum/union tags
This commit is contained in:
parent
955fd65cb1
commit
8feae5d2d5
@ -1051,7 +1051,13 @@ pub const Attribute = union(Kind) {
|
||||
.no_sanitize_hwaddress,
|
||||
.sanitize_address_dyninit,
|
||||
=> |kind| {
|
||||
const field = @typeInfo(Attribute).Union.fields[@intFromEnum(kind)];
|
||||
const field = comptime blk: {
|
||||
@setEvalBranchQuota(10_000);
|
||||
inline for (@typeInfo(Attribute).Union.fields) |field| {
|
||||
if (std.mem.eql(u8, field.name, @tagName(kind))) break :blk field;
|
||||
}
|
||||
unreachable;
|
||||
};
|
||||
comptime assert(std.mem.eql(u8, @tagName(kind), field.name));
|
||||
return @unionInit(Attribute, field.name, switch (field.type) {
|
||||
void => {},
|
||||
@ -1255,100 +1261,100 @@ pub const Attribute = union(Kind) {
|
||||
|
||||
pub const Kind = enum(u32) {
|
||||
// Parameter Attributes
|
||||
zeroext,
|
||||
signext,
|
||||
inreg,
|
||||
byval,
|
||||
byref,
|
||||
preallocated,
|
||||
inalloca,
|
||||
sret,
|
||||
elementtype,
|
||||
@"align",
|
||||
@"noalias",
|
||||
nocapture,
|
||||
nofree,
|
||||
nest,
|
||||
returned,
|
||||
nonnull,
|
||||
dereferenceable,
|
||||
dereferenceable_or_null,
|
||||
swiftself,
|
||||
swiftasync,
|
||||
swifterror,
|
||||
immarg,
|
||||
noundef,
|
||||
nofpclass,
|
||||
alignstack,
|
||||
allocalign,
|
||||
allocptr,
|
||||
readnone,
|
||||
readonly,
|
||||
writeonly,
|
||||
zeroext = 34,
|
||||
signext = 24,
|
||||
inreg = 5,
|
||||
byval = 3,
|
||||
byref = 69,
|
||||
preallocated = 65,
|
||||
inalloca = 38,
|
||||
sret = 29, // TODO: ?
|
||||
elementtype = 77,
|
||||
@"align" = 1,
|
||||
@"noalias" = 9,
|
||||
nocapture = 11,
|
||||
nofree = 62,
|
||||
nest = 8,
|
||||
returned = 22,
|
||||
nonnull = 39,
|
||||
dereferenceable = 41,
|
||||
dereferenceable_or_null = 42,
|
||||
swiftself = 46,
|
||||
swiftasync = 75,
|
||||
swifterror = 47,
|
||||
immarg = 60,
|
||||
noundef = 68,
|
||||
nofpclass = 87,
|
||||
alignstack = 25,
|
||||
allocalign = 80,
|
||||
allocptr = 81,
|
||||
readnone = 20,
|
||||
readonly = 21,
|
||||
writeonly = 52,
|
||||
|
||||
// Function Attributes
|
||||
//alignstack,
|
||||
allockind,
|
||||
allocsize,
|
||||
alwaysinline,
|
||||
builtin,
|
||||
cold,
|
||||
convergent,
|
||||
disable_sanitizer_information,
|
||||
fn_ret_thunk_extern,
|
||||
hot,
|
||||
inlinehint,
|
||||
jumptable,
|
||||
memory,
|
||||
minsize,
|
||||
naked,
|
||||
nobuiltin,
|
||||
nocallback,
|
||||
noduplicate,
|
||||
allockind = 82,
|
||||
allocsize = 51,
|
||||
alwaysinline = 2,
|
||||
builtin = 35,
|
||||
cold = 36,
|
||||
convergent = 43,
|
||||
disable_sanitizer_information = 78,
|
||||
fn_ret_thunk_extern = 84,
|
||||
hot = 72,
|
||||
inlinehint = 4,
|
||||
jumptable = 40,
|
||||
memory = 86,
|
||||
minsize = 6,
|
||||
naked = 7,
|
||||
nobuiltin = 10,
|
||||
nocallback = 71,
|
||||
noduplicate = 12,
|
||||
//nofree,
|
||||
noimplicitfloat,
|
||||
@"noinline",
|
||||
nomerge,
|
||||
nonlazybind,
|
||||
noprofile,
|
||||
skipprofile,
|
||||
noredzone,
|
||||
noreturn,
|
||||
norecurse,
|
||||
willreturn,
|
||||
nosync,
|
||||
nounwind,
|
||||
nosanitize_bounds,
|
||||
nosanitize_coverage,
|
||||
null_pointer_is_valid,
|
||||
optforfuzzing,
|
||||
optnone,
|
||||
optsize,
|
||||
noimplicitfloat = 13,
|
||||
@"noinline" = 14,
|
||||
nomerge = 66,
|
||||
nonlazybind = 15,
|
||||
noprofile = 73,
|
||||
skipprofile = 85,
|
||||
noredzone = 16,
|
||||
noreturn = 17,
|
||||
norecurse = 48,
|
||||
willreturn = 61,
|
||||
nosync = 63,
|
||||
nounwind = 18,
|
||||
nosanitize_bounds = 79,
|
||||
nosanitize_coverage = 76,
|
||||
null_pointer_is_valid = 67,
|
||||
optforfuzzing = 57,
|
||||
optnone = 37,
|
||||
optsize = 19,
|
||||
//preallocated,
|
||||
returns_twice,
|
||||
safestack,
|
||||
sanitize_address,
|
||||
sanitize_memory,
|
||||
sanitize_thread,
|
||||
sanitize_hwaddress,
|
||||
sanitize_memtag,
|
||||
speculative_load_hardening,
|
||||
speculatable,
|
||||
ssp,
|
||||
sspstrong,
|
||||
sspreq,
|
||||
strictfp,
|
||||
uwtable,
|
||||
nocf_check,
|
||||
shadowcallstack,
|
||||
mustprogress,
|
||||
vscale_range,
|
||||
returns_twice = 23,
|
||||
safestack = 44,
|
||||
sanitize_address = 30,
|
||||
sanitize_memory = 32,
|
||||
sanitize_thread = 31,
|
||||
sanitize_hwaddress = 55,
|
||||
sanitize_memtag = 64,
|
||||
speculative_load_hardening = 59,
|
||||
speculatable = 53,
|
||||
ssp = 26,
|
||||
sspstrong = 28,
|
||||
sspreq = 27,
|
||||
strictfp = 54,
|
||||
uwtable = 33,
|
||||
nocf_check = 56,
|
||||
shadowcallstack = 58,
|
||||
mustprogress = 70,
|
||||
vscale_range = 74,
|
||||
|
||||
// Global Attributes
|
||||
no_sanitize_address,
|
||||
no_sanitize_hwaddress,
|
||||
no_sanitize_address = 100,
|
||||
no_sanitize_hwaddress = 101,
|
||||
//sanitize_memtag,
|
||||
sanitize_address_dyninit,
|
||||
sanitize_address_dyninit = 102,
|
||||
|
||||
string = std.math.maxInt(u31),
|
||||
none = std.math.maxInt(u32),
|
||||
@ -1709,18 +1715,18 @@ pub const FunctionAttributes = enum(u32) {
|
||||
}
|
||||
};
|
||||
|
||||
pub const Linkage = enum {
|
||||
private,
|
||||
internal,
|
||||
weak,
|
||||
weak_odr,
|
||||
linkonce,
|
||||
linkonce_odr,
|
||||
available_externally,
|
||||
appending,
|
||||
common,
|
||||
extern_weak,
|
||||
external,
|
||||
pub const Linkage = enum(u4) {
|
||||
private = 9,
|
||||
internal = 3,
|
||||
weak = 1,
|
||||
weak_odr = 10,
|
||||
linkonce = 4,
|
||||
linkonce_odr = 11,
|
||||
available_externally = 12,
|
||||
appending = 2,
|
||||
common = 8,
|
||||
extern_weak = 7,
|
||||
external = 0,
|
||||
|
||||
pub fn format(
|
||||
self: Linkage,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user