stage2: fix x86_64-windows C ABI

It didn't return integer status for pointers and also it incorrectly
returned memory for optionals sometimes.
This commit is contained in:
Andrew Kelley 2022-02-08 21:10:29 -07:00
parent 61ed4fe07a
commit e06ac9537e

View File

@ -18,10 +18,34 @@ pub fn classifyWindows(ty: Type, target: Target) Class {
else => return .memory,
}
return switch (ty.zigTypeTag()) {
.Int, .Bool, .Enum, .Void, .NoReturn, .ErrorSet, .Struct, .Union => .integer,
.Optional => if (ty.isPtrLikeOptional()) return .integer else return .memory,
.Pointer,
.Int,
.Bool,
.Enum,
.Void,
.NoReturn,
.ErrorSet,
.Struct,
.Union,
.Optional,
.Array,
.ErrorUnion,
.AnyFrame,
.Frame,
=> .integer,
.Float, .Vector => .sse,
else => unreachable,
.Type,
.ComptimeFloat,
.ComptimeInt,
.Undefined,
.Null,
.BoundFn,
.Fn,
.Opaque,
.EnumLiteral,
=> unreachable,
};
}