blob: 02e581c6ef6e818444828362a7bb9916d2c17b0d [file] [log] [blame]
// Copyright 2021 The Dawn & Tint Authors
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
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;
MutationChangeUnaryOperator change_unary_operator = 4;
MutationDeleteStatement delete_statement = 5;
};
}
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;
}
// Keep mutation messages in alphabetical order.
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 MutationChangeUnaryOperator {
// This transformation replaces one unary operator with another.
// The id of a unary expression in the AST.
uint32 unary_expr_id = 1;
// A UnaryOp representing the new unary operator.
uint32 new_operator = 2;
}
message MutationDeleteStatement {
// This transformation deletes a statement, as long as doing so does not
// invalidate the program.
// The id of a statement to be deleted.
uint32 statement_id = 1;
}
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 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;
}