Update internals to initializer instead of constructor. This CL catches up the internals (along with a few error messages) to say `initializer` instead of `constructor. Bug: tint:1600 Change-Id: I8e56572c310d77da1130380bdd32b334f27c8e46 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/106462 Reviewed-by: Antonio Maiorano <amaiorano@google.com> Auto-Submit: Dan Sinclair <dsinclair@chromium.org> Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Antonio Maiorano <amaiorano@google.com>
diff --git a/src/tint/program_builder.h b/src/tint/program_builder.h index f07a1f8..986133c 100644 --- a/src/tint/program_builder.h +++ b/src/tint/program_builder.h
@@ -175,14 +175,14 @@ const ast::Type* type = nullptr; ast::AddressSpace address_space = ast::AddressSpace::kNone; ast::Access access = ast::Access::kUndefined; - const ast::Expression* constructor = nullptr; + const ast::Expression* initializer = nullptr; utils::Vector<const ast::Attribute*, 4> attributes; private: void Set(const ast::Type* t) { type = t; } void Set(ast::AddressSpace addr_space) { address_space = addr_space; } void Set(ast::Access ac) { access = ac; } - void Set(const ast::Expression* c) { constructor = c; } + void Set(const ast::Expression* c) { initializer = c; } void Set(utils::VectorRef<const ast::Attribute*> l) { attributes = std::move(l); } void Set(const ast::Attribute* a) { attributes.Push(a); } }; @@ -202,12 +202,12 @@ ~LetOptions(); const ast::Type* type = nullptr; - const ast::Expression* constructor = nullptr; + const ast::Expression* initializer = nullptr; utils::Vector<const ast::Attribute*, 4> attributes; private: void Set(const ast::Type* t) { type = t; } - void Set(const ast::Expression* c) { constructor = c; } + void Set(const ast::Expression* c) { initializer = c; } void Set(utils::VectorRef<const ast::Attribute*> l) { attributes = std::move(l); } void Set(const ast::Attribute* a) { attributes.Push(a); } }; @@ -227,12 +227,12 @@ ~ConstOptions(); const ast::Type* type = nullptr; - const ast::Expression* constructor = nullptr; + const ast::Expression* initializer = nullptr; utils::Vector<const ast::Attribute*, 4> attributes; private: void Set(const ast::Type* t) { type = t; } - void Set(const ast::Expression* c) { constructor = c; } + void Set(const ast::Expression* c) { initializer = c; } void Set(utils::VectorRef<const ast::Attribute*> l) { attributes = std::move(l); } void Set(const ast::Attribute* a) { attributes.Push(a); } }; @@ -247,12 +247,12 @@ ~OverrideOptions(); const ast::Type* type = nullptr; - const ast::Expression* constructor = nullptr; + const ast::Expression* initializer = nullptr; utils::Vector<const ast::Attribute*, 4> attributes; private: void Set(const ast::Type* t) { type = t; } - void Set(const ast::Expression* c) { constructor = c; } + void Set(const ast::Expression* c) { initializer = c; } void Set(utils::VectorRef<const ast::Attribute*> l) { attributes = std::move(l); } void Set(const ast::Attribute* a) { attributes.Push(a); } }; @@ -1378,7 +1378,7 @@ return create<ast::BitcastExpression>(source, type, Expr(std::forward<EXPR>(expr))); } - /// @param args the arguments for the vector constructor + /// @param args the arguments for the vector initializer /// @param type the vector type /// @param size the vector size /// @return an `ast::CallExpression` of a `size`-element vector of @@ -1388,7 +1388,7 @@ return Construct(ty.vec(type, size), std::forward<ARGS>(args)...); } - /// @param args the arguments for the vector constructor + /// @param args the arguments for the vector initializer /// @return an `ast::CallExpression` of a 2-element vector of type /// `T`, constructed with the values `args`. template <typename T, typename... ARGS, typename _ = DisableIfSource<ARGS...>> @@ -1397,7 +1397,7 @@ } /// @param source the vector source - /// @param args the arguments for the vector constructor + /// @param args the arguments for the vector initializer /// @return an `ast::CallExpression` of a 2-element vector of type /// `T`, constructed with the values `args`. template <typename T, typename... ARGS> @@ -1405,7 +1405,7 @@ return Construct(source, ty.vec2<T>(), std::forward<ARGS>(args)...); } - /// @param args the arguments for the vector constructor + /// @param args the arguments for the vector initializer /// @return an `ast::CallExpression` of a 3-element vector of type /// `T`, constructed with the values `args`. template <typename T, typename... ARGS, typename _ = DisableIfSource<ARGS...>> @@ -1414,7 +1414,7 @@ } /// @param source the vector source - /// @param args the arguments for the vector constructor + /// @param args the arguments for the vector initializer /// @return an `ast::CallExpression` of a 3-element vector of type /// `T`, constructed with the values `args`. template <typename T, typename... ARGS> @@ -1422,7 +1422,7 @@ return Construct(source, ty.vec3<T>(), std::forward<ARGS>(args)...); } - /// @param args the arguments for the vector constructor + /// @param args the arguments for the vector initializer /// @return an `ast::CallExpression` of a 4-element vector of type /// `T`, constructed with the values `args`. template <typename T, typename... ARGS, typename _ = DisableIfSource<ARGS...>> @@ -1431,7 +1431,7 @@ } /// @param source the vector source - /// @param args the arguments for the vector constructor + /// @param args the arguments for the vector initializer /// @return an `ast::CallExpression` of a 4-element vector of type /// `T`, constructed with the values `args`. template <typename T, typename... ARGS> @@ -1439,7 +1439,7 @@ return Construct(source, ty.vec4<T>(), std::forward<ARGS>(args)...); } - /// @param args the arguments for the matrix constructor + /// @param args the arguments for the matrix initializer /// @return an `ast::CallExpression` of a 2x2 matrix of type /// `T`, constructed with the values `args`. template <typename T, typename... ARGS, typename _ = DisableIfSource<ARGS...>> @@ -1448,7 +1448,7 @@ } /// @param source the matrix source - /// @param args the arguments for the matrix constructor + /// @param args the arguments for the matrix initializer /// @return an `ast::CallExpression` of a 2x2 matrix of type /// `T`, constructed with the values `args`. template <typename T, typename... ARGS> @@ -1456,7 +1456,7 @@ return Construct(source, ty.mat2x2<T>(), std::forward<ARGS>(args)...); } - /// @param args the arguments for the matrix constructor + /// @param args the arguments for the matrix initializer /// @return an `ast::CallExpression` of a 2x3 matrix of type /// `T`, constructed with the values `args`. template <typename T, typename... ARGS, typename _ = DisableIfSource<ARGS...>> @@ -1465,7 +1465,7 @@ } /// @param source the matrix source - /// @param args the arguments for the matrix constructor + /// @param args the arguments for the matrix initializer /// @return an `ast::CallExpression` of a 2x3 matrix of type /// `T`, constructed with the values `args`. template <typename T, typename... ARGS> @@ -1473,7 +1473,7 @@ return Construct(source, ty.mat2x3<T>(), std::forward<ARGS>(args)...); } - /// @param args the arguments for the matrix constructor + /// @param args the arguments for the matrix initializer /// @return an `ast::CallExpression` of a 2x4 matrix of type /// `T`, constructed with the values `args`. template <typename T, typename... ARGS, typename _ = DisableIfSource<ARGS...>> @@ -1482,7 +1482,7 @@ } /// @param source the matrix source - /// @param args the arguments for the matrix constructor + /// @param args the arguments for the matrix initializer /// @return an `ast::CallExpression` of a 2x4 matrix of type /// `T`, constructed with the values `args`. template <typename T, typename... ARGS> @@ -1490,7 +1490,7 @@ return Construct(source, ty.mat2x4<T>(), std::forward<ARGS>(args)...); } - /// @param args the arguments for the matrix constructor + /// @param args the arguments for the matrix initializer /// @return an `ast::CallExpression` of a 3x2 matrix of type /// `T`, constructed with the values `args`. template <typename T, typename... ARGS, typename _ = DisableIfSource<ARGS...>> @@ -1499,7 +1499,7 @@ } /// @param source the matrix source - /// @param args the arguments for the matrix constructor + /// @param args the arguments for the matrix initializer /// @return an `ast::CallExpression` of a 3x2 matrix of type /// `T`, constructed with the values `args`. template <typename T, typename... ARGS> @@ -1507,7 +1507,7 @@ return Construct(source, ty.mat3x2<T>(), std::forward<ARGS>(args)...); } - /// @param args the arguments for the matrix constructor + /// @param args the arguments for the matrix initializer /// @return an `ast::CallExpression` of a 3x3 matrix of type /// `T`, constructed with the values `args`. template <typename T, typename... ARGS, typename _ = DisableIfSource<ARGS...>> @@ -1516,7 +1516,7 @@ } /// @param source the matrix source - /// @param args the arguments for the matrix constructor + /// @param args the arguments for the matrix initializer /// @return an `ast::CallExpression` of a 3x3 matrix of type /// `T`, constructed with the values `args`. template <typename T, typename... ARGS> @@ -1524,7 +1524,7 @@ return Construct(source, ty.mat3x3<T>(), std::forward<ARGS>(args)...); } - /// @param args the arguments for the matrix constructor + /// @param args the arguments for the matrix initializer /// @return an `ast::CallExpression` of a 3x4 matrix of type /// `T`, constructed with the values `args`. template <typename T, typename... ARGS, typename _ = DisableIfSource<ARGS...>> @@ -1533,7 +1533,7 @@ } /// @param source the matrix source - /// @param args the arguments for the matrix constructor + /// @param args the arguments for the matrix initializer /// @return an `ast::CallExpression` of a 3x4 matrix of type /// `T`, constructed with the values `args`. template <typename T, typename... ARGS> @@ -1541,7 +1541,7 @@ return Construct(source, ty.mat3x4<T>(), std::forward<ARGS>(args)...); } - /// @param args the arguments for the matrix constructor + /// @param args the arguments for the matrix initializer /// @return an `ast::CallExpression` of a 4x2 matrix of type /// `T`, constructed with the values `args`. template <typename T, typename... ARGS, typename _ = DisableIfSource<ARGS...>> @@ -1550,7 +1550,7 @@ } /// @param source the matrix source - /// @param args the arguments for the matrix constructor + /// @param args the arguments for the matrix initializer /// @return an `ast::CallExpression` of a 4x2 matrix of type /// `T`, constructed with the values `args`. template <typename T, typename... ARGS> @@ -1558,7 +1558,7 @@ return Construct(source, ty.mat4x2<T>(), std::forward<ARGS>(args)...); } - /// @param args the arguments for the matrix constructor + /// @param args the arguments for the matrix initializer /// @return an `ast::CallExpression` of a 4x3 matrix of type /// `T`, constructed with the values `args`. template <typename T, typename... ARGS, typename _ = DisableIfSource<ARGS...>> @@ -1567,7 +1567,7 @@ } /// @param source the matrix source - /// @param args the arguments for the matrix constructor + /// @param args the arguments for the matrix initializer /// @return an `ast::CallExpression` of a 4x3 matrix of type /// `T`, constructed with the values `args`. template <typename T, typename... ARGS> @@ -1575,7 +1575,7 @@ return Construct(source, ty.mat4x3<T>(), std::forward<ARGS>(args)...); } - /// @param args the arguments for the matrix constructor + /// @param args the arguments for the matrix initializer /// @return an `ast::CallExpression` of a 4x4 matrix of type /// `T`, constructed with the values `args`. template <typename T, typename... ARGS, typename _ = DisableIfSource<ARGS...>> @@ -1584,7 +1584,7 @@ } /// @param source the matrix source - /// @param args the arguments for the matrix constructor + /// @param args the arguments for the matrix initializer /// @return an `ast::CallExpression` of a 4x4 matrix of type /// `T`, constructed with the values `args`. template <typename T, typename... ARGS> @@ -1592,7 +1592,7 @@ return Construct(source, ty.mat4x4<T>(), std::forward<ARGS>(args)...); } - /// @param args the arguments for the array constructor + /// @param args the arguments for the array initializer /// @return an `ast::CallExpression` of an array with element type /// `T` and size `N`, constructed with the values `args`. template <typename T, int N, typename... ARGS> @@ -1601,7 +1601,7 @@ } /// @param source the array source - /// @param args the arguments for the array constructor + /// @param args the arguments for the array initializer /// @return an `ast::CallExpression` of an array with element type /// `T` and size `N`, constructed with the values `args`. template <typename T, int N, typename... ARGS> @@ -1611,7 +1611,7 @@ /// @param subtype the array element type /// @param n the array size. nullptr represents a runtime-array. - /// @param args the arguments for the array constructor + /// @param args the arguments for the array initializer /// @return an `ast::CallExpression` of an array with element type /// `subtype`, constructed with the values `args`. template <typename EXPR, typename... ARGS> @@ -1622,7 +1622,7 @@ /// @param source the array source /// @param subtype the array element type /// @param n the array size. nullptr represents a runtime-array. - /// @param args the arguments for the array constructor + /// @param args the arguments for the array initializer /// @return an `ast::CallExpression` of an array with element type /// `subtype`, constructed with the values `args`. template <typename EXPR, typename... ARGS> @@ -1654,7 +1654,7 @@ } /// @param name the variable name - /// @param options the extra options passed to the ast::Var constructor + /// @param options the extra options passed to the ast::Var initializer /// Can be any of the following, in any order: /// * ast::Type* - specifies the variable type /// * ast::AddressSpace - specifies the variable address space @@ -1668,12 +1668,12 @@ const ast::Var* Var(NAME&& name, OPTIONS&&... options) { VarOptions opts(std::forward<OPTIONS>(options)...); return create<ast::Var>(Sym(std::forward<NAME>(name)), opts.type, opts.address_space, - opts.access, opts.constructor, std::move(opts.attributes)); + opts.access, opts.initializer, std::move(opts.attributes)); } /// @param source the variable source /// @param name the variable name - /// @param options the extra options passed to the ast::Var constructor + /// @param options the extra options passed to the ast::Var initializer /// Can be any of the following, in any order: /// * ast::Type* - specifies the variable type /// * ast::AddressSpace - specifies the variable address space @@ -1686,12 +1686,12 @@ const ast::Var* Var(const Source& source, NAME&& name, OPTIONS&&... options) { VarOptions opts(std::forward<OPTIONS>(options)...); return create<ast::Var>(source, Sym(std::forward<NAME>(name)), opts.type, - opts.address_space, opts.access, opts.constructor, + opts.address_space, opts.access, opts.initializer, std::move(opts.attributes)); } /// @param name the variable name - /// @param options the extra options passed to the ast::Var constructor + /// @param options the extra options passed to the ast::Var initializer /// Can be any of the following, in any order: /// * ast::Expression* - specifies the variable's initializer expression (required) /// * ast::Type* - specifies the variable type @@ -1701,13 +1701,13 @@ template <typename NAME, typename... OPTIONS, typename = DisableIfSource<NAME>> const ast::Const* Const(NAME&& name, OPTIONS&&... options) { ConstOptions opts(std::forward<OPTIONS>(options)...); - return create<ast::Const>(Sym(std::forward<NAME>(name)), opts.type, opts.constructor, + return create<ast::Const>(Sym(std::forward<NAME>(name)), opts.type, opts.initializer, std::move(opts.attributes)); } /// @param source the variable source /// @param name the variable name - /// @param options the extra options passed to the ast::Var constructor + /// @param options the extra options passed to the ast::Var initializer /// Can be any of the following, in any order: /// * ast::Expression* - specifies the variable's initializer expression (required) /// * ast::Type* - specifies the variable type @@ -1718,11 +1718,11 @@ const ast::Const* Const(const Source& source, NAME&& name, OPTIONS&&... options) { ConstOptions opts(std::forward<OPTIONS>(options)...); return create<ast::Const>(source, Sym(std::forward<NAME>(name)), opts.type, - opts.constructor, std::move(opts.attributes)); + opts.initializer, std::move(opts.attributes)); } /// @param name the variable name - /// @param options the extra options passed to the ast::Var constructor + /// @param options the extra options passed to the ast::Var initializer /// Can be any of the following, in any order: /// * ast::Expression* - specifies the variable's initializer expression (required) /// * ast::Type* - specifies the variable type @@ -1732,13 +1732,13 @@ template <typename NAME, typename... OPTIONS, typename = DisableIfSource<NAME>> const ast::Let* Let(NAME&& name, OPTIONS&&... options) { LetOptions opts(std::forward<OPTIONS>(options)...); - return create<ast::Let>(Sym(std::forward<NAME>(name)), opts.type, opts.constructor, + return create<ast::Let>(Sym(std::forward<NAME>(name)), opts.type, opts.initializer, std::move(opts.attributes)); } /// @param source the variable source /// @param name the variable name - /// @param options the extra options passed to the ast::Var constructor + /// @param options the extra options passed to the ast::Var initializer /// Can be any of the following, in any order: /// * ast::Expression* - specifies the variable's initializer expression (required) /// * ast::Type* - specifies the variable type @@ -1748,7 +1748,7 @@ template <typename NAME, typename... OPTIONS> const ast::Let* Let(const Source& source, NAME&& name, OPTIONS&&... options) { LetOptions opts(std::forward<OPTIONS>(options)...); - return create<ast::Let>(source, Sym(std::forward<NAME>(name)), opts.type, opts.constructor, + return create<ast::Let>(source, Sym(std::forward<NAME>(name)), opts.type, opts.initializer, std::move(opts.attributes)); } @@ -1777,7 +1777,7 @@ } /// @param name the variable name - /// @param options the extra options passed to the ast::Var constructor + /// @param options the extra options passed to the ast::Var initializer /// Can be any of the following, in any order: /// * ast::Type* - specifies the variable type /// * ast::AddressSpace - specifies the variable address space @@ -1796,7 +1796,7 @@ /// @param source the variable source /// @param name the variable name - /// @param options the extra options passed to the ast::Var constructor + /// @param options the extra options passed to the ast::Var initializer /// Can be any of the following, in any order: /// * ast::Type* - specifies the variable type /// * ast::AddressSpace - specifies the variable address space @@ -1814,7 +1814,7 @@ } /// @param name the variable name - /// @param options the extra options passed to the ast::Const constructor + /// @param options the extra options passed to the ast::Const initializer /// Can be any of the following, in any order: /// * ast::Expression* - specifies the variable's initializer expression (required) /// * ast::Type* - specifies the variable type @@ -1831,7 +1831,7 @@ /// @param source the variable source /// @param name the variable name - /// @param options the extra options passed to the ast::Const constructor + /// @param options the extra options passed to the ast::Const initializer /// Can be any of the following, in any order: /// * ast::Expression* - specifies the variable's initializer expression (required) /// * ast::Type* - specifies the variable type @@ -1847,7 +1847,7 @@ } /// @param name the variable name - /// @param options the extra options passed to the ast::Override constructor + /// @param options the extra options passed to the ast::Override initializer /// Can be any of the following, in any order: /// * ast::Expression* - specifies the variable's initializer expression (required) /// * ast::Type* - specifies the variable type @@ -1859,14 +1859,14 @@ const ast::Override* Override(NAME&& name, OPTIONS&&... options) { OverrideOptions opts(std::forward<OPTIONS>(options)...); auto* variable = create<ast::Override>(Sym(std::forward<NAME>(name)), opts.type, - opts.constructor, std::move(opts.attributes)); + opts.initializer, std::move(opts.attributes)); AST().AddGlobalVariable(variable); return variable; } /// @param source the variable source /// @param name the variable name - /// @param options the extra options passed to the ast::Override constructor + /// @param options the extra options passed to the ast::Override initializer /// Can be any of the following, in any order: /// * ast::Expression* - specifies the variable's initializer expression (required) /// * ast::Type* - specifies the variable type @@ -1878,7 +1878,7 @@ const ast::Override* Override(const Source& source, NAME&& name, OPTIONS&&... options) { OverrideOptions opts(std::forward<OPTIONS>(options)...); auto* variable = create<ast::Override>(source, Sym(std::forward<NAME>(name)), opts.type, - opts.constructor, std::move(opts.attributes)); + opts.initializer, std::move(opts.attributes)); AST().AddGlobalVariable(variable); return variable; }