Value: hash lazy_align

This commit is contained in:
Veikka Tuominen 2022-03-27 21:05:42 +03:00
parent bda7993beb
commit 7217148edf
2 changed files with 11 additions and 3 deletions

View File

@ -613,7 +613,8 @@ fn addCxxKnownPath(
ctx.cxx_compiler,
b.fmt("-print-file-name={s}", .{objname}),
});
const path_unpadded = mem.tokenize(u8, path_padded, "\r\n").next().?;
var tokenizer = mem.tokenize(u8, path_padded, "\r\n");
const path_unpadded = tokenizer.next().?;
if (mem.eql(u8, path_unpadded, objname)) {
if (errtxt) |msg| {
std.debug.print("{s}", .{msg});

View File

@ -461,7 +461,7 @@ pub const Value = extern union {
=> unreachable,
.ty, .lazy_align => {
const payload = self.castTag(.ty).?;
const payload = self.cast(Payload.Ty).?;
const new_payload = try arena.create(Payload.Ty);
new_payload.* = .{
.base = payload.base,
@ -718,7 +718,7 @@ pub const Value = extern union {
.lazy_align => {
try out_stream.writeAll("@alignOf(");
try val.castTag(.lazy_align).?.data.dump("", options, out_stream);
try out_stream.writeAll(")");
return try out_stream.writeAll(")");
},
.int_type => {
const int_type = val.castTag(.int_type).?.data;
@ -2478,6 +2478,13 @@ pub const Value = extern union {
.the_only_possible_value,
=> return hashInt(ptr_val, hasher, target),
.lazy_align => {
// Bit weird to have this here but this function is also called
// on integers.
const ty = ptr_val.castTag(.lazy_align).?.data;
ty.hashWithHasher(hasher, target);
},
else => unreachable,
}
}