tint: Support @diagnostic on while statements

Bug: tint:1809
Change-Id: I9593539d258d16a68c9ff1cfd2cad52e28fad65a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/124100
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
diff --git a/src/tint/program_builder.h b/src/tint/program_builder.h
index a2d4f48..dc50acf 100644
--- a/src/tint/program_builder.h
+++ b/src/tint/program_builder.h
@@ -3311,25 +3311,34 @@
         return create<ast::ForLoopStatement>(init, Expr(std::forward<COND>(cond)), cont, body);
     }
 
-    /// Creates a ast::WhileStatement with input body and condition.
+    /// Creates a ast::WhileStatement with input body, condition, and optional attributes.
     /// @param source the source information
     /// @param cond the loop condition
     /// @param body the loop body
+    /// @param attributes optional attributes
     /// @returns the while statement pointer
     template <typename COND>
-    const ast::WhileStatement* While(const Source& source,
-                                     COND&& cond,
-                                     const ast::BlockStatement* body) {
-        return create<ast::WhileStatement>(source, Expr(std::forward<COND>(cond)), body);
+    const ast::WhileStatement* While(
+        const Source& source,
+        COND&& cond,
+        const ast::BlockStatement* body,
+        utils::VectorRef<const ast::Attribute*> attributes = utils::Empty) {
+        return create<ast::WhileStatement>(source, Expr(std::forward<COND>(cond)), body,
+                                           std::move(attributes));
     }
 
-    /// Creates a ast::WhileStatement with given condition and body.
+    /// Creates a ast::WhileStatement with input body, condition, and optional attributes.
     /// @param cond the condition
     /// @param body the loop body
+    /// @param attributes optional attributes
     /// @returns the while loop statement pointer
     template <typename COND>
-    const ast::WhileStatement* While(COND&& cond, const ast::BlockStatement* body) {
-        return create<ast::WhileStatement>(Expr(std::forward<COND>(cond)), body);
+    const ast::WhileStatement* While(
+        COND&& cond,
+        const ast::BlockStatement* body,
+        utils::VectorRef<const ast::Attribute*> attributes = utils::Empty) {
+        return create<ast::WhileStatement>(Expr(std::forward<COND>(cond)), body,
+                                           std::move(attributes));
     }
 
     /// Creates a ast::VariableDeclStatement for the input variable