Import Tint changes from Dawn

Changes:
  - b725dae2e3a9afd1835e2d971ee9fd9ba7074bfe [tint][ir] Rename type proto messages by Ben Clayton <bclayton@google.com>
  - 84d1d55f1aa8b1e42ba98caa4639315e15d27913 undef CHECK before defining it locally by David Neto <dneto@google.com>
GitOrigin-RevId: b725dae2e3a9afd1835e2d971ee9fd9ba7074bfe
Change-Id: Ia53b696838b27e75b7a1800fd9b098f63edda913
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/163900
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
diff --git a/src/tint/lang/core/ir/binary/decode.cc b/src/tint/lang/core/ir/binary/decode.cc
index 6d23588..ca40071 100644
--- a/src/tint/lang/core/ir/binary/decode.cc
+++ b/src/tint/lang/core/ir/binary/decode.cc
@@ -328,45 +328,45 @@
         return nullptr;
     }
 
-    const type::Type* CreateTypeBasic(pb::BasicType basic_in) {
+    const type::Type* CreateTypeBasic(pb::TypeBasic basic_in) {
         switch (basic_in) {
-            case pb::BasicType::void_:
+            case pb::TypeBasic::void_:
                 return mod_out_.Types().Get<void>();
-            case pb::BasicType::bool_:
+            case pb::TypeBasic::bool_:
                 return mod_out_.Types().Get<bool>();
-            case pb::BasicType::i32:
+            case pb::TypeBasic::i32:
                 return mod_out_.Types().Get<i32>();
-            case pb::BasicType::u32:
+            case pb::TypeBasic::u32:
                 return mod_out_.Types().Get<u32>();
-            case pb::BasicType::f32:
+            case pb::TypeBasic::f32:
                 return mod_out_.Types().Get<f32>();
-            case pb::BasicType::f16:
+            case pb::TypeBasic::f16:
                 return mod_out_.Types().Get<f16>();
             default:
-                TINT_ICE() << "invalid BasicType: " << basic_in;
+                TINT_ICE() << "invalid TypeBasic: " << basic_in;
                 return nullptr;
         }
     }
 
-    const type::Vector* CreateTypeVector(const pb::VectorType& vector_in) {
+    const type::Vector* CreateTypeVector(const pb::TypeVector& vector_in) {
         auto* el_ty = Type(vector_in.element_type());
         return mod_out_.Types().vec(el_ty, vector_in.width());
     }
 
-    const type::Matrix* CreateTypeMatrix(const pb::MatrixType& matrix_in) {
+    const type::Matrix* CreateTypeMatrix(const pb::TypeMatrix& matrix_in) {
         auto* el_ty = Type(matrix_in.element_type());
         auto* column_ty = mod_out_.Types().vec(el_ty, matrix_in.num_rows());
         return mod_out_.Types().mat(column_ty, matrix_in.num_columns());
     }
 
-    const type::Pointer* CreateTypePointer(const pb::PointerType& pointer_in) {
+    const type::Pointer* CreateTypePointer(const pb::TypePointer& pointer_in) {
         auto address_space = AddressSpace(pointer_in.address_space());
         auto* store_ty = Type(pointer_in.store_type());
         auto access = Access(pointer_in.access());
         return mod_out_.Types().ptr(address_space, store_ty, access);
     }
 
-    const type::Array* CreateTypeArray(const pb::ArrayType& array_in) {
+    const type::Array* CreateTypeArray(const pb::TypeArray& array_in) {
         auto* element = Type(array_in.element());
         uint32_t stride = static_cast<uint32_t>(array_in.stride());
         uint32_t count = static_cast<uint32_t>(array_in.count());
diff --git a/src/tint/lang/core/ir/binary/encode.cc b/src/tint/lang/core/ir/binary/encode.cc
index 7846a4a..ab18fe9 100644
--- a/src/tint/lang/core/ir/binary/encode.cc
+++ b/src/tint/lang/core/ir/binary/encode.cc
@@ -231,16 +231,16 @@
             pb::Type type_out;
             Switch(
                 type_in,  //
-                [&](const core::type::Void*) { type_out.set_basic(pb::BasicType::void_); },
-                [&](const core::type::Bool*) { type_out.set_basic(pb::BasicType::bool_); },
-                [&](const core::type::I32*) { type_out.set_basic(pb::BasicType::i32); },
-                [&](const core::type::U32*) { type_out.set_basic(pb::BasicType::u32); },
-                [&](const core::type::F32*) { type_out.set_basic(pb::BasicType::f32); },
-                [&](const core::type::F16*) { type_out.set_basic(pb::BasicType::f16); },
-                [&](const core::type::Vector* v) { VectorType(*type_out.mutable_vector(), v); },
-                [&](const core::type::Matrix* m) { MatrixType(*type_out.mutable_matrix(), m); },
-                [&](const core::type::Pointer* m) { PointerType(*type_out.mutable_pointer(), m); },
-                [&](const core::type::Array* m) { ArrayType(*type_out.mutable_array(), m); },
+                [&](const core::type::Void*) { type_out.set_basic(pb::TypeBasic::void_); },
+                [&](const core::type::Bool*) { type_out.set_basic(pb::TypeBasic::bool_); },
+                [&](const core::type::I32*) { type_out.set_basic(pb::TypeBasic::i32); },
+                [&](const core::type::U32*) { type_out.set_basic(pb::TypeBasic::u32); },
+                [&](const core::type::F32*) { type_out.set_basic(pb::TypeBasic::f32); },
+                [&](const core::type::F16*) { type_out.set_basic(pb::TypeBasic::f16); },
+                [&](const core::type::Vector* v) { TypeVector(*type_out.mutable_vector(), v); },
+                [&](const core::type::Matrix* m) { TypeMatrix(*type_out.mutable_matrix(), m); },
+                [&](const core::type::Pointer* m) { TypePointer(*type_out.mutable_pointer(), m); },
+                [&](const core::type::Array* m) { TypeArray(*type_out.mutable_array(), m); },
                 TINT_ICE_ON_NO_MATCH);
 
             mod_out_.mutable_types()->Add(std::move(type_out));
@@ -248,24 +248,24 @@
         });
     }
 
-    void VectorType(pb::VectorType& vector_out, const core::type::Vector* vector_in) {
+    void TypeVector(pb::TypeVector& vector_out, const core::type::Vector* vector_in) {
         vector_out.set_width(vector_in->Width());
         vector_out.set_element_type(Type(vector_in->type()));
     }
 
-    void MatrixType(pb::MatrixType& matrix_out, const core::type::Matrix* matrix_in) {
+    void TypeMatrix(pb::TypeMatrix& matrix_out, const core::type::Matrix* matrix_in) {
         matrix_out.set_num_columns(matrix_in->columns());
         matrix_out.set_num_rows(matrix_in->rows());
         matrix_out.set_element_type(Type(matrix_in->type()));
     }
 
-    void PointerType(pb::PointerType& pointer_out, const core::type::Pointer* pointer_in) {
+    void TypePointer(pb::TypePointer& pointer_out, const core::type::Pointer* pointer_in) {
         pointer_out.set_address_space(AddressSpace(pointer_in->AddressSpace()));
         pointer_out.set_store_type(Type(pointer_in->StoreType()));
         pointer_out.set_access(Access(pointer_in->Access()));
     }
 
-    void ArrayType(pb::ArrayType& array_out, const core::type::Array* array_in) {
+    void TypeArray(pb::TypeArray& array_out, const core::type::Array* array_in) {
         array_out.set_element(Type(array_in->ElemType()));
         array_out.set_stride(array_in->Stride());
         Switch(
diff --git a/src/tint/lang/core/ir/binary/ir.proto b/src/tint/lang/core/ir/binary/ir.proto
index 3db27a5..fff8d02 100644
--- a/src/tint/lang/core/ir/binary/ir.proto
+++ b/src/tint/lang/core/ir/binary/ir.proto
@@ -43,18 +43,18 @@
 ////////////////////////////////////////////////////////////////////////////////
 message Type {
     oneof kind {
-        BasicType basic = 1;
-        VectorType vector = 2;
-        MatrixType matrix = 3;
-        ArrayType array = 4;
-        PointerType pointer = 5;
+        TypeBasic basic = 1;
+        TypeVector vector = 2;
+        TypeMatrix matrix = 3;
+        TypeArray array = 4;
+        TypePointer pointer = 5;
         uint32 atomic = 6;  // Module.types
         // TODO: textures, samplers
     }
 }
 
 // Non-compound types
-enum BasicType {
+enum TypeBasic {
     void = 0;
     bool = 1;
     i32 = 2;
@@ -63,24 +63,24 @@
     f16 = 5;
 }
 
-message VectorType {
+message TypeVector {
     uint32 width = 1;
     uint32 element_type = 2;  // Module.types
 }
 
-message MatrixType {
+message TypeMatrix {
     uint32 num_columns = 1;
     uint32 num_rows = 2;
     uint32 element_type = 3;  // Module.types
 }
 
-message ArrayType {
+message TypeArray {
     uint32 element = 1;  // Module.types
     uint32 stride = 2;
     uint32 count = 3;
 }
 
-message PointerType {
+message TypePointer {
     AddressSpace address_space = 1;
     uint32 store_type = 2;  // Module.types
     AccessControl access = 3;
diff --git a/src/tint/lang/wgsl/resolver/attribute_validation_test.cc b/src/tint/lang/wgsl/resolver/attribute_validation_test.cc
index 92151d0..c359dd7 100644
--- a/src/tint/lang/wgsl/resolver/attribute_validation_test.cc
+++ b/src/tint/lang/wgsl/resolver/attribute_validation_test.cc
@@ -291,6 +291,7 @@
     }
 };
 
+#undef CHECK
 #define CHECK()                                      \
     if (GetParam().error.empty()) {                  \
         EXPECT_TRUE(r()->Resolve()) << r()->error(); \