From 53829a5e4209662e2bb309e37cc509c04c955537 Mon Sep 17 00:00:00 2001 From: Ben Clayton Date: Thu, 17 Jun 2021 20:26:15 +0000 Subject: [PATCH] intrinsics.def: Include access and storage in ptr errors Some overload mismatches just make no sense without this Change-Id: I2827808ab7dfd9e2d179b5207da8ad3c2ce56d99 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/55040 Reviewed-by: David Neto Kokoro: Kokoro Commit-Queue: Ben Clayton --- src/intrinsic_table.inl | 6 ++---- src/intrinsics.def | 2 +- src/resolver/intrinsic_test.cc | 34 +++++++++++++++++----------------- 3 files changed, 20 insertions(+), 22 deletions(-) diff --git a/src/intrinsic_table.inl b/src/intrinsic_table.inl index 54312b7c62..f4a0eb6e49 100644 --- a/src/intrinsic_table.inl +++ b/src/intrinsic_table.inl @@ -320,7 +320,7 @@ std::string Mat::String(MatchState& state) const { } /// TypeMatcher for 'type ptr' -/// @see src/intrinsics.def:77:37 +/// @see src/intrinsics.def:77:6 class Ptr : public TypeMatcher { public: /// Checks whether the given type matches the matcher rules. @@ -361,9 +361,7 @@ std::string Ptr::String(MatchState& state) const { const std::string S = state.NumName(); const std::string T = state.TypeName(); const std::string A = state.NumName(); - std::stringstream ss; - ss << "ptr<" << T << ">"; - return ss.str(); + return "ptr<" + S + ", " + T + ", " + A + ">"; } /// TypeMatcher for 'type array' diff --git a/src/intrinsics.def b/src/intrinsics.def index fa3761c455..f6529a8aa3 100644 --- a/src/intrinsics.def +++ b/src/intrinsics.def @@ -74,7 +74,7 @@ type vec3 type vec4 [[display("vec{N}<{T}>")]] type vec [[display("mat{N}x{M}<{T}>")]] type mat -[[display("ptr<{T}>")]] type ptr +type ptr type array type sampler type sampler_comparison diff --git a/src/resolver/intrinsic_test.cc b/src/resolver/intrinsic_test.cc index 108562af7c..bdb235cd18 100644 --- a/src/resolver/intrinsic_test.cc +++ b/src/resolver/intrinsic_test.cc @@ -794,7 +794,7 @@ TEST_F(ResolverIntrinsicDataTest, ArrayLength_Error_ArraySized) { 2 candidate functions: arrayLength(array) -> u32 - arrayLength(ptr>) -> u32 + arrayLength(ptr, A>) -> u32 )"); } @@ -857,8 +857,8 @@ TEST_F(ResolverIntrinsicDataTest, Frexp_Error_FirstParamInt) { R"(error: no matching call to frexp(i32, ptr) 2 candidate functions: - frexp(f32, ptr) -> f32 where: T is i32 or u32, S is function, private or workgroup - frexp(vecN, ptr>) -> vecN where: T is i32 or u32, S is function, private or workgroup + frexp(f32, ptr) -> f32 where: T is i32 or u32, S is function, private or workgroup + frexp(vecN, ptr, A>) -> vecN where: T is i32 or u32, S is function, private or workgroup )"); } @@ -874,8 +874,8 @@ TEST_F(ResolverIntrinsicDataTest, Frexp_Error_SecondParamFloatPtr) { R"(error: no matching call to frexp(f32, ptr) 2 candidate functions: - frexp(f32, ptr) -> f32 where: T is i32 or u32, S is function, private or workgroup - frexp(vecN, ptr>) -> vecN where: T is i32 or u32, S is function, private or workgroup + frexp(f32, ptr) -> f32 where: T is i32 or u32, S is function, private or workgroup + frexp(vecN, ptr, A>) -> vecN where: T is i32 or u32, S is function, private or workgroup )"); } @@ -888,8 +888,8 @@ TEST_F(ResolverIntrinsicDataTest, Frexp_Error_SecondParamNotAPointer) { EXPECT_EQ(r()->error(), R"(error: no matching call to frexp(f32, i32) 2 candidate functions: - frexp(f32, ptr) -> f32 where: T is i32 or u32, S is function, private or workgroup - frexp(vecN, ptr>) -> vecN where: T is i32 or u32, S is function, private or workgroup + frexp(f32, ptr) -> f32 where: T is i32 or u32, S is function, private or workgroup + frexp(vecN, ptr, A>) -> vecN where: T is i32 or u32, S is function, private or workgroup )"); } @@ -905,8 +905,8 @@ TEST_F(ResolverIntrinsicDataTest, Frexp_Error_VectorSizesDontMatch) { R"(error: no matching call to frexp(vec2, ptr, read_write>) 2 candidate functions: - frexp(f32, ptr) -> f32 where: T is i32 or u32, S is function, private or workgroup - frexp(vecN, ptr>) -> vecN where: T is i32 or u32, S is function, private or workgroup + frexp(f32, ptr) -> f32 where: T is i32 or u32, S is function, private or workgroup + frexp(vecN, ptr, A>) -> vecN where: T is i32 or u32, S is function, private or workgroup )"); } @@ -945,8 +945,8 @@ TEST_F(ResolverIntrinsicDataTest, Modf_Error_FirstParamInt) { R"(error: no matching call to modf(i32, ptr) 2 candidate functions: - modf(f32, ptr) -> f32 where: S is function, private or workgroup - modf(vecN, ptr>) -> vecN where: S is function, private or workgroup + modf(f32, ptr) -> f32 where: S is function, private or workgroup + modf(vecN, ptr, A>) -> vecN where: S is function, private or workgroup )"); } @@ -962,8 +962,8 @@ TEST_F(ResolverIntrinsicDataTest, Modf_Error_SecondParamIntPtr) { R"(error: no matching call to modf(f32, ptr) 2 candidate functions: - modf(f32, ptr) -> f32 where: S is function, private or workgroup - modf(vecN, ptr>) -> vecN where: S is function, private or workgroup + modf(f32, ptr) -> f32 where: S is function, private or workgroup + modf(vecN, ptr, A>) -> vecN where: S is function, private or workgroup )"); } @@ -976,8 +976,8 @@ TEST_F(ResolverIntrinsicDataTest, Modf_Error_SecondParamNotAPointer) { EXPECT_EQ(r()->error(), R"(error: no matching call to modf(f32, f32) 2 candidate functions: - modf(f32, ptr) -> f32 where: S is function, private or workgroup - modf(vecN, ptr>) -> vecN where: S is function, private or workgroup + modf(f32, ptr) -> f32 where: S is function, private or workgroup + modf(vecN, ptr, A>) -> vecN where: S is function, private or workgroup )"); } @@ -993,8 +993,8 @@ TEST_F(ResolverIntrinsicDataTest, Modf_Error_VectorSizesDontMatch) { R"(error: no matching call to modf(vec2, ptr, read_write>) 2 candidate functions: - modf(vecN, ptr>) -> vecN where: S is function, private or workgroup - modf(f32, ptr) -> f32 where: S is function, private or workgroup + modf(vecN, ptr, A>) -> vecN where: S is function, private or workgroup + modf(f32, ptr) -> f32 where: S is function, private or workgroup )"); }