From 81302443f7c4401517c978ebdd40f69bf649ca3e Mon Sep 17 00:00:00 2001 From: dan sinclair Date: Tue, 9 Feb 2021 15:37:44 +0000 Subject: [PATCH] Fix building with gcc. This CL renames the Parameters using statement to ParametersList so it doesn't conflict with the Parameters method which is used later to return the ParametersList. Change-Id: I2ac19ba52fc0834e5a35b4b35a210dcc170866fc Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/41240 Auto-Submit: dan sinclair Commit-Queue: Ben Clayton Reviewed-by: Ben Clayton --- src/intrinsic_table.cc | 2 +- src/semantic/call_target.h | 12 ++++++------ src/semantic/intrinsic.h | 2 +- src/semantic/sem_call_target.cc | 5 ++--- src/semantic/sem_function.cc | 4 ++-- src/semantic/sem_intrinsic.cc | 2 +- src/type_determiner.cc | 2 +- src/type_determiner_test.cc | 2 +- 8 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/intrinsic_table.cc b/src/intrinsic_table.cc index 044c2391ef..35983728d7 100644 --- a/src/intrinsic_table.cc +++ b/src/intrinsic_table.cc @@ -1434,7 +1434,7 @@ semantic::Intrinsic* Impl::Overload::Match(ProgramBuilder& builder, assert(ret); // Build() must return a type // Build the semantic parameters - semantic::Parameters params; + semantic::ParameterList params; params.reserve(parameters.size()); for (size_t i = 0; i < args.size(); i++) { auto& parameter = parameters[i]; diff --git a/src/semantic/call_target.h b/src/semantic/call_target.h index 43cbc0e469..16cae05ca5 100644 --- a/src/semantic/call_target.h +++ b/src/semantic/call_target.h @@ -59,14 +59,14 @@ struct Parameter { /// @returns a string representation of the given parameter usage. const char* str(Parameter::Usage usage); -/// Parameters is a list of Parameter -using Parameters = std::vector; +/// ParameterList is a list of Parameter +using ParameterList = std::vector; /// @param parameters the list of parameters /// @param usage the parameter usage to find /// @returns the index of the parameter with the given usage, or -1 if no /// parameter with the given usage exists. -int IndexOf(const Parameters& parameters, Parameter::Usage usage); +int IndexOf(const ParameterList& parameters, Parameter::Usage usage); /// CallTarget is the base for callable functions class CallTarget : public Castable { @@ -74,7 +74,7 @@ class CallTarget : public Castable { /// Constructor /// @param return_type the return type of the call target /// @param parameters the parameters for the call target - CallTarget(type::Type* return_type, const semantic::Parameters& parameters); + CallTarget(type::Type* return_type, const ParameterList& parameters); /// @return the return type of the call target type::Type* ReturnType() const { return return_type_; } @@ -83,11 +83,11 @@ class CallTarget : public Castable { ~CallTarget() override; /// @return the parameters of the call target - const Parameters& Parameters() const { return parameters_; } + const ParameterList& Parameters() const { return parameters_; } private: type::Type* const return_type_; - semantic::Parameters const parameters_; + ParameterList const parameters_; }; } // namespace semantic diff --git a/src/semantic/intrinsic.h b/src/semantic/intrinsic.h index e2c1902f30..6cc116b371 100644 --- a/src/semantic/intrinsic.h +++ b/src/semantic/intrinsic.h @@ -152,7 +152,7 @@ class Intrinsic : public Castable { /// @param parameters the parameters for the intrinsic overload Intrinsic(IntrinsicType type, type::Type* return_type, - const semantic::Parameters& parameters); + const ParameterList& parameters); /// Destructor ~Intrinsic() override; diff --git a/src/semantic/sem_call_target.cc b/src/semantic/sem_call_target.cc index ad7f30070a..2ae9ad1e96 100644 --- a/src/semantic/sem_call_target.cc +++ b/src/semantic/sem_call_target.cc @@ -21,13 +21,12 @@ TINT_INSTANTIATE_CLASS_ID(tint::semantic::CallTarget); namespace tint { namespace semantic { -CallTarget::CallTarget(type::Type* return_type, - const semantic::Parameters& parameters) +CallTarget::CallTarget(type::Type* return_type, const ParameterList& parameters) : return_type_(return_type), parameters_(parameters) {} CallTarget::~CallTarget() = default; -int IndexOf(const Parameters& parameters, Parameter::Usage usage) { +int IndexOf(const ParameterList& parameters, Parameter::Usage usage) { for (size_t i = 0; i < parameters.size(); i++) { if (parameters[i].usage == usage) { return static_cast(i); diff --git a/src/semantic/sem_function.cc b/src/semantic/sem_function.cc index db533398eb..2ebf820dc0 100644 --- a/src/semantic/sem_function.cc +++ b/src/semantic/sem_function.cc @@ -33,8 +33,8 @@ namespace semantic { namespace { -Parameters GetParameters(ast::Function* ast) { - semantic::Parameters parameters; +ParameterList GetParameters(ast::Function* ast) { + ParameterList parameters; parameters.reserve(ast->params().size()); for (auto* param : ast->params()) { parameters.emplace_back(Parameter{param->type(), Parameter::Usage::kNone}); diff --git a/src/semantic/sem_intrinsic.cc b/src/semantic/sem_intrinsic.cc index e12c1b4130..aa398c00f8 100644 --- a/src/semantic/sem_intrinsic.cc +++ b/src/semantic/sem_intrinsic.cc @@ -240,7 +240,7 @@ bool IsDataPackingIntrinsic(IntrinsicType i) { Intrinsic::Intrinsic(IntrinsicType type, type::Type* return_type, - const semantic::Parameters& parameters) + const ParameterList& parameters) : Base(return_type, parameters), type_(type) {} Intrinsic::~Intrinsic() = default; diff --git a/src/type_determiner.cc b/src/type_determiner.cc index 3b4b7f5f00..9a6fd7f1f7 100644 --- a/src/type_determiner.cc +++ b/src/type_determiner.cc @@ -478,7 +478,7 @@ bool TypeDeterminer::DetermineIntrinsicCall( // checks on intrinsics is now almost entirely covered by the // IntrinsicTable, we should remove the Validator checks on intrinsic // signatures and remove these hacks. - semantic::Parameters parameters; + semantic::ParameterList parameters; parameters.reserve(arg_tys.size()); for (auto* arg : arg_tys) { parameters.emplace_back(semantic::Parameter{arg}); diff --git a/src/type_determiner_test.cc b/src/type_determiner_test.cc index 5ea317c72b..66904d4122 100644 --- a/src/type_determiner_test.cc +++ b/src/type_determiner_test.cc @@ -2545,7 +2545,7 @@ INSTANTIATE_TEST_SUITE_P( testing::ValuesIn(ast::intrinsic::test::TextureOverloadCase::ValidCases())); std::string to_str(const std::string& function, - const semantic::Parameters& params) { + const semantic::ParameterList& params) { std::stringstream out; out << function << "("; bool first = true;