mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-08 13:14:56 +00:00
Add fuzzing target to BUILD.gn
TEST=Built fuzzer in local checkout of Chromium with tint integrated. BUG=dawn:14 Change-Id: I84aacd41f893070c3af40f5e640361e177689f9e Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/20343 Reviewed-by: dan sinclair <dsinclair@google.com>
This commit is contained in:
@@ -19,6 +19,8 @@
|
||||
namespace tint {
|
||||
namespace ast {
|
||||
|
||||
Import::Import() = default;
|
||||
|
||||
Import::Import(const std::string& path, const std::string& name)
|
||||
: Node(), path_(path), name_(name) {}
|
||||
|
||||
@@ -27,6 +29,8 @@ Import::Import(const Source& source,
|
||||
const std::string& name)
|
||||
: Node(source), path_(path), name_(name) {}
|
||||
|
||||
Import::Import(Import&&) = default;
|
||||
|
||||
Import::~Import() = default;
|
||||
|
||||
bool Import::IsValid() const {
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace ast {
|
||||
class Import : public Node {
|
||||
public:
|
||||
/// Create a new empty import statement
|
||||
Import() = default;
|
||||
Import();
|
||||
/// Create a new import statement
|
||||
/// @param path The import path e.g. GLSL.std.450
|
||||
/// @param name The import reference name e.g. std
|
||||
@@ -43,7 +43,7 @@ class Import : public Node {
|
||||
const std::string& path,
|
||||
const std::string& name);
|
||||
/// Move constructor
|
||||
Import(Import&&) = default;
|
||||
Import(Import&&);
|
||||
|
||||
~Import() override;
|
||||
|
||||
|
||||
@@ -697,7 +697,7 @@ TypedExpression FunctionEmitter::MaybeEmitCombinatorialValue(
|
||||
}
|
||||
|
||||
if (inst.opcode() == SpvOpBitcast) {
|
||||
auto target_ty = parser_impl_.ConvertType(inst.type_id());
|
||||
auto* target_ty = parser_impl_.ConvertType(inst.type_id());
|
||||
return {target_ty,
|
||||
std::make_unique<ast::AsExpression>(target_ty, operand(0).expr)};
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ TEST_F(SpvUnaryArithTest, SNegate_Int_Int) {
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
)";
|
||||
auto p = parser(test::Assemble(assembly));
|
||||
auto* p = parser(test::Assemble(assembly));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p, *spirv_function(100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
@@ -154,7 +154,7 @@ TEST_F(SpvUnaryArithTest, SNegate_Int_Uint) {
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
)";
|
||||
auto p = parser(test::Assemble(assembly));
|
||||
auto* p = parser(test::Assemble(assembly));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p, *spirv_function(100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
@@ -183,7 +183,7 @@ TEST_F(SpvUnaryArithTest, SNegate_Uint_Int) {
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
)";
|
||||
auto p = parser(test::Assemble(assembly));
|
||||
auto* p = parser(test::Assemble(assembly));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p, *spirv_function(100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
@@ -212,7 +212,7 @@ TEST_F(SpvUnaryArithTest, SNegate_Uint_Uint) {
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
)";
|
||||
auto p = parser(test::Assemble(assembly));
|
||||
auto* p = parser(test::Assemble(assembly));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p, *spirv_function(100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
@@ -243,7 +243,7 @@ TEST_F(SpvUnaryArithTest, SNegate_SignedVec_SignedVec) {
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
)";
|
||||
auto p = parser(test::Assemble(assembly));
|
||||
auto* p = parser(test::Assemble(assembly));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p, *spirv_function(100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
@@ -274,7 +274,7 @@ TEST_F(SpvUnaryArithTest, SNegate_SignedVec_UnsignedVec) {
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
)";
|
||||
auto p = parser(test::Assemble(assembly));
|
||||
auto* p = parser(test::Assemble(assembly));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p, *spirv_function(100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
@@ -307,7 +307,7 @@ TEST_F(SpvUnaryArithTest, SNegate_UnsignedVec_SignedVec) {
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
)";
|
||||
auto p = parser(test::Assemble(assembly));
|
||||
auto* p = parser(test::Assemble(assembly));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p, *spirv_function(100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
@@ -340,7 +340,7 @@ TEST_F(SpvUnaryArithTest, SNegate_UnsignedVec_UnsignedVec) {
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
)";
|
||||
auto p = parser(test::Assemble(assembly));
|
||||
auto* p = parser(test::Assemble(assembly));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p, *spirv_function(100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
@@ -375,7 +375,7 @@ TEST_F(SpvUnaryArithTest, FNegate_Scalar) {
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
)";
|
||||
auto p = parser(test::Assemble(assembly));
|
||||
auto* p = parser(test::Assemble(assembly));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p, *spirv_function(100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
@@ -402,7 +402,7 @@ TEST_F(SpvUnaryArithTest, FNegate_Vector) {
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
)";
|
||||
auto p = parser(test::Assemble(assembly));
|
||||
auto* p = parser(test::Assemble(assembly));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p, *spirv_function(100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
@@ -680,7 +680,7 @@ TEST_F(SpvBinaryArithTestBasic, SDiv_Scalar_UnsignedResult) {
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
)";
|
||||
auto p = parser(test::Assemble(assembly));
|
||||
auto* p = parser(test::Assemble(assembly));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions())
|
||||
<< p->error() << "\n"
|
||||
<< assembly;
|
||||
@@ -715,7 +715,7 @@ TEST_F(SpvBinaryArithTestBasic, SDiv_Vector_UnsignedResult) {
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
)";
|
||||
auto p = parser(test::Assemble(assembly));
|
||||
auto* p = parser(test::Assemble(assembly));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions())
|
||||
<< p->error() << "\n"
|
||||
<< assembly;
|
||||
@@ -824,7 +824,7 @@ TEST_F(SpvBinaryArithTestBasic, SMod_Scalar_UnsignedResult) {
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
)";
|
||||
auto p = parser(test::Assemble(assembly));
|
||||
auto* p = parser(test::Assemble(assembly));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions())
|
||||
<< p->error() << "\n"
|
||||
<< assembly;
|
||||
@@ -859,7 +859,7 @@ TEST_F(SpvBinaryArithTestBasic, SMod_Vector_UnsignedResult) {
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
)";
|
||||
auto p = parser(test::Assemble(assembly));
|
||||
auto* p = parser(test::Assemble(assembly));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions())
|
||||
<< p->error() << "\n"
|
||||
<< assembly;
|
||||
|
||||
@@ -384,7 +384,7 @@ TEST_F(SpvUnaryBitTest, Not_Int_Int) {
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
)";
|
||||
auto p = parser(test::Assemble(assembly));
|
||||
auto* p = parser(test::Assemble(assembly));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p, *spirv_function(100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
@@ -411,7 +411,7 @@ TEST_F(SpvUnaryBitTest, Not_Int_Uint) {
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
)";
|
||||
auto p = parser(test::Assemble(assembly));
|
||||
auto* p = parser(test::Assemble(assembly));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p, *spirv_function(100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
@@ -440,7 +440,7 @@ TEST_F(SpvUnaryBitTest, Not_Uint_Int) {
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
)";
|
||||
auto p = parser(test::Assemble(assembly));
|
||||
auto* p = parser(test::Assemble(assembly));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p, *spirv_function(100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
@@ -469,7 +469,7 @@ TEST_F(SpvUnaryBitTest, Not_Uint_Uint) {
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
)";
|
||||
auto p = parser(test::Assemble(assembly));
|
||||
auto* p = parser(test::Assemble(assembly));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p, *spirv_function(100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
@@ -496,7 +496,7 @@ TEST_F(SpvUnaryBitTest, Not_SignedVec_SignedVec) {
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
)";
|
||||
auto p = parser(test::Assemble(assembly));
|
||||
auto* p = parser(test::Assemble(assembly));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p, *spirv_function(100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
@@ -527,7 +527,7 @@ TEST_F(SpvUnaryBitTest, Not_SignedVec_UnsignedVec) {
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
)";
|
||||
auto p = parser(test::Assemble(assembly));
|
||||
auto* p = parser(test::Assemble(assembly));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p, *spirv_function(100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
@@ -560,7 +560,7 @@ TEST_F(SpvUnaryBitTest, Not_UnsignedVec_SignedVec) {
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
)";
|
||||
auto p = parser(test::Assemble(assembly));
|
||||
auto* p = parser(test::Assemble(assembly));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p, *spirv_function(100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
@@ -592,7 +592,7 @@ TEST_F(SpvUnaryBitTest, Not_UnsignedVec_UnsignedVec) {
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
)";
|
||||
auto p = parser(test::Assemble(assembly));
|
||||
auto* p = parser(test::Assemble(assembly));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p, *spirv_function(100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
@@ -71,7 +71,7 @@ TEST_F(SpvUnaryConversionTest, Bitcast_Scalar) {
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
)";
|
||||
auto p = parser(test::Assemble(assembly));
|
||||
auto* p = parser(test::Assemble(assembly));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p, *spirv_function(100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
@@ -97,7 +97,7 @@ TEST_F(SpvUnaryConversionTest, Bitcast_Vector) {
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
)";
|
||||
auto p = parser(test::Assemble(assembly));
|
||||
auto* p = parser(test::Assemble(assembly));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p, *spirv_function(100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
@@ -202,7 +202,7 @@ TEST_F(SpvUnaryLogicalTest, LogicalNot_Scalar) {
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
)";
|
||||
auto p = parser(test::Assemble(assembly));
|
||||
auto* p = parser(test::Assemble(assembly));
|
||||
ASSERT_TRUE(p->BuildAndParseInternalModuleExceptFunctions());
|
||||
FunctionEmitter fe(p, *spirv_function(100));
|
||||
EXPECT_TRUE(fe.EmitBody()) << p->error();
|
||||
|
||||
@@ -172,6 +172,17 @@ bool AssumesResultSignednessMatchesBinaryFirstOperand(SpvOp opcode) {
|
||||
|
||||
} // namespace
|
||||
|
||||
TypedExpression::TypedExpression() : type(nullptr), expr(nullptr) {}
|
||||
|
||||
TypedExpression::TypedExpression(ast::type::Type* t,
|
||||
std::unique_ptr<ast::Expression> e)
|
||||
: type(t), expr(std::move(e)) {}
|
||||
|
||||
TypedExpression::TypedExpression(TypedExpression&& other)
|
||||
: type(other.type), expr(std::move(other.expr)) {}
|
||||
|
||||
TypedExpression::~TypedExpression() {}
|
||||
|
||||
ParserImpl::ParserImpl(Context* ctx, const std::vector<uint32_t>& spv_binary)
|
||||
: Reader(ctx),
|
||||
spv_binary_(spv_binary),
|
||||
@@ -509,9 +520,9 @@ bool ParserImpl::EmitEntryPoints() {
|
||||
ast::type::Type* ParserImpl::ConvertType(
|
||||
const spvtools::opt::analysis::Integer* int_ty) {
|
||||
if (int_ty->width() == 32) {
|
||||
auto signed_ty =
|
||||
auto* signed_ty =
|
||||
ctx_.type_mgr().Get(std::make_unique<ast::type::I32Type>());
|
||||
auto unsigned_ty =
|
||||
auto* unsigned_ty =
|
||||
ctx_.type_mgr().Get(std::make_unique<ast::type::U32Type>());
|
||||
signed_type_for_[unsigned_ty] = signed_ty;
|
||||
unsigned_type_for_[signed_ty] = unsigned_ty;
|
||||
|
||||
@@ -55,16 +55,16 @@ using DecorationList = std::vector<Decoration>;
|
||||
// An AST expression with its type.
|
||||
struct TypedExpression {
|
||||
/// Dummy constructor
|
||||
TypedExpression() : type(nullptr), expr(nullptr) {}
|
||||
TypedExpression();
|
||||
/// Constructor
|
||||
/// @param t the type
|
||||
/// @param e the expression
|
||||
TypedExpression(ast::type::Type* t, std::unique_ptr<ast::Expression> e)
|
||||
: type(t), expr(std::move(e)) {}
|
||||
TypedExpression(ast::type::Type* t, std::unique_ptr<ast::Expression> e);
|
||||
/// Move constructor
|
||||
/// @param other the other typed expression
|
||||
TypedExpression(TypedExpression&& other)
|
||||
: type(other.type), expr(std::move(other.expr)) {}
|
||||
TypedExpression(TypedExpression&& other);
|
||||
/// Destructor
|
||||
~TypedExpression();
|
||||
/// The type
|
||||
ast::type::Type* type;
|
||||
/// The expression
|
||||
|
||||
@@ -1685,7 +1685,7 @@ TEST_P(ImportData_SingleParamTest, Vector) {
|
||||
td()->GetImportData({0, 0}, "GLSL.std.450", param.name, params, &id);
|
||||
ASSERT_NE(type, nullptr);
|
||||
EXPECT_TRUE(type->is_float_vector());
|
||||
EXPECT_EQ(type->AsVector()->size(), 3);
|
||||
EXPECT_EQ(type->AsVector()->size(), 3u);
|
||||
EXPECT_EQ(id, param.value);
|
||||
}
|
||||
|
||||
@@ -1924,7 +1924,7 @@ TEST_P(ImportData_TwoParamTest, Vector) {
|
||||
td()->GetImportData({0, 0}, "GLSL.std.450", param.name, params, &id);
|
||||
ASSERT_NE(type, nullptr);
|
||||
EXPECT_TRUE(type->is_float_vector());
|
||||
EXPECT_EQ(type->AsVector()->size(), 3);
|
||||
EXPECT_EQ(type->AsVector()->size(), 3u);
|
||||
EXPECT_EQ(id, param.value);
|
||||
}
|
||||
|
||||
@@ -2332,7 +2332,7 @@ TEST_P(ImportData_ThreeParamTest, Vector) {
|
||||
td()->GetImportData({0, 0}, "GLSL.std.450", param.name, params, &id);
|
||||
ASSERT_NE(type, nullptr);
|
||||
EXPECT_TRUE(type->is_float_vector());
|
||||
EXPECT_EQ(type->AsVector()->size(), 3);
|
||||
EXPECT_EQ(type->AsVector()->size(), 3u);
|
||||
EXPECT_EQ(id, param.value);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user