writer/spriv: Add an assert that functions_ is not empty
... before attempting to push instructions to `functions_.back()` If this fires, we're in an invalid state anyway. At least make the explosion less head scratching. Change-Id: I7b4a002043de4b55a12d9aba80a0393c630140c2 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/33664 Commit-Queue: David Neto <dneto@google.com> Reviewed-by: David Neto <dneto@google.com>
This commit is contained in:
parent
1ed92b2a9d
commit
8282262304
|
@ -175,11 +175,13 @@ class Builder {
|
||||||
/// @param op the operation
|
/// @param op the operation
|
||||||
/// @param operands the operands
|
/// @param operands the operands
|
||||||
void push_function_inst(spv::Op op, const OperandList& operands) {
|
void push_function_inst(spv::Op op, const OperandList& operands) {
|
||||||
|
assert(!functions_.empty());
|
||||||
functions_.back().push_inst(op, operands);
|
functions_.back().push_inst(op, operands);
|
||||||
}
|
}
|
||||||
/// Pushes a variable to the current function
|
/// Pushes a variable to the current function
|
||||||
/// @param operands the variable operands
|
/// @param operands the variable operands
|
||||||
void push_function_var(const OperandList& operands) {
|
void push_function_var(const OperandList& operands) {
|
||||||
|
assert(!functions_.empty());
|
||||||
functions_.back().push_var(operands);
|
functions_.back().push_var(operands);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue