Have TypesBuilder pointer and structure methods return ast types

These were the last two types to migrate away from typ::TypePair.

Bug: tint:724
Change-Id: Ibc03e35db00236081a5792f787864ab69ce0d00c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/51665
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
diff --git a/src/inspector/inspector_test.cc b/src/inspector/inspector_test.cc
index 51f9d41..2eebad1 100644
--- a/src/inspector/inspector_test.cc
+++ b/src/inspector/inspector_test.cc
@@ -62,7 +62,7 @@
   /// Generates a struct that contains user-defined IO members
   /// @param name the name of the generated struct
   /// @param inout_vars tuples of {name, loc} that will be the struct members
-  typ::Struct MakeInOutStruct(
+  ast::Struct* MakeInOutStruct(
       std::string name,
       std::vector<std::tuple<std::string, uint32_t>> inout_vars) {
     ast::StructMemberList members;
@@ -1005,7 +1005,7 @@
 }
 
 TEST_F(InspectorGetEntryPointTest, InOutStruct) {
-  auto interface = MakeInOutStruct("interface", {{"a", 0u}, {"b", 1u}});
+  auto* interface = MakeInOutStruct("interface", {{"a", 0u}, {"b", 1u}});
   Func("foo", {Param("param", interface)}, interface, {Return("param")},
        {Stage(ast::PipelineStage::kFragment)});
   Inspector& inspector = Build();
@@ -1037,7 +1037,7 @@
 }
 
 TEST_F(InspectorGetEntryPointTest, MultipleEntryPointsInOutSharedStruct) {
-  auto interface = MakeInOutStruct("interface", {{"a", 0u}, {"b", 1u}});
+  auto* interface = MakeInOutStruct("interface", {{"a", 0u}, {"b", 1u}});
   Func("foo", {}, interface, {Return(Construct(interface))},
        {Stage(ast::PipelineStage::kFragment)});
   Func("bar", {Param("param", interface)}, ty.void_(), {},
@@ -1075,8 +1075,8 @@
 }
 
 TEST_F(InspectorGetEntryPointTest, MixInOutVariablesAndStruct) {
-  auto struct_a = MakeInOutStruct("struct_a", {{"a", 0u}, {"b", 1u}});
-  auto struct_b = MakeInOutStruct("struct_b", {{"a", 2u}});
+  auto* struct_a = MakeInOutStruct("struct_a", {{"a", 0u}, {"b", 1u}});
+  auto* struct_b = MakeInOutStruct("struct_b", {{"a", 2u}});
   Func("foo",
        {Param("param_a", struct_a), Param("param_b", struct_b),
         Param("param_c", ty.f32(), {Location(3u)}),
@@ -1659,7 +1659,7 @@
 }
 
 TEST_F(InspectorGetResourceBindingsTest, Simple) {
-  typ::Struct ub_struct_type = MakeUniformBufferType("ub_type", {ty.i32()});
+  ast::Struct* ub_struct_type = MakeUniformBufferType("ub_type", {ty.i32()});
   AddUniformBuffer("ub_var", ub_struct_type, 0, 0);
   MakeStructVariableReferenceBodyFunction("ub_func", "ub_var", {{0, ty.i32()}});
 
@@ -1766,7 +1766,7 @@
 }
 
 TEST_F(InspectorGetUniformBufferResourceBindingsTest, NonEntryPointFunc) {
-  typ::Struct foo_struct_type = MakeUniformBufferType("foo_type", {ty.i32()});
+  ast::Struct* foo_struct_type = MakeUniformBufferType("foo_type", {ty.i32()});
   AddUniformBuffer("foo_ub", foo_struct_type, 0, 0);
 
   MakeStructVariableReferenceBodyFunction("ub_func", "foo_ub", {{0, ty.i32()}});
@@ -1784,7 +1784,7 @@
 }
 
 TEST_F(InspectorGetUniformBufferResourceBindingsTest, Simple) {
-  typ::Struct foo_struct_type = MakeUniformBufferType("foo_type", {ty.i32()});
+  ast::Struct* foo_struct_type = MakeUniformBufferType("foo_type", {ty.i32()});
   AddUniformBuffer("foo_ub", foo_struct_type, 0, 0);
 
   MakeStructVariableReferenceBodyFunction("ub_func", "foo_ub", {{0, ty.i32()}});
@@ -1809,7 +1809,7 @@
 }
 
 TEST_F(InspectorGetUniformBufferResourceBindingsTest, MultipleMembers) {
-  typ::Struct foo_struct_type =
+  ast::Struct* foo_struct_type =
       MakeUniformBufferType("foo_type", {ty.i32(), ty.u32(), ty.f32()});
   AddUniformBuffer("foo_ub", foo_struct_type, 0, 0);
 
@@ -1836,7 +1836,7 @@
 }
 
 TEST_F(InspectorGetUniformBufferResourceBindingsTest, ContainingPadding) {
-  typ::Struct foo_struct_type =
+  ast::Struct* foo_struct_type =
       MakeUniformBufferType("foo_type", {ty.vec3<f32>()});
   AddUniformBuffer("foo_ub", foo_struct_type, 0, 0);
 
@@ -1863,7 +1863,7 @@
 }
 
 TEST_F(InspectorGetUniformBufferResourceBindingsTest, MultipleUniformBuffers) {
-  typ::Struct ub_struct_type =
+  ast::Struct* ub_struct_type =
       MakeUniformBufferType("ub_type", {ty.i32(), ty.u32(), ty.f32()});
   AddUniformBuffer("ub_foo", ub_struct_type, 0, 0);
   AddUniformBuffer("ub_bar", ub_struct_type, 0, 1);
@@ -1921,7 +1921,7 @@
   // TODO(bclayton) - This is not a legal structure layout for uniform buffer
   // usage. Once crbug.com/tint/628 is implemented, this will fail validation
   // and will need to be fixed.
-  typ::Struct foo_struct_type =
+  ast::Struct* foo_struct_type =
       MakeUniformBufferType("foo_type", {ty.i32(), ty.array<u32, 4>()});
   AddUniformBuffer("foo_ub", foo_struct_type, 0, 0);
 
diff --git a/src/program_builder.h b/src/program_builder.h
index 80791c8..36ae067 100644
--- a/src/program_builder.h
+++ b/src/program_builder.h
@@ -710,10 +710,7 @@
     typ::Pointer pointer(typ::Type type,
                          ast::StorageClass storage_class) const {
       type = MaybeCreateTypename(type);
-      return {type.ast ? builder->create<ast::Pointer>(type, storage_class)
-                       : nullptr,
-              type.sem ? builder->create<sem::Pointer>(type, storage_class)
-                       : nullptr};
+      return {builder->create<ast::Pointer>(type, storage_class)};
     }
 
     /// @param source the Source of the node
@@ -724,11 +721,7 @@
                          typ::Type type,
                          ast::StorageClass storage_class) const {
       type = MaybeCreateTypename(type);
-      return {type.ast
-                  ? builder->create<ast::Pointer>(source, type, storage_class)
-                  : nullptr,
-              type.sem ? builder->create<sem::Pointer>(type, storage_class)
-                       : nullptr};
+      return {builder->create<ast::Pointer>(source, type, storage_class)};
     }
 
     /// @param storage_class the storage class of the pointer
diff --git a/src/typepair.h b/src/typepair.h
index 487482d..78b6a68 100644
--- a/src/typepair.h
+++ b/src/typepair.h
@@ -237,8 +237,6 @@
 
 using Type = TypePair<ast::Type, sem::Type>;
 
-using Pointer = TypePair<ast::Pointer, sem::Pointer>;
-using Struct = TypePair<ast::Struct, sem::Struct>;
 
 using Bool = Ptr<ast::Bool>;
 using U32 = Ptr<ast::U32>;
@@ -254,6 +252,8 @@
 using Sampler = Ptr<ast::Sampler>;
 using Matrix = Ptr<ast::Matrix>;
 using Vector = Ptr<ast::Vector>;
+using Pointer = Ptr<ast::Pointer>;
+using Struct = Ptr<ast::Struct>;
 
 // Helpers