reader/spirv: Handle parser error

MaybeEmitCombinatorialValue() didn't check that MakeOperand() or RectifySecondOperandSignedness() didn't error, leading to ICEs.

Bug: crbug.com/tint/804
Change-Id: Ic78487a70a591e718c7b5936c6678e7a19c4b626
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/51927
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
This commit is contained in:
Ben Clayton 2021-05-27 17:05:47 +00:00 committed by Tint LUCI CQ
parent 564000fdd3
commit 25b7d4064f
1 changed files with 3 additions and 0 deletions

View File

@ -3510,6 +3510,9 @@ TypedExpression FunctionEmitter::MaybeEmitCombinatorialValue(
auto arg0 = MakeOperand(inst, 0);
auto arg1 = parser_impl_.RectifySecondOperandSignedness(
inst, arg0.type, MakeOperand(inst, 1));
if (!arg0 || !arg1) {
return {};
}
auto* binary_expr = create<ast::BinaryExpression>(Source{}, binary_op,
arg0.expr, arg1.expr);
TypedExpression result{ast_type, binary_expr};