Cloning: move arguments to create() into temporary locals

In C++ argument evaluation order is undefined. MSVC and Clang evaluate these in different orders, leading to hilarity when writing tests that expect a deterministic ordering.

Pull out all the argument expressions to create() in the clone functions so a cloned program is deterministic in its ordering between compilers.

Change-Id: I8e2de31398960c480ce7ee1dfaac4f67652d2dbc
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/41544
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Auto-Submit: Ben Clayton <bclayton@google.com>
diff --git a/src/ast/scalar_constructor_expression.cc b/src/ast/scalar_constructor_expression.cc
index 4c90f19..61cad8f 100644
--- a/src/ast/scalar_constructor_expression.cc
+++ b/src/ast/scalar_constructor_expression.cc
@@ -33,8 +33,10 @@
 
 ScalarConstructorExpression* ScalarConstructorExpression::Clone(
     CloneContext* ctx) const {
-  return ctx->dst->create<ScalarConstructorExpression>(ctx->Clone(source()),
-                                                       ctx->Clone(literal_));
+  // Clone arguments outside of create() call to have deterministic ordering
+  auto src = ctx->Clone(source());
+  auto* lit = ctx->Clone(literal());
+  return ctx->dst->create<ScalarConstructorExpression>(src, lit);
 }
 
 bool ScalarConstructorExpression::IsValid() const {