commit | 24d36b022747fddcd345eeecd0767ac68bcaf204 | [log] [tgz] |
---|---|---|
author | Alastair F. Donaldson <alastair.donaldson@imperial.ac.uk> | Tue Aug 02 15:42:21 2022 +0000 |
committer | Dawn LUCI CQ <dawn-scoped@luci-project-accounts.iam.gserviceaccount.com> | Tue Aug 02 15:42:21 2022 +0000 |
tree | b51ac00819916321cc91a217a1e9c0b365e16bb5 | |
parent | 27343ffdb3f76daf76229a93928ca28a0428764f [diff] |
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>
diff --git a/src/tint/fuzzers/tint_ast_fuzzer/mutation_finders/change_unary_operators.cc b/src/tint/fuzzers/tint_ast_fuzzer/mutation_finders/change_unary_operators.cc index fb3fb96..c8dff2c 100644 --- a/src/tint/fuzzers/tint_ast_fuzzer/mutation_finders/change_unary_operators.cc +++ b/src/tint/fuzzers/tint_ast_fuzzer/mutation_finders/change_unary_operators.cc
@@ -50,6 +50,12 @@ 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)));