[Mesa-dev,1/4] glsl: fix visit/visit_enter overloaded virtual function warnings

Submitted by Rob Herring on May 30, 2017, 8:47 p.m.

Details

Message ID 20170530204709.17221-1-robh@kernel.org
State New
Headers show
Series "Series without cover letter" ( rev: 2 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Rob Herring May 30, 2017, 8:47 p.m.
clang gives warnings about overloaded virtual functions:

src/compiler/glsl/linker.cpp:244:30: warning: '(anonymous namespace)::array_resize_visitor::visit' hides overloaded virtual function [-Woverloaded-virtual]
   virtual ir_visitor_status visit(ir_variable *var)
                             ^
src/compiler/glsl/linker.cpp:195:30: note: hidden overloaded virtual function '(anonymous namespace)::deref_type_updater::visit' declared here: type mismatch at 1st parameter ('ir_dereference_variable *' vs 'ir_variable *')
   virtual ir_visitor_status visit(ir_dereference_variable *ir)
                             ^
src/compiler/glsl/linker.cpp:1414:30: warning: 'array_sizing_visitor::visit' hides overloaded virtual function [-Woverloaded-virtual]
   virtual ir_visitor_status visit(ir_variable *var)
                             ^
src/compiler/glsl/linker.cpp:195:30: note: hidden overloaded virtual function '(anonymous namespace)::deref_type_updater::visit' declared here: type mismatch at 1st parameter ('ir_dereference_variable *' vs 'ir_variable *')
   virtual ir_visitor_status visit(ir_dereference_variable *ir)
                             ^
src/compiler/glsl/lower_jumps.cpp:395:17: warning: '(anonymous namespace)::ir_lower_jumps_visitor::visit' hides overloaded virtual functions [-Woverloaded-virtual]
   virtual void visit(class ir_loop_jump * ir)
                ^
src/compiler/glsl/lower_jumps.cpp:417:17: warning: '(anonymous namespace)::ir_lower_jumps_visitor::visit' hides overloaded virtual functions [-Woverloaded-virtual]
   virtual void visit(class ir_return * ir)
                ^
src/compiler/glsl/lower_jumps.cpp:439:17: warning: '(anonymous namespace)::ir_lower_jumps_visitor::visit' hides overloaded virtual functions [-Woverloaded-virtual]
   virtual void visit(class ir_discard * ir)
                ^
src/compiler/glsl/lower_jumps.cpp:519:17: warning: '(anonymous namespace)::ir_lower_jumps_visitor::visit' hides overloaded virtual functions [-Woverloaded-virtual]
   virtual void visit(ir_if *ir)
                ^
src/compiler/glsl/lower_jumps.cpp:835:17: warning: '(anonymous namespace)::ir_lower_jumps_visitor::visit' hides overloaded virtual functions [-Woverloaded-virtual]
   virtual void visit(ir_loop *ir)
                ^
src/compiler/glsl/lower_jumps.cpp:963:17: warning: '(anonymous namespace)::ir_lower_jumps_visitor::visit' hides overloaded virtual functions [-Woverloaded-virtual]
   virtual void visit(ir_function_signature *ir)
                ^
src/compiler/glsl/lower_jumps.cpp:1009:17: warning: '(anonymous namespace)::ir_lower_jumps_visitor::visit' hides overloaded virtual functions [-Woverloaded-virtual]
   virtual void visit(class ir_function * ir)
                ^
src/compiler/glsl/opt_constant_variable.cpp:52:30: warning: '(anonymous namespace)::ir_constant_variable_visitor::visit_enter' hides overloaded virtual functions [-Woverloaded-virtual]
   virtual ir_visitor_status visit_enter(ir_dereference_variable *);
                             ^
src/compiler/glsl/opt_dead_code_local.cpp:101:30: warning: '(anonymous namespace)::kill_for_derefs_visitor::visit' hides overloaded virtual functions [-Woverloaded-virtual]
   virtual ir_visitor_status visit(ir_swizzle *ir)
                             ^

Fix these with the "using" directive.

Signed-off-by: Rob Herring <robh@kernel.org>
---
 src/compiler/glsl/linker.cpp                | 2 ++
 src/compiler/glsl/lower_jumps.cpp           | 1 +
 src/compiler/glsl/opt_constant_variable.cpp | 2 ++
 src/compiler/glsl/opt_dead_code_local.cpp   | 1 +
 4 files changed, 6 insertions(+)

Patch hide | download patch | download mbox

diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index 2e7dd2b87356..3aa95b734321 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -241,6 +241,7 @@  public:
       /* empty */
    }
 
+   using ir_hierarchical_visitor::visit;
    virtual ir_visitor_status visit(ir_variable *var)
    {
       if (!var->type->is_array() || var->data.mode != ir_var_shader_in ||
@@ -1411,6 +1412,7 @@  public:
       ralloc_free(this->mem_ctx);
    }
 
+   using ir_hierarchical_visitor::visit;
    virtual ir_visitor_status visit(ir_variable *var)
    {
       const glsl_type *type_without_array;
diff --git a/src/compiler/glsl/lower_jumps.cpp b/src/compiler/glsl/lower_jumps.cpp
index 7dc34056a1b1..0cb55127a6e6 100644
--- a/src/compiler/glsl/lower_jumps.cpp
+++ b/src/compiler/glsl/lower_jumps.cpp
@@ -392,6 +392,7 @@  struct ir_lower_jumps_visitor : public ir_control_flow_visitor {
       }
    }
 
+   using ir_visitor::visit;
    virtual void visit(class ir_loop_jump * ir)
    {
       /* Eliminate all instructions after each one, since they are
diff --git a/src/compiler/glsl/opt_constant_variable.cpp b/src/compiler/glsl/opt_constant_variable.cpp
index 1c06ffe6750a..db91cac1589d 100644
--- a/src/compiler/glsl/opt_constant_variable.cpp
+++ b/src/compiler/glsl/opt_constant_variable.cpp
@@ -50,7 +50,9 @@  struct assignment_entry {
 class ir_constant_variable_visitor : public ir_hierarchical_visitor {
 public:
    virtual ir_visitor_status visit_enter(ir_dereference_variable *);
+   using ir_hierarchical_visitor::visit;
    virtual ir_visitor_status visit(ir_variable *);
+   using ir_hierarchical_visitor::visit_enter;
    virtual ir_visitor_status visit_enter(ir_assignment *);
    virtual ir_visitor_status visit_enter(ir_call *);
 
diff --git a/src/compiler/glsl/opt_dead_code_local.cpp b/src/compiler/glsl/opt_dead_code_local.cpp
index a4038794c6bf..f5ea4ae3d537 100644
--- a/src/compiler/glsl/opt_dead_code_local.cpp
+++ b/src/compiler/glsl/opt_dead_code_local.cpp
@@ -91,6 +91,7 @@  public:
       }
    }
 
+   using ir_hierarchical_visitor::visit;
    virtual ir_visitor_status visit(ir_dereference_variable *ir)
    {
       use_channels(ir->var, ~0);

Comments

I don't understand these warnings, and I have even less understanding of
how "using" fixes them.  For example...

On 05/30/2017 01:47 PM, Rob Herring wrote:
> clang gives warnings about overloaded virtual functions:
> 
> src/compiler/glsl/linker.cpp:244:30: warning: '(anonymous namespace)::array_resize_visitor::visit' hides overloaded virtual function [-Woverloaded-virtual]
>    virtual ir_visitor_status visit(ir_variable *var)
>                              ^
> src/compiler/glsl/linker.cpp:195:30: note: hidden overloaded virtual function '(anonymous namespace)::deref_type_updater::visit' declared here: type mismatch at 1st parameter ('ir_dereference_variable *' vs 'ir_variable *')
>    virtual ir_visitor_status visit(ir_dereference_variable *ir)
>                              ^

This is weird and confusing.  ir_hierarchical_visitor has a virtual
visit(class ir_dereference_variable *) method.  The complaint about the
type seems... bizarre.

> src/compiler/glsl/linker.cpp:1414:30: warning: 'array_sizing_visitor::visit' hides overloaded virtual function [-Woverloaded-virtual]
>    virtual ir_visitor_status visit(ir_variable *var)
>                              ^
> src/compiler/glsl/linker.cpp:195:30: note: hidden overloaded virtual function '(anonymous namespace)::deref_type_updater::visit' declared here: type mismatch at 1st parameter ('ir_dereference_variable *' vs 'ir_variable *')
>    virtual ir_visitor_status visit(ir_dereference_variable *ir)
>                              ^
> src/compiler/glsl/lower_jumps.cpp:395:17: warning: '(anonymous namespace)::ir_lower_jumps_visitor::visit' hides overloaded virtual functions [-Woverloaded-virtual]
>    virtual void visit(class ir_loop_jump * ir)
>                 ^
> src/compiler/glsl/lower_jumps.cpp:417:17: warning: '(anonymous namespace)::ir_lower_jumps_visitor::visit' hides overloaded virtual functions [-Woverloaded-virtual]
>    virtual void visit(class ir_return * ir)
>                 ^
> src/compiler/glsl/lower_jumps.cpp:439:17: warning: '(anonymous namespace)::ir_lower_jumps_visitor::visit' hides overloaded virtual functions [-Woverloaded-virtual]
>    virtual void visit(class ir_discard * ir)
>                 ^
> src/compiler/glsl/lower_jumps.cpp:519:17: warning: '(anonymous namespace)::ir_lower_jumps_visitor::visit' hides overloaded virtual functions [-Woverloaded-virtual]
>    virtual void visit(ir_if *ir)
>                 ^
> src/compiler/glsl/lower_jumps.cpp:835:17: warning: '(anonymous namespace)::ir_lower_jumps_visitor::visit' hides overloaded virtual functions [-Woverloaded-virtual]
>    virtual void visit(ir_loop *ir)
>                 ^
> src/compiler/glsl/lower_jumps.cpp:963:17: warning: '(anonymous namespace)::ir_lower_jumps_visitor::visit' hides overloaded virtual functions [-Woverloaded-virtual]
>    virtual void visit(ir_function_signature *ir)
>                 ^
> src/compiler/glsl/lower_jumps.cpp:1009:17: warning: '(anonymous namespace)::ir_lower_jumps_visitor::visit' hides overloaded virtual functions [-Woverloaded-virtual]
>    virtual void visit(class ir_function * ir)
>                 ^
> src/compiler/glsl/opt_constant_variable.cpp:52:30: warning: '(anonymous namespace)::ir_constant_variable_visitor::visit_enter' hides overloaded virtual functions [-Woverloaded-virtual]
>    virtual ir_visitor_status visit_enter(ir_dereference_variable *);
>                              ^
> src/compiler/glsl/opt_dead_code_local.cpp:101:30: warning: '(anonymous namespace)::kill_for_derefs_visitor::visit' hides overloaded virtual functions [-Woverloaded-virtual]
>    virtual ir_visitor_status visit(ir_swizzle *ir)
>                              ^
> 
> Fix these with the "using" directive.
> 
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
>  src/compiler/glsl/linker.cpp                | 2 ++
>  src/compiler/glsl/lower_jumps.cpp           | 1 +
>  src/compiler/glsl/opt_constant_variable.cpp | 2 ++
>  src/compiler/glsl/opt_dead_code_local.cpp   | 1 +
>  4 files changed, 6 insertions(+)
> 
> diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
> index 2e7dd2b87356..3aa95b734321 100644
> --- a/src/compiler/glsl/linker.cpp
> +++ b/src/compiler/glsl/linker.cpp
> @@ -241,6 +241,7 @@ public:
>        /* empty */
>     }
>  
> +   using ir_hierarchical_visitor::visit;
>     virtual ir_visitor_status visit(ir_variable *var)
>     {
>        if (!var->type->is_array() || var->data.mode != ir_var_shader_in ||
> @@ -1411,6 +1412,7 @@ public:
>        ralloc_free(this->mem_ctx);
>     }
>  
> +   using ir_hierarchical_visitor::visit;
>     virtual ir_visitor_status visit(ir_variable *var)
>     {
>        const glsl_type *type_without_array;
> diff --git a/src/compiler/glsl/lower_jumps.cpp b/src/compiler/glsl/lower_jumps.cpp
> index 7dc34056a1b1..0cb55127a6e6 100644
> --- a/src/compiler/glsl/lower_jumps.cpp
> +++ b/src/compiler/glsl/lower_jumps.cpp
> @@ -392,6 +392,7 @@ struct ir_lower_jumps_visitor : public ir_control_flow_visitor {
>        }
>     }
>  
> +   using ir_visitor::visit;
>     virtual void visit(class ir_loop_jump * ir)
>     {
>        /* Eliminate all instructions after each one, since they are
> diff --git a/src/compiler/glsl/opt_constant_variable.cpp b/src/compiler/glsl/opt_constant_variable.cpp
> index 1c06ffe6750a..db91cac1589d 100644
> --- a/src/compiler/glsl/opt_constant_variable.cpp
> +++ b/src/compiler/glsl/opt_constant_variable.cpp
> @@ -50,7 +50,9 @@ struct assignment_entry {
>  class ir_constant_variable_visitor : public ir_hierarchical_visitor {
>  public:
>     virtual ir_visitor_status visit_enter(ir_dereference_variable *);
> +   using ir_hierarchical_visitor::visit;
>     virtual ir_visitor_status visit(ir_variable *);
> +   using ir_hierarchical_visitor::visit_enter;
>     virtual ir_visitor_status visit_enter(ir_assignment *);
>     virtual ir_visitor_status visit_enter(ir_call *);
>  
> diff --git a/src/compiler/glsl/opt_dead_code_local.cpp b/src/compiler/glsl/opt_dead_code_local.cpp
> index a4038794c6bf..f5ea4ae3d537 100644
> --- a/src/compiler/glsl/opt_dead_code_local.cpp
> +++ b/src/compiler/glsl/opt_dead_code_local.cpp
> @@ -91,6 +91,7 @@ public:
>        }
>     }
>  
> +   using ir_hierarchical_visitor::visit;
>     virtual ir_visitor_status visit(ir_dereference_variable *ir)
>     {
>        use_channels(ir->var, ~0);
>
I'm not sure if it's a good idea to hide these warnings, I think there 
is an underlying design issue over there.

On 05/30/2017 10:47 PM, Rob Herring wrote:
> clang gives warnings about overloaded virtual functions:
> 
> src/compiler/glsl/linker.cpp:244:30: warning: '(anonymous namespace)::array_resize_visitor::visit' hides overloaded virtual function [-Woverloaded-virtual]
>     virtual ir_visitor_status visit(ir_variable *var)
>                               ^
> src/compiler/glsl/linker.cpp:195:30: note: hidden overloaded virtual function '(anonymous namespace)::deref_type_updater::visit' declared here: type mismatch at 1st parameter ('ir_dereference_variable *' vs 'ir_variable *')
>     virtual ir_visitor_status visit(ir_dereference_variable *ir)
>                               ^
> src/compiler/glsl/linker.cpp:1414:30: warning: 'array_sizing_visitor::visit' hides overloaded virtual function [-Woverloaded-virtual]
>     virtual ir_visitor_status visit(ir_variable *var)
>                               ^
> src/compiler/glsl/linker.cpp:195:30: note: hidden overloaded virtual function '(anonymous namespace)::deref_type_updater::visit' declared here: type mismatch at 1st parameter ('ir_dereference_variable *' vs 'ir_variable *')
>     virtual ir_visitor_status visit(ir_dereference_variable *ir)
>                               ^
> src/compiler/glsl/lower_jumps.cpp:395:17: warning: '(anonymous namespace)::ir_lower_jumps_visitor::visit' hides overloaded virtual functions [-Woverloaded-virtual]
>     virtual void visit(class ir_loop_jump * ir)
>                  ^
> src/compiler/glsl/lower_jumps.cpp:417:17: warning: '(anonymous namespace)::ir_lower_jumps_visitor::visit' hides overloaded virtual functions [-Woverloaded-virtual]
>     virtual void visit(class ir_return * ir)
>                  ^
> src/compiler/glsl/lower_jumps.cpp:439:17: warning: '(anonymous namespace)::ir_lower_jumps_visitor::visit' hides overloaded virtual functions [-Woverloaded-virtual]
>     virtual void visit(class ir_discard * ir)
>                  ^
> src/compiler/glsl/lower_jumps.cpp:519:17: warning: '(anonymous namespace)::ir_lower_jumps_visitor::visit' hides overloaded virtual functions [-Woverloaded-virtual]
>     virtual void visit(ir_if *ir)
>                  ^
> src/compiler/glsl/lower_jumps.cpp:835:17: warning: '(anonymous namespace)::ir_lower_jumps_visitor::visit' hides overloaded virtual functions [-Woverloaded-virtual]
>     virtual void visit(ir_loop *ir)
>                  ^
> src/compiler/glsl/lower_jumps.cpp:963:17: warning: '(anonymous namespace)::ir_lower_jumps_visitor::visit' hides overloaded virtual functions [-Woverloaded-virtual]
>     virtual void visit(ir_function_signature *ir)
>                  ^
> src/compiler/glsl/lower_jumps.cpp:1009:17: warning: '(anonymous namespace)::ir_lower_jumps_visitor::visit' hides overloaded virtual functions [-Woverloaded-virtual]
>     virtual void visit(class ir_function * ir)
>                  ^
> src/compiler/glsl/opt_constant_variable.cpp:52:30: warning: '(anonymous namespace)::ir_constant_variable_visitor::visit_enter' hides overloaded virtual functions [-Woverloaded-virtual]
>     virtual ir_visitor_status visit_enter(ir_dereference_variable *);
>                               ^
> src/compiler/glsl/opt_dead_code_local.cpp:101:30: warning: '(anonymous namespace)::kill_for_derefs_visitor::visit' hides overloaded virtual functions [-Woverloaded-virtual]
>     virtual ir_visitor_status visit(ir_swizzle *ir)
>                               ^
> 
> Fix these with the "using" directive.
> 
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
>   src/compiler/glsl/linker.cpp                | 2 ++
>   src/compiler/glsl/lower_jumps.cpp           | 1 +
>   src/compiler/glsl/opt_constant_variable.cpp | 2 ++
>   src/compiler/glsl/opt_dead_code_local.cpp   | 1 +
>   4 files changed, 6 insertions(+)
> 
> diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
> index 2e7dd2b87356..3aa95b734321 100644
> --- a/src/compiler/glsl/linker.cpp
> +++ b/src/compiler/glsl/linker.cpp
> @@ -241,6 +241,7 @@ public:
>         /* empty */
>      }
>   
> +   using ir_hierarchical_visitor::visit;
>      virtual ir_visitor_status visit(ir_variable *var)
>      {
>         if (!var->type->is_array() || var->data.mode != ir_var_shader_in ||
> @@ -1411,6 +1412,7 @@ public:
>         ralloc_free(this->mem_ctx);
>      }
>   
> +   using ir_hierarchical_visitor::visit;
>      virtual ir_visitor_status visit(ir_variable *var)
>      {
>         const glsl_type *type_without_array;
> diff --git a/src/compiler/glsl/lower_jumps.cpp b/src/compiler/glsl/lower_jumps.cpp
> index 7dc34056a1b1..0cb55127a6e6 100644
> --- a/src/compiler/glsl/lower_jumps.cpp
> +++ b/src/compiler/glsl/lower_jumps.cpp
> @@ -392,6 +392,7 @@ struct ir_lower_jumps_visitor : public ir_control_flow_visitor {
>         }
>      }
>   
> +   using ir_visitor::visit;
>      virtual void visit(class ir_loop_jump * ir)
>      {
>         /* Eliminate all instructions after each one, since they are
> diff --git a/src/compiler/glsl/opt_constant_variable.cpp b/src/compiler/glsl/opt_constant_variable.cpp
> index 1c06ffe6750a..db91cac1589d 100644
> --- a/src/compiler/glsl/opt_constant_variable.cpp
> +++ b/src/compiler/glsl/opt_constant_variable.cpp
> @@ -50,7 +50,9 @@ struct assignment_entry {
>   class ir_constant_variable_visitor : public ir_hierarchical_visitor {
>   public:
>      virtual ir_visitor_status visit_enter(ir_dereference_variable *);
> +   using ir_hierarchical_visitor::visit;
>      virtual ir_visitor_status visit(ir_variable *);
> +   using ir_hierarchical_visitor::visit_enter;
>      virtual ir_visitor_status visit_enter(ir_assignment *);
>      virtual ir_visitor_status visit_enter(ir_call *);
>   
> diff --git a/src/compiler/glsl/opt_dead_code_local.cpp b/src/compiler/glsl/opt_dead_code_local.cpp
> index a4038794c6bf..f5ea4ae3d537 100644
> --- a/src/compiler/glsl/opt_dead_code_local.cpp
> +++ b/src/compiler/glsl/opt_dead_code_local.cpp
> @@ -91,6 +91,7 @@ public:
>         }
>      }
>   
> +   using ir_hierarchical_visitor::visit;
>      virtual ir_visitor_status visit(ir_dereference_variable *ir)
>      {
>         use_channels(ir->var, ~0);
>
On 31 May 2017 at 01:55, Ian Romanick <idr@freedesktop.org> wrote:
> I don't understand these warnings, and I have even less understanding of
> how "using" fixes them.  For example...
>
> On 05/30/2017 01:47 PM, Rob Herring wrote:
>> clang gives warnings about overloaded virtual functions:
>>
>> src/compiler/glsl/linker.cpp:244:30: warning: '(anonymous namespace)::array_resize_visitor::visit' hides overloaded virtual function [-Woverloaded-virtual]
>>    virtual ir_visitor_status visit(ir_variable *var)
>>                              ^
>> src/compiler/glsl/linker.cpp:195:30: note: hidden overloaded virtual function '(anonymous namespace)::deref_type_updater::visit' declared here: type mismatch at 1st parameter ('ir_dereference_variable *' vs 'ir_variable *')
>>    virtual ir_visitor_status visit(ir_dereference_variable *ir)
>>                              ^
>
> This is weird and confusing.  ir_hierarchical_visitor has a virtual
> visit(class ir_dereference_variable *) method.  The complaint about the
> type seems... bizarre.
>
Since it took me a second to click here is my take on it:

The "base" class deref_type_updater has
   virtual ir_visitor_status visit(ir_variable *var)

... while the derived one class array_resize_visitor
   virtual ir_visitor_status visit(ir_dereference_variable *ir)

... hence the type mismatch.

I think Samuel is spot on here - we might want to keep it as-is until
one gets the chance to address correctly.

-Emil
On 05/31/2017 06:09 AM, Emil Velikov wrote:
> On 31 May 2017 at 01:55, Ian Romanick <idr@freedesktop.org> wrote:
>> I don't understand these warnings, and I have even less understanding of
>> how "using" fixes them.  For example...
>>
>> On 05/30/2017 01:47 PM, Rob Herring wrote:
>>> clang gives warnings about overloaded virtual functions:
>>>
>>> src/compiler/glsl/linker.cpp:244:30: warning: '(anonymous namespace)::array_resize_visitor::visit' hides overloaded virtual function [-Woverloaded-virtual]
>>>    virtual ir_visitor_status visit(ir_variable *var)
>>>                              ^
>>> src/compiler/glsl/linker.cpp:195:30: note: hidden overloaded virtual function '(anonymous namespace)::deref_type_updater::visit' declared here: type mismatch at 1st parameter ('ir_dereference_variable *' vs 'ir_variable *')
>>>    virtual ir_visitor_status visit(ir_dereference_variable *ir)
>>>                              ^
>>
>> This is weird and confusing.  ir_hierarchical_visitor has a virtual
>> visit(class ir_dereference_variable *) method.  The complaint about the
>> type seems... bizarre.
>>
> Since it took me a second to click here is my take on it:
> 
> The "base" class deref_type_updater has
>    virtual ir_visitor_status visit(ir_variable *var)
> 
> ... while the derived one class array_resize_visitor
>    virtual ir_visitor_status visit(ir_dereference_variable *ir)
> 
> ... hence the type mismatch.

Right... but deref_type_updater is derived from ir_hierarchical_visitor,
and that has virtual ir_visitor_status visit(ir_dereference_variable
*ir).  That is the function being overridden.

> I think Samuel is spot on here - we might want to keep it as-is until
> one gets the chance to address correctly.
> 
> -Emil
On Wed, May 31, 2017 at 5:49 PM, Ian Romanick <idr@freedesktop.org> wrote:
> On 05/31/2017 06:09 AM, Emil Velikov wrote:
>> On 31 May 2017 at 01:55, Ian Romanick <idr@freedesktop.org> wrote:
>>> I don't understand these warnings, and I have even less understanding of
>>> how "using" fixes them.  For example...
>>>
>>> On 05/30/2017 01:47 PM, Rob Herring wrote:
>>>> clang gives warnings about overloaded virtual functions:
>>>>
>>>> src/compiler/glsl/linker.cpp:244:30: warning: '(anonymous namespace)::array_resize_visitor::visit' hides overloaded virtual function [-Woverloaded-virtual]
>>>>    virtual ir_visitor_status visit(ir_variable *var)
>>>>                              ^
>>>> src/compiler/glsl/linker.cpp:195:30: note: hidden overloaded virtual function '(anonymous namespace)::deref_type_updater::visit' declared here: type mismatch at 1st parameter ('ir_dereference_variable *' vs 'ir_variable *')
>>>>    virtual ir_visitor_status visit(ir_dereference_variable *ir)
>>>>                              ^
>>>
>>> This is weird and confusing.  ir_hierarchical_visitor has a virtual
>>> visit(class ir_dereference_variable *) method.  The complaint about the
>>> type seems... bizarre.
>>>
>> Since it took me a second to click here is my take on it:
>>
>> The "base" class deref_type_updater has
>>    virtual ir_visitor_status visit(ir_variable *var)
>>
>> ... while the derived one class array_resize_visitor
>>    virtual ir_visitor_status visit(ir_dereference_variable *ir)
>>
>> ... hence the type mismatch.
>
> Right... but deref_type_updater is derived from ir_hierarchical_visitor,
> and that has virtual ir_visitor_status visit(ir_dereference_variable
> *ir).  That is the function being overridden.

The problem AIUI is specific to overloaded functions. Here
deref_type_updater::visit overrides all the
ir_hierarchical_visitor::visit functions, so they are not available to
array_resize_visitor by default.

Rob