AST fuzzer: fix change unary operator mutation

The "change unary operator" mutation now ignores the indirection
operator.

Fixes: tint:1631
Change-Id: Ie1878d8bf65807f3319858b62292bc97fba81044
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97680
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Alastair Donaldson <allydonaldson@googlemail.com>
This commit is contained in:
Alastair F. Donaldson 2022-08-02 15:42:21 +00:00 committed by Dawn LUCI CQ
parent 27343ffdb3
commit 24d36b0227
1 changed files with 6 additions and 0 deletions

View File

@ -50,6 +50,12 @@ MutationList MutationFinderChangeUnaryOperators::FindMutations(
continue;
}
// Only complement and negation operators can be swapped.
if (!(unary_expr->op == ast::UnaryOp::kComplement ||
unary_expr->op == ast::UnaryOp::kNegation)) {
continue;
}
result.push_back(std::make_unique<MutationChangeUnaryOperator>(
node_id_map->GetId(unary_expr),
MutationChangeUnaryOperator::ToggleOperator(unary_expr->op)));