X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fglsl%2Fir_import_prototypes.cpp;h=b0429fbc3afc90ba3a40de9339c1dff3be972da0;hb=9b387b5d3f4103c51079ea5298d33086af6da433;hp=066137e60aab5d9b372a64f9788050803231bbd8;hpb=f412fac5b46eb274cbed8e62234d5dbfd859f1fe;p=mesa.git diff --git a/src/glsl/ir_import_prototypes.cpp b/src/glsl/ir_import_prototypes.cpp index 066137e60aa..b0429fbc3af 100644 --- a/src/glsl/ir_import_prototypes.cpp +++ b/src/glsl/ir_import_prototypes.cpp @@ -27,10 +27,11 @@ * * \author Ian Romanick */ -#include #include "ir.h" #include "glsl_symbol_table.h" +namespace { + /** * Visitor used to import function prototypes * @@ -64,7 +65,7 @@ public: /* Add the new function to the symbol table. */ - this->symbols->add_function(this->function->name, this->function); + this->symbols->add_function(this->function); } return visit_continue; } @@ -82,22 +83,7 @@ public: { assert(this->function != NULL); - ir_function_signature *copy = - new(mem_ctx) ir_function_signature(ir->return_type); - - copy->is_defined = false; - copy->is_builtin = ir->is_builtin; - - /* Clone the parameter list, but NOT the body. - */ - foreach_list_const(node, &ir->parameters) { - const ir_variable *const param = (const ir_variable *) node; - - assert(const_cast(param)->as_variable() != NULL); - - ir_variable *const param_copy = param->clone(mem_ctx, NULL); - copy->parameters.push_tail(param_copy); - } + ir_function_signature *copy = ir->clone_prototype(mem_ctx, NULL); this->function->add_signature(copy); @@ -115,6 +101,7 @@ private: void *mem_ctx; }; +} /* anonymous namespace */ /** * Import function prototypes from one IR tree into another @@ -124,7 +111,7 @@ private: * \param dest Destination instruction stream where new \c ir_function and * \c ir_function_signature nodes will be stored * \param symbols Symbol table where new functions will be stored - * \param mem_ctx talloc memory context used for new allocations + * \param mem_ctx ralloc memory context used for new allocations */ void import_prototypes(const exec_list *source, exec_list *dest,