blob: 0a5951fc24b48b85f3f1647d3ddb484ff62f99a7 [file] [log] [blame]
// Copyright 2021 The Tint Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package tint.fuzzers.ast_fuzzer.protobufs;
message Mutation {
oneof mutation {
MutationReplaceIdentifier replace_identifier = 1;
MutationChangeBinaryOperator change_binary_operator = 2;
MutationWrapUnaryOperator wrap_unary_operator = 3;
};
}
message MutationSequence {
repeated Mutation mutation = 1;
}
message MutatorState {
// Contains the state of the fuzzer.
// The program that is being fuzzed. This can be either
// the original program (if mutation sequence is available) or
// the mutated version (if mutations are being recorded).
string program = 1;
// The sequence of mutations that was applied to the `program`.
// This may not have any mutations if they are not being recorded.
MutationSequence mutation_sequence = 2;
}
message MutationReplaceIdentifier {
// This transformation replaces a use of one variable with another.
// The id of the use of a variable in the AST.
uint32 use_id = 1;
// The id of a definition of a variable to replace the use with.
uint32 replacement_id = 2;
}
message MutationChangeBinaryOperator {
// This transformation replaces one binary operator with another.
// The id of a binary expression in the AST.
uint32 binary_expr_id = 1;
// A BinaryOp representing the new binary operator.
uint32 new_operator = 2;
}
message MutationWrapUnaryOperator {
// This transformation wraps an expression with a allowed unary
// expression operator.
// The id of the expression.
uint32 expression_id = 1;
// A fresh id for the created unary expression.
uint32 fresh_id = 2;
// The unary operator to wrap the expression with.
uint32 unary_op_wrapper = 3;
}