Condense namespaces in tint/fuzzers.

This PR condenses the namespaces in the tint/fuzzers folder.

Change-Id: I74d4db39e41d408a826bee89241c5752e1aa7df9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86036
Reviewed-by: Ben Clayton <bclayton@google.com>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
This commit is contained in:
dan sinclair 2022-04-07 17:46:04 +00:00 committed by Dawn LUCI CQ
parent d209379cd1
commit 62a1d7104f
104 changed files with 208 additions and 560 deletions

View File

@ -21,8 +21,7 @@
#include <string>
#include <utility>
namespace tint {
namespace fuzzers {
namespace tint::fuzzers {
namespace {
const char* const kHelpMessage = R"(
@ -112,5 +111,4 @@ CliParams ParseCliParams(int* argc, char** argv) {
return cli_params;
}
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers

View File

@ -17,8 +17,7 @@
#include <cstdint>
namespace tint {
namespace fuzzers {
namespace tint::fuzzers {
/// CLI parameters accepted by the fuzzer. Type -tint_help in the CLI to see the
/// help message
@ -40,7 +39,6 @@ struct CliParams {
/// @return parsed parameters.
CliParams ParseCliParams(int* argc, char** argv);
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers
#endif // SRC_TINT_FUZZERS_CLI_H_

View File

@ -25,8 +25,7 @@
#include "src/tint/writer/hlsl/generator.h"
#include "src/tint/writer/msl/generator.h"
namespace tint {
namespace fuzzers {
namespace tint::fuzzers {
/// Builder for generic pseudo-random data
class DataBuilder {
@ -240,7 +239,6 @@ class DataBuilder {
};
};
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers
#endif // SRC_TINT_FUZZERS_DATA_BUILDER_H_

View File

@ -15,8 +15,7 @@
#include "src/tint/fuzzers/fuzzer_init.h"
#include "src/tint/fuzzers/cli.h"
namespace tint {
namespace fuzzers {
namespace tint::fuzzers {
namespace {
CliParams cli_params;
@ -31,5 +30,4 @@ extern "C" int LLVMFuzzerInitialize(int* argc, char*** argv) {
return 0;
}
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers

View File

@ -17,13 +17,11 @@
#include "src/tint/fuzzers/cli.h"
namespace tint {
namespace fuzzers {
namespace tint::fuzzers {
/// Returns the common CliParams parsed and populated by LLVMFuzzerInitialize()
const CliParams& GetCliParams();
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers
#endif // SRC_TINT_FUZZERS_FUZZER_INIT_H_

View File

@ -19,8 +19,7 @@
#include "src/tint/utils/hash.h"
namespace tint {
namespace fuzzers {
namespace tint::fuzzers {
namespace {
@ -55,5 +54,4 @@ void MersenneTwisterEngine::RandomNBytes(uint8_t* dest, size_t n) {
std::independent_bits_engine<std::mt19937_64, 8, uint8_t>(engine_));
}
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers

View File

@ -19,8 +19,7 @@
#include "src/tint/fuzzers/random_generator_engine.h"
namespace tint {
namespace fuzzers {
namespace tint::fuzzers {
/// Standard MT based random number generation
class MersenneTwisterEngine : public RandomGeneratorEngine {
@ -55,7 +54,6 @@ class MersenneTwisterEngine : public RandomGeneratorEngine {
std::mt19937_64 engine_;
}; // class MersenneTwisterEngine
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers
#endif // SRC_TINT_FUZZERS_MERSENNE_TWISTER_ENGINE_H_

View File

@ -22,8 +22,7 @@
#include "src/tint/fuzzers/random_generator_engine.h"
#include "src/tint/utils/hash.h"
namespace tint {
namespace fuzzers {
namespace tint::fuzzers {
namespace {
@ -120,5 +119,4 @@ uint64_t RandomGenerator::CalculateSeed(const uint8_t* data, size_t size) {
auto hash_size = static_cast<size_t>(hash_end_i64) - hash_begin;
return HashBuffer(data + hash_begin, hash_size);
}
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers

View File

@ -21,8 +21,7 @@
#include "src/tint/fuzzers/random_generator_engine.h"
namespace tint {
namespace fuzzers {
namespace tint::fuzzers {
/// Pseudo random generator utility class for fuzzing
class RandomGenerator {
@ -112,7 +111,6 @@ class RandomGenerator {
std::unique_ptr<RandomGeneratorEngine> engine_;
}; // class RandomGenerator
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers
#endif // SRC_TINT_FUZZERS_RANDOM_GENERATOR_H_

View File

@ -14,13 +14,11 @@
#include "src/tint/fuzzers/random_generator_engine.h"
namespace tint {
namespace fuzzers {
namespace tint::fuzzers {
// Not in header to avoid weak vtable warnings from clang
RandomGeneratorEngine::RandomGeneratorEngine() = default;
RandomGeneratorEngine::~RandomGeneratorEngine() = default;
RandomGeneratorEngine::RandomGeneratorEngine(RandomGeneratorEngine&&) = default;
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers

View File

@ -19,8 +19,7 @@
#include <random>
#include <vector>
namespace tint {
namespace fuzzers {
namespace tint::fuzzers {
/// Wrapper interface around STL random number engine
class RandomGeneratorEngine {
@ -57,7 +56,6 @@ class RandomGeneratorEngine {
RandomGeneratorEngine& operator=(const RandomGeneratorEngine&) = delete;
}; // class RandomGeneratorEngine
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers
#endif // SRC_TINT_FUZZERS_RANDOM_GENERATOR_ENGINE_H_

View File

@ -20,8 +20,7 @@
#include "src/tint/fuzzers/mersenne_twister_engine.h"
namespace tint {
namespace fuzzers {
namespace tint::fuzzers {
namespace {
/// Implementation of RandomGeneratorEngine that just returns a stream of
@ -198,5 +197,4 @@ TEST_F(RandomGeneratorTest, GetRandomElement) {
}
} // namespace
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers

View File

@ -18,8 +18,7 @@
#include "src/tint/program_builder.h"
namespace tint {
namespace fuzzers {
namespace tint::fuzzers {
ShuffleTransform::ShuffleTransform(size_t seed) : seed_(seed) {}
@ -34,5 +33,4 @@ void ShuffleTransform::Run(CloneContext& ctx,
}
}
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers

View File

@ -17,8 +17,7 @@
#include "src/tint/transform/transform.h"
namespace tint {
namespace fuzzers {
namespace tint::fuzzers {
/// ShuffleTransform reorders the module scope declarations into a random order
class ShuffleTransform : public tint::transform::Transform {
@ -36,7 +35,6 @@ class ShuffleTransform : public tint::transform::Transform {
size_t seed_;
};
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers
#endif // SRC_TINT_FUZZERS_SHUFFLE_TRANSFORM_H_

View File

@ -17,8 +17,7 @@
#include "src/tint/fuzzers/tint_common_fuzzer.h"
#include "src/tint/fuzzers/transform_builder.h"
namespace tint {
namespace fuzzers {
namespace tint::fuzzers {
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
{
@ -81,5 +80,4 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
return 0;
}
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers

View File

@ -21,9 +21,7 @@
#include <string>
#include <utility>
namespace tint {
namespace fuzzers {
namespace ast_fuzzer {
namespace tint::fuzzers::ast_fuzzer {
namespace {
const char* const kHelpMessage = R"(
@ -162,6 +160,4 @@ CliParams ParseCliParams(int* argc, char** argv) {
return cli_params;
}
} // namespace ast_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::ast_fuzzer

View File

@ -17,9 +17,7 @@
#include <cstdint>
namespace tint {
namespace fuzzers {
namespace ast_fuzzer {
namespace tint::fuzzers::ast_fuzzer {
/// The backend this fuzzer will test.
enum class FuzzingTarget {
@ -65,8 +63,6 @@ struct CliParams {
/// @return parsed parameters.
CliParams ParseCliParams(int* argc, char** argv);
} // namespace ast_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::ast_fuzzer
#endif // SRC_TINT_FUZZERS_TINT_AST_FUZZER_CLI_H_

View File

@ -24,9 +24,7 @@
#include "src/tint/program.h"
#include "src/tint/reader/wgsl/parser.h"
namespace tint {
namespace fuzzers {
namespace ast_fuzzer {
namespace tint::fuzzers::ast_fuzzer {
namespace {
TEST(ExpressionSizeTest, Basic) {
@ -65,6 +63,4 @@ TEST(ExpressionSizeTest, Basic) {
}
} // namespace
} // namespace ast_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::ast_fuzzer

View File

@ -25,9 +25,7 @@
#include "src/tint/reader/wgsl/parser.h"
#include "src/tint/writer/wgsl/generator.h"
namespace tint {
namespace fuzzers {
namespace ast_fuzzer {
namespace tint::fuzzers::ast_fuzzer {
namespace {
CliParams cli_params{};
@ -129,6 +127,4 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
}
} // namespace
} // namespace ast_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::ast_fuzzer

View File

@ -20,9 +20,7 @@
#include "src/tint/fuzzers/tint_ast_fuzzer/mutations/replace_identifier.h"
#include "src/tint/fuzzers/tint_ast_fuzzer/mutations/wrap_unary_operator.h"
namespace tint {
namespace fuzzers {
namespace ast_fuzzer {
namespace tint::fuzzers::ast_fuzzer {
Mutation::~Mutation() = default;
@ -45,6 +43,4 @@ std::unique_ptr<Mutation> Mutation::FromMessage(
return nullptr;
}
} // namespace ast_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::ast_fuzzer

View File

@ -24,9 +24,7 @@
#include "src/tint/clone_context.h"
#include "src/tint/program.h"
namespace tint {
namespace fuzzers {
namespace ast_fuzzer {
namespace tint::fuzzers::ast_fuzzer {
/// The base class for all the mutations in the fuzzer. Children must override
/// three methods:
@ -79,8 +77,6 @@ class Mutation {
using MutationList = std::vector<std::unique_ptr<Mutation>>;
} // namespace ast_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::ast_fuzzer
#endif // SRC_TINT_FUZZERS_TINT_AST_FUZZER_MUTATION_H_

View File

@ -14,12 +14,8 @@
#include "src/tint/fuzzers/tint_ast_fuzzer/mutation_finder.h"
namespace tint {
namespace fuzzers {
namespace ast_fuzzer {
namespace tint::fuzzers::ast_fuzzer {
MutationFinder::~MutationFinder() = default;
} // namespace ast_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::ast_fuzzer

View File

@ -24,9 +24,7 @@
#include "src/tint/program.h"
namespace tint {
namespace fuzzers {
namespace ast_fuzzer {
namespace tint::fuzzers::ast_fuzzer {
/// Instances of this class traverse the `tint::Program`, looking for
/// opportunities to apply mutations and return them to the caller.
@ -70,8 +68,6 @@ class MutationFinder {
using MutationFinderList = std::vector<std::unique_ptr<MutationFinder>>;
} // namespace ast_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::ast_fuzzer
#endif // SRC_TINT_FUZZERS_TINT_AST_FUZZER_MUTATION_FINDER_H_

View File

@ -20,9 +20,7 @@
#include "src/tint/ast/binary_expression.h"
#include "src/tint/fuzzers/tint_ast_fuzzer/mutations/change_binary_operator.h"
namespace tint {
namespace fuzzers {
namespace ast_fuzzer {
namespace tint::fuzzers::ast_fuzzer {
MutationList MutationFinderChangeBinaryOperators::FindMutations(
const tint::Program& program,
@ -87,6 +85,4 @@ uint32_t MutationFinderChangeBinaryOperators::GetChanceOfApplyingMutation(
return probability_context->GetChanceOfChangingBinaryOperators();
}
} // namespace ast_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::ast_fuzzer

View File

@ -17,9 +17,7 @@
#include "src/tint/fuzzers/tint_ast_fuzzer/mutation_finder.h"
namespace tint {
namespace fuzzers {
namespace ast_fuzzer {
namespace tint::fuzzers::ast_fuzzer {
/// Looks for opportunities to apply `MutationChangeBinaryOperator`.
///
@ -35,8 +33,6 @@ class MutationFinderChangeBinaryOperators : public MutationFinder {
ProbabilityContext* probability_context) const override;
};
} // namespace ast_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::ast_fuzzer
#endif // SRC_TINT_FUZZERS_TINT_AST_FUZZER_MUTATION_FINDERS_CHANGE_BINARY_OPERATORS_H_

View File

@ -23,9 +23,7 @@
#include "src/tint/sem/statement.h"
#include "src/tint/sem/variable.h"
namespace tint {
namespace fuzzers {
namespace ast_fuzzer {
namespace tint::fuzzers::ast_fuzzer {
MutationList MutationFinderReplaceIdentifiers::FindMutations(
const tint::Program& program,
@ -74,6 +72,4 @@ uint32_t MutationFinderReplaceIdentifiers::GetChanceOfApplyingMutation(
return probability_context->GetChanceOfReplacingIdentifiers();
}
} // namespace ast_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::ast_fuzzer

View File

@ -17,9 +17,7 @@
#include "src/tint/fuzzers/tint_ast_fuzzer/mutation_finder.h"
namespace tint {
namespace fuzzers {
namespace ast_fuzzer {
namespace tint::fuzzers::ast_fuzzer {
/// Looks for opportunities to apply `MutationReplaceIdentifier`.
///
@ -35,8 +33,6 @@ class MutationFinderReplaceIdentifiers : public MutationFinder {
ProbabilityContext* probability_context) const override;
};
} // namespace ast_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::ast_fuzzer
#endif // SRC_TINT_FUZZERS_TINT_AST_FUZZER_MUTATION_FINDERS_REPLACE_IDENTIFIERS_H_

View File

@ -23,9 +23,7 @@
#include "src/tint/sem/expression.h"
#include "src/tint/sem/statement.h"
namespace tint {
namespace fuzzers {
namespace ast_fuzzer {
namespace tint::fuzzers::ast_fuzzer {
namespace {
const size_t kMaxExpressionSize = 50;
@ -87,6 +85,4 @@ uint32_t MutationFinderWrapUnaryOperators::GetChanceOfApplyingMutation(
return probability_context->GetChanceOfWrappingUnaryOperators();
}
} // namespace ast_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::ast_fuzzer

View File

@ -17,9 +17,7 @@
#include "src/tint/fuzzers/tint_ast_fuzzer/mutation_finder.h"
namespace tint {
namespace fuzzers {
namespace ast_fuzzer {
namespace tint::fuzzers::ast_fuzzer {
/// Looks for opportunities to apply
/// `MutationFinderWrapUnaryOperators`.
@ -36,8 +34,6 @@ class MutationFinderWrapUnaryOperators : public MutationFinder {
ProbabilityContext* probability_context) const override;
};
} // namespace ast_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::ast_fuzzer
#endif // SRC_TINT_FUZZERS_TINT_AST_FUZZER_MUTATION_FINDERS_WRAP_UNARY_OPERATORS_H_

View File

@ -18,9 +18,7 @@
#include "src/tint/sem/reference_type.h"
namespace tint {
namespace fuzzers {
namespace ast_fuzzer {
namespace tint::fuzzers::ast_fuzzer {
namespace {
@ -484,6 +482,4 @@ protobufs::Mutation MutationChangeBinaryOperator::ToMessage() const {
return mutation;
}
} // namespace ast_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::ast_fuzzer

View File

@ -21,9 +21,7 @@
#include "src/tint/program.h"
#include "src/tint/sem/variable.h"
namespace tint {
namespace fuzzers {
namespace ast_fuzzer {
namespace tint::fuzzers::ast_fuzzer {
/// @see MutationChangeBinaryOperator::Apply
class MutationChangeBinaryOperator : public Mutation {
@ -78,8 +76,6 @@ class MutationChangeBinaryOperator : public Mutation {
protobufs::MutationChangeBinaryOperator message_;
};
} // namespace ast_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::ast_fuzzer
#endif // SRC_TINT_FUZZERS_TINT_AST_FUZZER_MUTATIONS_CHANGE_BINARY_OPERATOR_H_

View File

@ -26,9 +26,7 @@
#include "src/tint/reader/wgsl/parser.h"
#include "src/tint/writer/wgsl/generator.h"
namespace tint {
namespace fuzzers {
namespace ast_fuzzer {
namespace tint::fuzzers::ast_fuzzer {
namespace {
std::string OpToString(ast::BinaryOp op) {
@ -719,6 +717,4 @@ TEST(ChangeBinaryOperatorTest, ShiftLeftShiftRight) {
}
} // namespace
} // namespace ast_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::ast_fuzzer

View File

@ -19,9 +19,7 @@
#include "src/tint/fuzzers/tint_ast_fuzzer/util.h"
#include "src/tint/program_builder.h"
namespace tint {
namespace fuzzers {
namespace ast_fuzzer {
namespace tint::fuzzers::ast_fuzzer {
MutationReplaceIdentifier::MutationReplaceIdentifier(
protobufs::MutationReplaceIdentifier message)
@ -101,6 +99,4 @@ protobufs::Mutation MutationReplaceIdentifier::ToMessage() const {
return mutation;
}
} // namespace ast_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::ast_fuzzer

View File

@ -19,9 +19,7 @@
#include "src/tint/sem/variable.h"
namespace tint {
namespace fuzzers {
namespace ast_fuzzer {
namespace tint::fuzzers::ast_fuzzer {
/// @see MutationReplaceIdentifier::Apply
class MutationReplaceIdentifier : public Mutation {
@ -70,8 +68,6 @@ class MutationReplaceIdentifier : public Mutation {
protobufs::MutationReplaceIdentifier message_;
};
} // namespace ast_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::ast_fuzzer
#endif // SRC_TINT_FUZZERS_TINT_AST_FUZZER_MUTATIONS_REPLACE_IDENTIFIER_H_

View File

@ -25,9 +25,7 @@
#include "src/tint/reader/wgsl/parser.h"
#include "src/tint/writer/wgsl/generator.h"
namespace tint {
namespace fuzzers {
namespace ast_fuzzer {
namespace tint::fuzzers::ast_fuzzer {
namespace {
TEST(ReplaceIdentifierTest, NotApplicable_Simple) {
@ -663,6 +661,4 @@ fn f() {
}
} // namespace
} // namespace ast_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::ast_fuzzer

View File

@ -19,9 +19,7 @@
#include "src/tint/program_builder.h"
namespace tint {
namespace fuzzers {
namespace ast_fuzzer {
namespace tint::fuzzers::ast_fuzzer {
MutationWrapUnaryOperator::MutationWrapUnaryOperator(
protobufs::MutationWrapUnaryOperator message)
@ -122,6 +120,4 @@ std::vector<ast::UnaryOp> MutationWrapUnaryOperator::GetValidUnaryWrapper(
return {};
}
} // namespace ast_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::ast_fuzzer

View File

@ -21,9 +21,7 @@
#include "src/tint/sem/variable.h"
namespace tint {
namespace fuzzers {
namespace ast_fuzzer {
namespace tint::fuzzers::ast_fuzzer {
/// @see MutationWrapUnaryOperator::Apply
class MutationWrapUnaryOperator : public Mutation {
@ -78,8 +76,6 @@ class MutationWrapUnaryOperator : public Mutation {
protobufs::MutationWrapUnaryOperator message_;
};
} // namespace ast_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::ast_fuzzer
#endif // SRC_TINT_FUZZERS_TINT_AST_FUZZER_MUTATIONS_WRAP_UNARY_OPERATOR_H_

View File

@ -24,9 +24,7 @@
#include "src/tint/reader/wgsl/parser.h"
#include "src/tint/writer/wgsl/generator.h"
namespace tint {
namespace fuzzers {
namespace ast_fuzzer {
namespace tint::fuzzers::ast_fuzzer {
namespace {
TEST(WrapUnaryOperatorTest, Applicable1) {
@ -543,6 +541,4 @@ TEST(WrapUnaryOperatorTest, NotApplicable6) {
}
} // namespace
} // namespace ast_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::ast_fuzzer

View File

@ -26,9 +26,7 @@
#include "src/tint/fuzzers/tint_ast_fuzzer/node_id_map.h"
#include "src/tint/program_builder.h"
namespace tint {
namespace fuzzers {
namespace ast_fuzzer {
namespace tint::fuzzers::ast_fuzzer {
namespace {
template <typename T, typename... Args>
@ -184,6 +182,4 @@ tint::Program Mutate(tint::Program program,
return program;
}
} // namespace ast_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::ast_fuzzer

View File

@ -23,9 +23,7 @@
#include "src/tint/program.h"
namespace tint {
namespace fuzzers {
namespace ast_fuzzer {
namespace tint::fuzzers::ast_fuzzer {
/// @file
/// @brief Tries to apply a `mutation` to the `program`.
@ -94,8 +92,6 @@ tint::Program Mutate(tint::Program program,
uint32_t max_applied_mutations,
protobufs::MutationSequence* mutation_sequence);
} // namespace ast_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::ast_fuzzer
#endif // SRC_TINT_FUZZERS_TINT_AST_FUZZER_MUTATOR_H_

View File

@ -16,9 +16,7 @@
#include <cassert>
namespace tint {
namespace fuzzers {
namespace ast_fuzzer {
namespace tint::fuzzers::ast_fuzzer {
NodeIdMap::NodeIdMap() = default;
@ -60,6 +58,4 @@ NodeIdMap::IdType NodeIdMap::TakeFreshId() {
return fresh_id_++;
}
} // namespace ast_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::ast_fuzzer

View File

@ -19,9 +19,7 @@
#include "src/tint/program.h"
namespace tint {
namespace fuzzers {
namespace ast_fuzzer {
namespace tint::fuzzers::ast_fuzzer {
/// Contains a one-to-one mapping between the nodes in the AST of the program
/// and their ids.
@ -89,8 +87,6 @@ class NodeIdMap {
std::unordered_map<IdType, const ast::Node*> id_to_node_;
};
} // namespace ast_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::ast_fuzzer
#endif // SRC_TINT_FUZZERS_TINT_AST_FUZZER_NODE_ID_MAP_H_

View File

@ -17,9 +17,7 @@
#include "src/tint/fuzzers/tint_ast_fuzzer/cli.h"
namespace tint {
namespace fuzzers {
namespace ast_fuzzer {
namespace tint::fuzzers::ast_fuzzer {
/// @brief Allows CLI parameters to be overridden.
///
@ -29,8 +27,6 @@ namespace ast_fuzzer {
/// @param cli_params - the parsed CLI parameters to be updated.
void OverrideCliParams(CliParams& cli_params);
} // namespace ast_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::ast_fuzzer
#endif // SRC_TINT_FUZZERS_TINT_AST_FUZZER_OVERRIDE_CLI_PARAMS_H_

View File

@ -16,9 +16,7 @@
#include <cassert>
namespace tint {
namespace fuzzers {
namespace ast_fuzzer {
namespace tint::fuzzers::ast_fuzzer {
namespace {
const std::pair<uint32_t, uint32_t> kChanceOfChangingBinaryOperators = {30, 90};
@ -45,6 +43,4 @@ uint32_t ProbabilityContext::RandomFromRange(
range.first, range.second + 1); // + 1 need since range is inclusive.
}
} // namespace ast_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::ast_fuzzer

View File

@ -20,9 +20,7 @@
#include "src/tint/fuzzers/random_generator.h"
namespace tint {
namespace fuzzers {
namespace ast_fuzzer {
namespace tint::fuzzers::ast_fuzzer {
/// This class is intended to be used by the `MutationFinder`s to introduce some
/// variance to the mutation process.
@ -82,8 +80,6 @@ class ProbabilityContext {
uint32_t chance_of_wrapping_unary_operators_;
};
} // namespace ast_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::ast_fuzzer
#endif // SRC_TINT_FUZZERS_TINT_AST_FUZZER_PROBABILITY_CONTEXT_H_

View File

@ -15,14 +15,10 @@
#include "src/tint/fuzzers/tint_ast_fuzzer/cli.h"
#include "src/tint/fuzzers/tint_ast_fuzzer/override_cli_params.h"
namespace tint {
namespace fuzzers {
namespace ast_fuzzer {
namespace tint::fuzzers::ast_fuzzer {
void OverrideCliParams(CliParams& /*unused*/) {
// Leave the CLI parameters unchanged.
}
} // namespace ast_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::ast_fuzzer

View File

@ -17,9 +17,7 @@
#include "src/tint/fuzzers/tint_ast_fuzzer/cli.h"
#include "src/tint/fuzzers/tint_ast_fuzzer/override_cli_params.h"
namespace tint {
namespace fuzzers {
namespace ast_fuzzer {
namespace tint::fuzzers::ast_fuzzer {
void OverrideCliParams(CliParams& cli_params) {
assert(cli_params.fuzzing_target == FuzzingTarget::kAll &&
@ -28,6 +26,4 @@ void OverrideCliParams(CliParams& cli_params) {
cli_params.fuzzing_target = FuzzingTarget::kHlsl;
}
} // namespace ast_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::ast_fuzzer

View File

@ -17,9 +17,7 @@
#include "src/tint/fuzzers/tint_ast_fuzzer/cli.h"
#include "src/tint/fuzzers/tint_ast_fuzzer/override_cli_params.h"
namespace tint {
namespace fuzzers {
namespace ast_fuzzer {
namespace tint::fuzzers::ast_fuzzer {
void OverrideCliParams(CliParams& cli_params) {
assert(cli_params.fuzzing_target == FuzzingTarget::kAll &&
@ -28,6 +26,4 @@ void OverrideCliParams(CliParams& cli_params) {
cli_params.fuzzing_target = FuzzingTarget::kMsl;
}
} // namespace ast_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::ast_fuzzer

View File

@ -17,9 +17,7 @@
#include "src/tint/fuzzers/tint_ast_fuzzer/cli.h"
#include "src/tint/fuzzers/tint_ast_fuzzer/override_cli_params.h"
namespace tint {
namespace fuzzers {
namespace ast_fuzzer {
namespace tint::fuzzers::ast_fuzzer {
void OverrideCliParams(CliParams& cli_params) {
assert(cli_params.fuzzing_target == FuzzingTarget::kAll &&
@ -28,6 +26,4 @@ void OverrideCliParams(CliParams& cli_params) {
cli_params.fuzzing_target = FuzzingTarget::kSpv;
}
} // namespace ast_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::ast_fuzzer

View File

@ -17,9 +17,7 @@
#include "src/tint/fuzzers/tint_ast_fuzzer/cli.h"
#include "src/tint/fuzzers/tint_ast_fuzzer/override_cli_params.h"
namespace tint {
namespace fuzzers {
namespace ast_fuzzer {
namespace tint::fuzzers::ast_fuzzer {
void OverrideCliParams(CliParams& cli_params) {
assert(cli_params.fuzzing_target == FuzzingTarget::kAll &&
@ -28,6 +26,4 @@ void OverrideCliParams(CliParams& cli_params) {
cli_params.fuzzing_target = FuzzingTarget::kWgsl;
}
} // namespace ast_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::ast_fuzzer

View File

@ -26,10 +26,7 @@
#include "src/tint/sem/statement.h"
#include "src/tint/sem/variable.h"
namespace tint {
namespace fuzzers {
namespace ast_fuzzer {
namespace util {
namespace tint::fuzzers::ast_fuzzer::util {
/// @file
/// @brief Returns all in-scope variables (including formal function parameters)
@ -101,9 +98,6 @@ std::vector<const sem::Variable*> GetAllVarsInScope(
return result;
}
} // namespace util
} // namespace ast_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::ast_fuzzer::util
#endif // SRC_TINT_FUZZERS_TINT_AST_FUZZER_UTIL_H_

View File

@ -16,8 +16,7 @@
#include "src/tint/fuzzers/tint_common_fuzzer.h"
#include "src/tint/fuzzers/transform_builder.h"
namespace tint {
namespace fuzzers {
namespace tint::fuzzers {
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
TransformBuilder tb(data, size);
@ -31,5 +30,4 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
return fuzzer.Run(data, size);
}
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers

View File

@ -32,8 +32,7 @@
#include "src/tint/program.h"
#include "src/tint/utils/hash.h"
namespace tint {
namespace fuzzers {
namespace tint::fuzzers {
namespace {
@ -346,5 +345,4 @@ void CommonFuzzer::RunInspector(Program* program) {
}
}
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers

View File

@ -26,8 +26,7 @@
#include "src/tint/fuzzers/data_builder.h"
namespace tint {
namespace fuzzers {
namespace tint::fuzzers {
// TODO(crbug.com/tint/1356): Add using shader reflection to generate options
// that are potentially valid for Generate*Options
@ -156,7 +155,6 @@ class CommonFuzzer {
void RunInspector(Program* program);
};
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers
#endif // SRC_TINT_FUZZERS_TINT_COMMON_FUZZER_H_

View File

@ -16,8 +16,7 @@
#include "src/tint/fuzzers/tint_common_fuzzer.h"
#include "src/tint/fuzzers/transform_builder.h"
namespace tint {
namespace fuzzers {
namespace tint::fuzzers {
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
TransformBuilder tb(data, size);
@ -31,5 +30,4 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
return fuzzer.Run(data, size);
}
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers

View File

@ -20,8 +20,7 @@
#include "src/tint/fuzzers/tint_common_fuzzer.h"
#include "src/tint/fuzzers/transform_builder.h"
namespace tint {
namespace fuzzers {
namespace tint::fuzzers {
/// Wrapper around the common fuzzing class for tint_*_reader_*_writter fuzzers
class ReaderWriterFuzzer : public CommonFuzzer {
@ -66,7 +65,6 @@ class ReaderWriterFuzzer : public CommonFuzzer {
std::unique_ptr<TransformBuilder> tb_;
};
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers
#endif // SRC_TINT_FUZZERS_TINT_READER_WRITER_FUZZER_H_

View File

@ -21,9 +21,7 @@
#include <string>
#include <utility>
namespace tint {
namespace fuzzers {
namespace regex_fuzzer {
namespace tint::fuzzers::regex_fuzzer {
namespace {
const char* const kHelpMessage = R"(
@ -121,6 +119,4 @@ CliParams ParseCliParams(int* argc, char** argv) {
return cli_params;
}
} // namespace regex_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::regex_fuzzer

View File

@ -17,9 +17,7 @@
#include <cstdint>
namespace tint {
namespace fuzzers {
namespace regex_fuzzer {
namespace tint::fuzzers::regex_fuzzer {
/// The backend this fuzzer will test.
enum class FuzzingTarget {
@ -57,8 +55,6 @@ struct CliParams {
/// @return parsed parameters.
CliParams ParseCliParams(int* argc, char** argv);
} // namespace regex_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::regex_fuzzer
#endif // SRC_TINT_FUZZERS_TINT_REGEX_FUZZER_CLI_H_

View File

@ -25,9 +25,7 @@
#include "src/tint/reader/wgsl/parser.h"
#include "src/tint/writer/wgsl/generator.h"
namespace tint {
namespace fuzzers {
namespace regex_fuzzer {
namespace tint::fuzzers::regex_fuzzer {
namespace {
CliParams cli_params{};
@ -151,6 +149,4 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
}
} // namespace
} // namespace regex_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::regex_fuzzer

View File

@ -17,9 +17,7 @@
#include "src/tint/fuzzers/tint_regex_fuzzer/cli.h"
namespace tint {
namespace fuzzers {
namespace regex_fuzzer {
namespace tint::fuzzers::regex_fuzzer {
/// @brief Allows CLI parameters to be overridden.
///
@ -29,8 +27,6 @@ namespace regex_fuzzer {
/// @param cli_params - the parsed CLI parameters to be updated.
void OverrideCliParams(CliParams& cli_params);
} // namespace regex_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::regex_fuzzer
#endif // SRC_TINT_FUZZERS_TINT_REGEX_FUZZER_OVERRIDE_CLI_PARAMS_H_

View File

@ -18,9 +18,7 @@
#include "src/tint/fuzzers/tint_regex_fuzzer/wgsl_mutator.h"
namespace tint {
namespace fuzzers {
namespace regex_fuzzer {
namespace tint::fuzzers::regex_fuzzer {
namespace {
// Swaps two non-consecutive regions in the edge
@ -516,6 +514,4 @@ TEST(TestInsertReturn, TestMissingSemicolon) {
}
} // namespace
} // namespace regex_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::regex_fuzzer

View File

@ -15,14 +15,10 @@
#include "src/tint/fuzzers/tint_regex_fuzzer/cli.h"
#include "src/tint/fuzzers/tint_regex_fuzzer/override_cli_params.h"
namespace tint {
namespace fuzzers {
namespace regex_fuzzer {
namespace tint::fuzzers::regex_fuzzer {
void OverrideCliParams(CliParams& /*unused*/) {
// Leave the CLI parameters unchanged.
}
} // namespace regex_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::regex_fuzzer

View File

@ -17,9 +17,7 @@
#include "src/tint/fuzzers/tint_regex_fuzzer/cli.h"
#include "src/tint/fuzzers/tint_regex_fuzzer/override_cli_params.h"
namespace tint {
namespace fuzzers {
namespace regex_fuzzer {
namespace tint::fuzzers::regex_fuzzer {
void OverrideCliParams(CliParams& cli_params) {
assert(cli_params.fuzzing_target == FuzzingTarget::kAll &&
@ -28,6 +26,4 @@ void OverrideCliParams(CliParams& cli_params) {
cli_params.fuzzing_target = FuzzingTarget::kHlsl;
}
} // namespace regex_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::regex_fuzzer

View File

@ -17,9 +17,7 @@
#include "src/tint/fuzzers/tint_regex_fuzzer/cli.h"
#include "src/tint/fuzzers/tint_regex_fuzzer/override_cli_params.h"
namespace tint {
namespace fuzzers {
namespace regex_fuzzer {
namespace tint::fuzzers::regex_fuzzer {
void OverrideCliParams(CliParams& cli_params) {
assert(cli_params.fuzzing_target == FuzzingTarget::kAll &&
@ -28,6 +26,4 @@ void OverrideCliParams(CliParams& cli_params) {
cli_params.fuzzing_target = FuzzingTarget::kMsl;
}
} // namespace regex_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::regex_fuzzer

View File

@ -17,9 +17,7 @@
#include "src/tint/fuzzers/tint_regex_fuzzer/cli.h"
#include "src/tint/fuzzers/tint_regex_fuzzer/override_cli_params.h"
namespace tint {
namespace fuzzers {
namespace regex_fuzzer {
namespace tint::fuzzers::regex_fuzzer {
void OverrideCliParams(CliParams& cli_params) {
assert(cli_params.fuzzing_target == FuzzingTarget::kAll &&
@ -28,6 +26,4 @@ void OverrideCliParams(CliParams& cli_params) {
cli_params.fuzzing_target = FuzzingTarget::kSpv;
}
} // namespace regex_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::regex_fuzzer

View File

@ -17,9 +17,7 @@
#include "src/tint/fuzzers/tint_regex_fuzzer/cli.h"
#include "src/tint/fuzzers/tint_regex_fuzzer/override_cli_params.h"
namespace tint {
namespace fuzzers {
namespace regex_fuzzer {
namespace tint::fuzzers::regex_fuzzer {
void OverrideCliParams(CliParams& cli_params) {
assert(cli_params.fuzzing_target == FuzzingTarget::kAll &&
@ -28,6 +26,4 @@ void OverrideCliParams(CliParams& cli_params) {
cli_params.fuzzing_target = FuzzingTarget::kWgsl;
}
} // namespace regex_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::regex_fuzzer

View File

@ -24,9 +24,7 @@
#include "src/tint/fuzzers/random_generator.h"
namespace tint {
namespace fuzzers {
namespace regex_fuzzer {
namespace tint::fuzzers::regex_fuzzer {
std::vector<size_t> FindDelimiterIndices(const std::string& delimiter,
const std::string& wgsl_code) {
@ -353,6 +351,4 @@ bool ReplaceRandomIntLiteral(std::string& wgsl_code,
return true;
}
} // namespace regex_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::regex_fuzzer

View File

@ -21,9 +21,7 @@
#include "src/tint/fuzzers/random_generator.h"
namespace tint {
namespace fuzzers {
namespace regex_fuzzer {
namespace tint::fuzzers::regex_fuzzer {
/// A function that given a delimiter, returns a vector that contains
/// all the positions of the delimiter in the WGSL code.
@ -179,8 +177,6 @@ bool ReplaceRandomIntLiteral(std::string& wgsl_code,
/// @param generator - the random number generator.
/// @return true if the mutation was succesful or false otherwise.
bool InsertReturnStatement(std::string& wgsl_code, RandomGenerator& generator);
} // namespace regex_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::regex_fuzzer
#endif // SRC_TINT_FUZZERS_TINT_REGEX_FUZZER_WGSL_MUTATOR_H_

View File

@ -16,8 +16,7 @@
#include "src/tint/fuzzers/tint_common_fuzzer.h"
#include "src/tint/fuzzers/transform_builder.h"
namespace tint {
namespace fuzzers {
namespace tint::fuzzers {
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
TransformBuilder tb(data, size);
@ -31,5 +30,4 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
return fuzzer.Run(data, size);
}
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers

View File

@ -16,8 +16,7 @@
#include "src/tint/fuzzers/tint_common_fuzzer.h"
#include "src/tint/fuzzers/transform_builder.h"
namespace tint {
namespace fuzzers {
namespace tint::fuzzers {
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
TransformBuilder tb(data, size);
@ -31,5 +30,4 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
return fuzzer.Run(data, size);
}
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers

View File

@ -16,8 +16,7 @@
#include "src/tint/fuzzers/tint_common_fuzzer.h"
#include "src/tint/fuzzers/transform_builder.h"
namespace tint {
namespace fuzzers {
namespace tint::fuzzers {
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
TransformBuilder tb(data, size);
@ -31,5 +30,4 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
return fuzzer.Run(data, size);
}
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers

View File

@ -24,9 +24,7 @@
#include "source/opt/build_module.h"
#include "src/tint/fuzzers/tint_spirv_tools_fuzzer/util.h"
namespace tint {
namespace fuzzers {
namespace spvtools_fuzzer {
namespace tint::fuzzers::spvtools_fuzzer {
namespace {
const char* const kMutatorParameters = R"(
@ -479,6 +477,4 @@ MutatorDebuggerCliParams ParseMutatorDebuggerCliParams(
return cli_params;
}
} // namespace spvtools_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::spvtools_fuzzer

View File

@ -20,9 +20,7 @@
#include "source/fuzz/fuzzer.h"
namespace tint {
namespace fuzzers {
namespace spvtools_fuzzer {
namespace tint::fuzzers::spvtools_fuzzer {
/// Default SPIR-V environment that will be used during fuzzing.
const auto kDefaultTargetEnv = SPV_ENV_VULKAN_1_1;
@ -160,8 +158,6 @@ FuzzerCliParams ParseFuzzerCliParams(int* argc, char** argv);
MutatorDebuggerCliParams ParseMutatorDebuggerCliParams(int argc,
const char* const* argv);
} // namespace spvtools_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::spvtools_fuzzer
#endif // SRC_TINT_FUZZERS_TINT_SPIRV_TOOLS_FUZZER_CLI_H_

View File

@ -28,9 +28,7 @@
#include "src/tint/fuzzers/tint_spirv_tools_fuzzer/spirv_reduce_mutator.h"
#include "src/tint/fuzzers/tint_spirv_tools_fuzzer/util.h"
namespace tint {
namespace fuzzers {
namespace spvtools_fuzzer {
namespace tint::fuzzers::spvtools_fuzzer {
namespace {
struct Context {
@ -258,6 +256,4 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
}
} // namespace
} // namespace spvtools_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::spvtools_fuzzer

View File

@ -14,9 +14,7 @@
#include "src/tint/fuzzers/tint_spirv_tools_fuzzer/mutator.h"
namespace tint {
namespace fuzzers {
namespace spvtools_fuzzer {
namespace tint::fuzzers::spvtools_fuzzer {
// We need to define constructor here so that vtable is produced in this
// translation unit (see -Wweak-vtables clang flag).
@ -29,6 +27,4 @@ Mutator::Result::Result(Status status, bool is_changed)
"Returning invalid result state");
}
} // namespace spvtools_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::spvtools_fuzzer

View File

@ -20,9 +20,7 @@
#include <string>
#include <vector>
namespace tint {
namespace fuzzers {
namespace spvtools_fuzzer {
namespace tint::fuzzers::spvtools_fuzzer {
/// This is an interface that is used to define custom mutators based on the
/// SPIR-V tools.
@ -101,8 +99,6 @@ class Mutator {
virtual std::string GetErrors() const = 0;
};
} // namespace spvtools_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::spvtools_fuzzer
#endif // SRC_TINT_FUZZERS_TINT_SPIRV_TOOLS_FUZZER_MUTATOR_H_

View File

@ -14,9 +14,7 @@
#include "src/tint/fuzzers/tint_spirv_tools_fuzzer/mutator_cache.h"
namespace tint {
namespace fuzzers {
namespace spvtools_fuzzer {
namespace tint::fuzzers::spvtools_fuzzer {
MutatorCache::MutatorCache(size_t max_size)
: map_(), entries_(), max_size_(max_size) {
@ -73,6 +71,4 @@ void MutatorCache::UpdateUsage(Map::iterator it) {
it->second = entries_.begin();
}
} // namespace spvtools_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::spvtools_fuzzer

View File

@ -24,9 +24,7 @@
#include "src/tint/fuzzers/tint_spirv_tools_fuzzer/mutator.h"
namespace tint {
namespace fuzzers {
namespace spvtools_fuzzer {
namespace tint::fuzzers::spvtools_fuzzer {
/// Implementation of a fixed size LRU cache. That is, when the number of
/// elements reaches a certain threshold, the element that wasn't used for the
@ -92,8 +90,6 @@ class MutatorCache {
const size_t max_size_;
};
} // namespace spvtools_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::spvtools_fuzzer
#endif // SRC_TINT_FUZZERS_TINT_SPIRV_TOOLS_FUZZER_MUTATOR_CACHE_H_

View File

@ -17,9 +17,7 @@
#include "src/tint/fuzzers/tint_spirv_tools_fuzzer/cli.h"
namespace tint {
namespace fuzzers {
namespace spvtools_fuzzer {
namespace tint::fuzzers::spvtools_fuzzer {
/// @brief Allows CLI parameters to be overridden.
///
@ -29,8 +27,6 @@ namespace spvtools_fuzzer {
/// @param cli_params - the parsed CLI parameters to be updated.
void OverrideCliParams(FuzzerCliParams& cli_params);
} // namespace spvtools_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::spvtools_fuzzer
#endif // SRC_TINT_FUZZERS_TINT_SPIRV_TOOLS_FUZZER_OVERRIDE_CLI_PARAMS_H_

View File

@ -20,9 +20,7 @@
#include "source/opt/build_module.h"
#include "src/tint/fuzzers/tint_spirv_tools_fuzzer/util.h"
namespace tint {
namespace fuzzers {
namespace spvtools_fuzzer {
namespace tint::fuzzers::spvtools_fuzzer {
SpirvFuzzMutator::SpirvFuzzMutator(
spv_target_env target_env,
@ -122,6 +120,4 @@ void SpirvFuzzMutator::LogErrors(const std::string* path,
}
}
} // namespace spvtools_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::spvtools_fuzzer

View File

@ -26,9 +26,7 @@
#include "source/fuzz/protobufs/spirvfuzz_protobufs.h"
#include "source/fuzz/pseudo_random_generator.h"
namespace tint {
namespace fuzzers {
namespace spvtools_fuzzer {
namespace tint::fuzzers::spvtools_fuzzer {
/// The mutator that uses spirv-fuzz to mutate SPIR-V.
///
@ -88,8 +86,6 @@ class SpirvFuzzMutator : public Mutator {
const uint32_t seed_;
};
} // namespace spvtools_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::spvtools_fuzzer
#endif // SRC_TINT_FUZZERS_TINT_SPIRV_TOOLS_FUZZER_SPIRV_FUZZ_MUTATOR_H_

View File

@ -22,9 +22,7 @@
#include "spirv-tools/optimizer.hpp"
#include "src/tint/fuzzers/tint_spirv_tools_fuzzer/util.h"
namespace tint {
namespace fuzzers {
namespace spvtools_fuzzer {
namespace tint::fuzzers::spvtools_fuzzer {
SpirvOptMutator::SpirvOptMutator(spv_target_env target_env,
uint32_t seed,
@ -154,6 +152,4 @@ void SpirvOptMutator::LogErrors(const std::string* path, uint32_t count) const {
}
}
} // namespace spvtools_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::spvtools_fuzzer

View File

@ -23,9 +23,7 @@
#include "src/tint/fuzzers/random_generator.h"
#include "src/tint/fuzzers/tint_spirv_tools_fuzzer/mutator.h"
namespace tint {
namespace fuzzers {
namespace spvtools_fuzzer {
namespace tint::fuzzers::spvtools_fuzzer {
/// Mutates the SPIR-V module using the spirv-opt tool.
///
@ -89,8 +87,6 @@ class SpirvOptMutator : public Mutator {
RandomGenerator generator_;
};
} // namespace spvtools_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::spvtools_fuzzer
#endif // SRC_TINT_FUZZERS_TINT_SPIRV_TOOLS_FUZZER_SPIRV_OPT_MUTATOR_H_

View File

@ -32,9 +32,7 @@
#include "source/reduce/structured_loop_to_selection_reduction_opportunity_finder.h"
#include "src/tint/fuzzers/tint_spirv_tools_fuzzer/util.h"
namespace tint {
namespace fuzzers {
namespace spvtools_fuzzer {
namespace tint::fuzzers::spvtools_fuzzer {
SpirvReduceMutator::SpirvReduceMutator(spv_target_env target_env,
std::vector<uint32_t> binary,
@ -185,6 +183,4 @@ void SpirvReduceMutator::LogErrors(const std::string* path,
}
}
} // namespace spvtools_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::spvtools_fuzzer

View File

@ -26,9 +26,7 @@
#include "source/reduce/reduction_opportunity_finder.h"
namespace tint {
namespace fuzzers {
namespace spvtools_fuzzer {
namespace tint::fuzzers::spvtools_fuzzer {
/// Mutates SPIR-V binary by running spirv-reduce tool.
///
@ -125,8 +123,6 @@ class SpirvReduceMutator : public Mutator {
const uint32_t seed_;
};
} // namespace spvtools_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::spvtools_fuzzer
#endif // SRC_TINT_FUZZERS_TINT_SPIRV_TOOLS_FUZZER_SPIRV_REDUCE_MUTATOR_H_

View File

@ -17,14 +17,10 @@
#include "src/tint/fuzzers/tint_spirv_tools_fuzzer/cli.h"
#include "src/tint/fuzzers/tint_spirv_tools_fuzzer/override_cli_params.h"
namespace tint {
namespace fuzzers {
namespace spvtools_fuzzer {
namespace tint::fuzzers::spvtools_fuzzer {
void OverrideCliParams(FuzzerCliParams& /*unused*/) {
// Leave the CLI parameters unchanged.
}
} // namespace spvtools_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::spvtools_fuzzer

View File

@ -17,9 +17,7 @@
#include "src/tint/fuzzers/tint_spirv_tools_fuzzer/cli.h"
#include "src/tint/fuzzers/tint_spirv_tools_fuzzer/override_cli_params.h"
namespace tint {
namespace fuzzers {
namespace spvtools_fuzzer {
namespace tint::fuzzers::spvtools_fuzzer {
void OverrideCliParams(FuzzerCliParams& cli_params) {
assert(cli_params.fuzzing_target == FuzzingTarget::kAll &&
@ -28,6 +26,4 @@ void OverrideCliParams(FuzzerCliParams& cli_params) {
cli_params.fuzzing_target = FuzzingTarget::kHlsl;
}
} // namespace spvtools_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::spvtools_fuzzer

View File

@ -17,9 +17,7 @@
#include "src/tint/fuzzers/tint_spirv_tools_fuzzer/cli.h"
#include "src/tint/fuzzers/tint_spirv_tools_fuzzer/override_cli_params.h"
namespace tint {
namespace fuzzers {
namespace spvtools_fuzzer {
namespace tint::fuzzers::spvtools_fuzzer {
void OverrideCliParams(FuzzerCliParams& cli_params) {
assert(cli_params.fuzzing_target == FuzzingTarget::kAll &&
@ -28,6 +26,4 @@ void OverrideCliParams(FuzzerCliParams& cli_params) {
cli_params.fuzzing_target = FuzzingTarget::kMsl;
}
} // namespace spvtools_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::spvtools_fuzzer

View File

@ -17,9 +17,7 @@
#include "src/tint/fuzzers/tint_spirv_tools_fuzzer/cli.h"
#include "src/tint/fuzzers/tint_spirv_tools_fuzzer/override_cli_params.h"
namespace tint {
namespace fuzzers {
namespace spvtools_fuzzer {
namespace tint::fuzzers::spvtools_fuzzer {
void OverrideCliParams(FuzzerCliParams& cli_params) {
assert(cli_params.fuzzing_target == FuzzingTarget::kAll &&
@ -28,6 +26,4 @@ void OverrideCliParams(FuzzerCliParams& cli_params) {
cli_params.fuzzing_target = FuzzingTarget::kSpv;
}
} // namespace spvtools_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::spvtools_fuzzer

View File

@ -17,9 +17,7 @@
#include "src/tint/fuzzers/tint_spirv_tools_fuzzer/cli.h"
#include "src/tint/fuzzers/tint_spirv_tools_fuzzer/override_cli_params.h"
namespace tint {
namespace fuzzers {
namespace spvtools_fuzzer {
namespace tint::fuzzers::spvtools_fuzzer {
void OverrideCliParams(FuzzerCliParams& cli_params) {
assert(cli_params.fuzzing_target == FuzzingTarget::kAll &&
@ -28,6 +26,4 @@ void OverrideCliParams(FuzzerCliParams& cli_params) {
cli_params.fuzzing_target = FuzzingTarget::kWgsl;
}
} // namespace spvtools_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::spvtools_fuzzer

View File

@ -17,10 +17,7 @@
#include "src/tint/fuzzers/tint_spirv_tools_fuzzer/util.h"
namespace tint {
namespace fuzzers {
namespace spvtools_fuzzer {
namespace util {
namespace tint::fuzzers::spvtools_fuzzer::util {
namespace {
bool WriteBinary(const std::string& path, const uint8_t* data, size_t size) {
@ -151,7 +148,4 @@ bool WriteBinary(const std::string& path, const std::vector<uint32_t>& binary) {
binary.size() * sizeof(uint32_t));
}
} // namespace util
} // namespace spvtools_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::spvtools_fuzzer::util

View File

@ -24,10 +24,7 @@
#include "spirv-tools/libspirv.hpp"
namespace tint {
namespace fuzzers {
namespace spvtools_fuzzer {
namespace util {
namespace tint::fuzzers::spvtools_fuzzer::util {
/// @param buffer will be used to output errors by the returned message
/// consumer. Must remain in scope as long as the returned consumer is in
@ -88,9 +85,6 @@ bool ReadBinary(const std::string& path, std::vector<uint32_t>* out);
/// @return whether the operation was successful.
bool WriteBinary(const std::string& path, const std::vector<uint32_t>& binary);
} // namespace util
} // namespace spvtools_fuzzer
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers::spvtools_fuzzer::util
#endif // SRC_TINT_FUZZERS_TINT_SPIRV_TOOLS_FUZZER_UTIL_H_

View File

@ -17,8 +17,7 @@
#include "src/tint/fuzzers/fuzzer_init.h"
#include "src/tint/fuzzers/tint_common_fuzzer.h"
namespace tint {
namespace fuzzers {
namespace tint::fuzzers {
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
tint::fuzzers::CommonFuzzer fuzzer(InputFormat::kSpv, OutputFormat::kNone);
@ -26,5 +25,4 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
return fuzzer.Run(data, size);
}
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers

View File

@ -17,8 +17,7 @@
#include "src/tint/fuzzers/fuzzer_init.h"
#include "src/tint/fuzzers/tint_reader_writer_fuzzer.h"
namespace tint {
namespace fuzzers {
namespace tint::fuzzers {
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
tint::fuzzers::ReaderWriterFuzzer fuzzer(InputFormat::kSpv,
@ -29,5 +28,4 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
return fuzzer.Run(data, size);
}
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers

View File

@ -17,8 +17,7 @@
#include "src/tint/fuzzers/fuzzer_init.h"
#include "src/tint/fuzzers/tint_reader_writer_fuzzer.h"
namespace tint {
namespace fuzzers {
namespace tint::fuzzers {
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
DataBuilder db(data, size);
@ -33,5 +32,4 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
return fuzzer.Run(data, size);
}
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers

View File

@ -17,8 +17,7 @@
#include "src/tint/fuzzers/fuzzer_init.h"
#include "src/tint/fuzzers/tint_reader_writer_fuzzer.h"
namespace tint {
namespace fuzzers {
namespace tint::fuzzers {
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
DataBuilder db(data, size);
@ -33,5 +32,4 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
return fuzzer.Run(data, size);
}
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers

View File

@ -17,8 +17,7 @@
#include "src/tint/fuzzers/fuzzer_init.h"
#include "src/tint/fuzzers/tint_reader_writer_fuzzer.h"
namespace tint {
namespace fuzzers {
namespace tint::fuzzers {
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
tint::fuzzers::ReaderWriterFuzzer fuzzer(InputFormat::kSpv,
@ -29,5 +28,4 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
return fuzzer.Run(data, size);
}
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers

View File

@ -16,8 +16,7 @@
#include "src/tint/fuzzers/tint_common_fuzzer.h"
#include "src/tint/fuzzers/transform_builder.h"
namespace tint {
namespace fuzzers {
namespace tint::fuzzers {
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
TransformBuilder tb(data, size);
@ -31,5 +30,4 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
return fuzzer.Run(data, size);
}
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers

View File

@ -17,8 +17,7 @@
#include "src/tint/fuzzers/fuzzer_init.h"
#include "src/tint/fuzzers/tint_common_fuzzer.h"
namespace tint {
namespace fuzzers {
namespace tint::fuzzers {
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
tint::fuzzers::CommonFuzzer fuzzer(InputFormat::kWGSL, OutputFormat::kNone);
@ -26,5 +25,4 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
return fuzzer.Run(data, size);
}
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers

View File

@ -17,8 +17,7 @@
#include "src/tint/fuzzers/fuzzer_init.h"
#include "src/tint/fuzzers/tint_reader_writer_fuzzer.h"
namespace tint {
namespace fuzzers {
namespace tint::fuzzers {
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
tint::fuzzers::ReaderWriterFuzzer fuzzer(InputFormat::kWGSL,
@ -29,5 +28,4 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
return fuzzer.Run(data, size);
}
} // namespace fuzzers
} // namespace tint
} // namespace tint::fuzzers

Some files were not shown because too many files have changed in this diff Show More