Prefer trap to unreachable
This commit is contained in:
parent
38f6b3c1ab
commit
91038a2c65
@ -2025,7 +2025,7 @@ pub const Builder = struct {
|
|||||||
switch (function_prototype.attributes.naked) {
|
switch (function_prototype.attributes.naked) {
|
||||||
true => {
|
true => {
|
||||||
assert(return_type == .noreturn);
|
assert(return_type == .noreturn);
|
||||||
try builder.buildUnreachable(unit, context);
|
try builder.buildTrap(unit, context);
|
||||||
},
|
},
|
||||||
false => switch (return_type) {
|
false => switch (return_type) {
|
||||||
.void => {
|
.void => {
|
||||||
@ -2037,7 +2037,7 @@ pub const Builder = struct {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
.noreturn => {
|
.noreturn => {
|
||||||
try builder.buildUnreachable(unit, context);
|
try builder.buildTrap(unit, context);
|
||||||
},
|
},
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
},
|
},
|
||||||
@ -6226,7 +6226,7 @@ pub const Builder = struct {
|
|||||||
try builder.appendInstruction(unit, context, instruction);
|
try builder.appendInstruction(unit, context, instruction);
|
||||||
|
|
||||||
if (function_prototype.return_type == .noreturn) {
|
if (function_prototype.return_type == .noreturn) {
|
||||||
try builder.buildUnreachable(unit, context);
|
try builder.buildTrap(unit, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
return .{
|
return .{
|
||||||
@ -6492,7 +6492,7 @@ pub const Builder = struct {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
.@"unreachable" => {
|
.@"unreachable" => {
|
||||||
try builder.buildUnreachable(unit, context);
|
try builder.buildTrap(unit, context);
|
||||||
},
|
},
|
||||||
.@"while" => {
|
.@"while" => {
|
||||||
assert(statement_node.left != .null);
|
assert(statement_node.left != .null);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user