Convert `@location` to store expression internally.

This CL updates the internal storage for a `@location` attribute
to store the `Expression` instead of a raw `uint32_t`. The current
parser is updated to generate an `IntLiteralExpression` so we still
parse as a `uint32_t` at the moment.

Bug: tint:1633
Change-Id: I2b9684754a657b39554160c81727cf1541bee96c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/101461
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
diff --git a/src/tint/inspector/inspector.cc b/src/tint/inspector/inspector.cc
index 4dd3c75..087e786 100644
--- a/src/tint/inspector/inspector.cc
+++ b/src/tint/inspector/inspector.cc
@@ -172,7 +172,7 @@
     for (auto* param : sem->Parameters()) {
         AddEntryPointInOutVariables(program_->Symbols().NameFor(param->Declaration()->symbol),
                                     param->Type(), param->Declaration()->attributes,
-                                    entry_point.input_variables);
+                                    param->Location(), entry_point.input_variables);
 
         entry_point.input_position_used |= ContainsBuiltin(
             ast::BuiltinValue::kPosition, param->Type(), param->Declaration()->attributes);
@@ -188,7 +188,7 @@
 
     if (!sem->ReturnType()->Is<sem::Void>()) {
         AddEntryPointInOutVariables("<retval>", sem->ReturnType(), func->return_type_attributes,
-                                    entry_point.output_variables);
+                                    sem->ReturnLocation(), entry_point.output_variables);
 
         entry_point.output_sample_mask_used = ContainsBuiltin(
             ast::BuiltinValue::kSampleMask, sem->ReturnType(), func->return_type_attributes);
@@ -623,6 +623,7 @@
 void Inspector::AddEntryPointInOutVariables(std::string name,
                                             const sem::Type* type,
                                             utils::VectorRef<const ast::Attribute*> attributes,
+                                            std::optional<uint32_t> location,
                                             std::vector<StageVariable>& variables) const {
     // Skip builtins.
     if (ast::HasAttribute<ast::BuiltinAttribute>(attributes)) {
@@ -636,7 +637,7 @@
         for (auto* member : struct_ty->Members()) {
             AddEntryPointInOutVariables(
                 name + "." + program_->Symbols().NameFor(member->Declaration()->symbol),
-                member->Type(), member->Declaration()->attributes, variables);
+                member->Type(), member->Declaration()->attributes, member->Location(), variables);
         }
         return;
     }
@@ -648,10 +649,9 @@
     std::tie(stage_variable.component_type, stage_variable.composition_type) =
         CalculateComponentAndComposition(type);
 
-    auto* location = ast::GetAttribute<ast::LocationAttribute>(attributes);
-    TINT_ASSERT(Inspector, location != nullptr);
+    TINT_ASSERT(Inspector, location.has_value());
     stage_variable.has_location_attribute = true;
-    stage_variable.location_attribute = location->value;
+    stage_variable.location_attribute = location.value();
 
     std::tie(stage_variable.interpolation_type, stage_variable.interpolation_sampling) =
         CalculateInterpolationData(type, attributes);