Functions: use static string for parameter names

The idea behind this change is the same as in
rB6ee2abde82ef121cd6e927995053ac33afdbb438.

A `MultiFunction::debug_parameter_name` method could be
added separately when necessary.
This commit is contained in:
Jacques Lucke 2021-11-21 12:57:34 +01:00
parent 6ee2abde82
commit 15011e0b70
2 changed files with 18 additions and 18 deletions

View File

@ -38,7 +38,7 @@ struct MFSignature {
* actually needed.
*/
const char *function_name;
Vector<std::string> param_names;
Vector<const char *> param_names;
Vector<MFParamType> param_types;
Vector<int> param_data_indices;
bool depends_on_context = false;
@ -70,23 +70,23 @@ class MFSignatureBuilder {
/* Input Parameter Types */
template<typename T> void single_input(StringRef name)
template<typename T> void single_input(const char *name)
{
this->single_input(name, CPPType::get<T>());
}
void single_input(StringRef name, const CPPType &type)
void single_input(const char *name, const CPPType &type)
{
this->input(name, MFDataType::ForSingle(type));
}
template<typename T> void vector_input(StringRef name)
template<typename T> void vector_input(const char *name)
{
this->vector_input(name, CPPType::get<T>());
}
void vector_input(StringRef name, const CPPType &base_type)
void vector_input(const char *name, const CPPType &base_type)
{
this->input(name, MFDataType::ForVector(base_type));
}
void input(StringRef name, MFDataType data_type)
void input(const char *name, MFDataType data_type)
{
signature_.param_names.append(name);
signature_.param_types.append(MFParamType(MFParamType::Input, data_type));
@ -103,23 +103,23 @@ class MFSignatureBuilder {
/* Output Parameter Types */
template<typename T> void single_output(StringRef name)
template<typename T> void single_output(const char *name)
{
this->single_output(name, CPPType::get<T>());
}
void single_output(StringRef name, const CPPType &type)
void single_output(const char *name, const CPPType &type)
{
this->output(name, MFDataType::ForSingle(type));
}
template<typename T> void vector_output(StringRef name)
template<typename T> void vector_output(const char *name)
{
this->vector_output(name, CPPType::get<T>());
}
void vector_output(StringRef name, const CPPType &base_type)
void vector_output(const char *name, const CPPType &base_type)
{
this->output(name, MFDataType::ForVector(base_type));
}
void output(StringRef name, MFDataType data_type)
void output(const char *name, MFDataType data_type)
{
signature_.param_names.append(name);
signature_.param_types.append(MFParamType(MFParamType::Output, data_type));
@ -136,23 +136,23 @@ class MFSignatureBuilder {
/* Mutable Parameter Types */
template<typename T> void single_mutable(StringRef name)
template<typename T> void single_mutable(const char *name)
{
this->single_mutable(name, CPPType::get<T>());
}
void single_mutable(StringRef name, const CPPType &type)
void single_mutable(const char *name, const CPPType &type)
{
this->mutable_(name, MFDataType::ForSingle(type));
}
template<typename T> void vector_mutable(StringRef name)
template<typename T> void vector_mutable(const char *name)
{
this->vector_mutable(name, CPPType::get<T>());
}
void vector_mutable(StringRef name, const CPPType &base_type)
void vector_mutable(const char *name, const CPPType &base_type)
{
this->mutable_(name, MFDataType::ForVector(base_type));
}
void mutable_(StringRef name, MFDataType data_type)
void mutable_(const char *name, MFDataType data_type)
{
signature_.param_names.append(name);
signature_.param_types.append(MFParamType(MFParamType::Mutable, data_type));
@ -167,7 +167,7 @@ class MFSignatureBuilder {
}
}
void add(StringRef name, const MFParamType &param_type)
void add(const char *name, const MFParamType &param_type)
{
switch (param_type.interface_type()) {
case MFParamType::Input:

View File

@ -25,7 +25,7 @@ MFProcedureExecutor::MFProcedureExecutor(const MFProcedure &procedure) : procedu
MFSignatureBuilder signature("Procedure Executor");
for (const ConstMFParameter &param : procedure.params()) {
signature.add(param.variable->name(), MFParamType(param.type, param.variable->data_type()));
signature.add("Parameter", MFParamType(param.type, param.variable->data_type()));
}
signature_ = signature.build();