From 983e8dd938e85d47f2743dc2322fc477a13d6b6e Mon Sep 17 00:00:00 2001 From: Ben Clayton Date: Tue, 15 Dec 2020 14:07:58 +0000 Subject: [PATCH] ast::Builder: Remove zero-init Source constructors Builder now has a SetSource() method that can be used to specify the source for the future built nodes Bug: tint:396 Bug: tint:390 Change-Id: I9b49bc31c4bf92b3baf5946c413dfe770de0e23d Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35740 Auto-Submit: Ben Clayton Commit-Queue: dan sinclair Reviewed-by: dan sinclair --- src/ast/builder.h | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/ast/builder.h b/src/ast/builder.h index 42efe59e64..a4f4b64488 100644 --- a/src/ast/builder.h +++ b/src/ast/builder.h @@ -300,7 +300,7 @@ class Builder { template TypeConstructorExpression* Construct(ARGS&&... args) { return create( - Source{}, ty.Of(), ExprList(std::forward(args)...)); + ty.Of(), ExprList(std::forward(args)...)); } /// @param type the type to construct @@ -310,7 +310,7 @@ class Builder { template TypeConstructorExpression* Construct(type::Type* type, ARGS&&... args) { return create( - Source{}, type, ExprList(std::forward(args)...)); + type, ExprList(std::forward(args)...)); } /// @param args the arguments for the vector constructor @@ -319,7 +319,7 @@ class Builder { template TypeConstructorExpression* vec2(ARGS&&... args) { return create( - Source{}, ty.vec2(), ExprList(std::forward(args)...)); + ty.vec2(), ExprList(std::forward(args)...)); } /// @param args the arguments for the vector constructor @@ -328,7 +328,7 @@ class Builder { template TypeConstructorExpression* vec3(ARGS&&... args) { return create( - Source{}, ty.vec3(), ExprList(std::forward(args)...)); + ty.vec3(), ExprList(std::forward(args)...)); } /// @param args the arguments for the vector constructor @@ -337,7 +337,7 @@ class Builder { template TypeConstructorExpression* vec4(ARGS&&... args) { return create( - Source{}, ty.vec4(), ExprList(std::forward(args)...)); + ty.vec4(), ExprList(std::forward(args)...)); } /// @param args the arguments for the matrix constructor @@ -346,7 +346,7 @@ class Builder { template TypeConstructorExpression* mat2x2(ARGS&&... args) { return create( - Source{}, ty.mat2x2(), ExprList(std::forward(args)...)); + ty.mat2x2(), ExprList(std::forward(args)...)); } /// @param args the arguments for the matrix constructor @@ -355,7 +355,7 @@ class Builder { template TypeConstructorExpression* mat2x3(ARGS&&... args) { return create( - Source{}, ty.mat2x3(), ExprList(std::forward(args)...)); + ty.mat2x3(), ExprList(std::forward(args)...)); } /// @param args the arguments for the matrix constructor @@ -364,7 +364,7 @@ class Builder { template TypeConstructorExpression* mat2x4(ARGS&&... args) { return create( - Source{}, ty.mat2x4(), ExprList(std::forward(args)...)); + ty.mat2x4(), ExprList(std::forward(args)...)); } /// @param args the arguments for the matrix constructor @@ -373,7 +373,7 @@ class Builder { template TypeConstructorExpression* mat3x2(ARGS&&... args) { return create( - Source{}, ty.mat3x2(), ExprList(std::forward(args)...)); + ty.mat3x2(), ExprList(std::forward(args)...)); } /// @param args the arguments for the matrix constructor @@ -382,7 +382,7 @@ class Builder { template TypeConstructorExpression* mat3x3(ARGS&&... args) { return create( - Source{}, ty.mat3x3(), ExprList(std::forward(args)...)); + ty.mat3x3(), ExprList(std::forward(args)...)); } /// @param args the arguments for the matrix constructor @@ -391,7 +391,7 @@ class Builder { template TypeConstructorExpression* mat3x4(ARGS&&... args) { return create( - Source{}, ty.mat3x4(), ExprList(std::forward(args)...)); + ty.mat3x4(), ExprList(std::forward(args)...)); } /// @param args the arguments for the matrix constructor @@ -400,7 +400,7 @@ class Builder { template TypeConstructorExpression* mat4x2(ARGS&&... args) { return create( - Source{}, ty.mat4x2(), ExprList(std::forward(args)...)); + ty.mat4x2(), ExprList(std::forward(args)...)); } /// @param args the arguments for the matrix constructor @@ -409,7 +409,7 @@ class Builder { template TypeConstructorExpression* mat4x3(ARGS&&... args) { return create( - Source{}, ty.mat4x3(), ExprList(std::forward(args)...)); + ty.mat4x3(), ExprList(std::forward(args)...)); } /// @param args the arguments for the matrix constructor @@ -418,7 +418,7 @@ class Builder { template TypeConstructorExpression* mat4x4(ARGS&&... args) { return create( - Source{}, ty.mat4x4(), ExprList(std::forward(args)...)); + ty.mat4x4(), ExprList(std::forward(args)...)); } /// @param args the arguments for the array constructor @@ -427,7 +427,7 @@ class Builder { template TypeConstructorExpression* array(ARGS&&... args) { return create( - Source{}, ty.array(), ExprList(std::forward(args)...)); + ty.array(), ExprList(std::forward(args)...)); } /// @param subtype the array element type @@ -440,7 +440,7 @@ class Builder { uint32_t n, ARGS&&... args) { return create( - Source{}, ty.array(subtype, n), ExprList(std::forward(args)...)); + ty.array(subtype, n), ExprList(std::forward(args)...)); } /// @param name the variable name @@ -544,8 +544,8 @@ class Builder { /// @returns a `ArrayAccessorExpression` that indexes `arr` with `idx` template Expression* Index(ARR&& arr, IDX&& idx) { - return create( - Source{}, Expr(std::forward(arr)), Expr(std::forward(idx))); + return create(Expr(std::forward(arr)), + Expr(std::forward(idx))); } /// @param obj the object for the member accessor expression @@ -553,8 +553,8 @@ class Builder { /// @returns a `MemberAccessorExpression` that indexes `obj` with `idx` template Expression* Member(OBJ&& obj, IDX&& idx) { - return create( - Source{}, Expr(std::forward(obj)), Expr(std::forward(idx))); + return create(Expr(std::forward(obj)), + Expr(std::forward(idx))); } /// Creates a new Node owned by the Module, with the explicit Source.