Quantcast

UsingDecl vs UsingShadowDecl

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

UsingDecl vs UsingShadowDecl

Martin J. O'Riordan via cfe-dev
Hi all,

I'm having trouble understanding what the respective Decls represent.

When would there be more than one UsingShadowDecl for a UsingDecl?
When would there be none? Why is the target decl only reachable from
the shadows?

I'm about to fix a bug in IWYU where we have a UsingDecl without any
shadows, but I wanted to make sure I understand the concepts before
committing to anything.

Thanks,
- Kim
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: UsingDecl vs UsingShadowDecl

Martin J. O'Riordan via cfe-dev
On 30 Apr 2017 2:04 pm, "Kim Gräsman via cfe-dev" <[hidden email]> wrote:
Hi all,

I'm having trouble understanding what the respective Decls represent.

When would there be more than one UsingShadowDecl for a UsingDecl?
When would there be none? Why is the target decl only reachable from
the shadows?

The UsingDecl represents the source declaration "using X::Y;"
Each UsingShadowDecl represents one declaration that was made visible to name lookup by the UsingDecl.

There can be multiple UsingShadowDecls if the UsingDecl names an overload set. There can be zero if all the declarations for a class scope UsingDecl are hidden by derived class members.

I'm about to fix a bug in IWYU where we have a UsingDecl without any
shadows, but I wanted to make sure I understand the concepts before
committing to anything.

Thanks,
- Kim
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: UsingDecl vs UsingShadowDecl

Martin J. O'Riordan via cfe-dev
Hi Richard,

On Mon, May 1, 2017 at 6:28 AM, Richard Smith <[hidden email]> wrote:
>
> The UsingDecl represents the source declaration "using X::Y;"
> Each UsingShadowDecl represents one declaration that was made visible to
> name lookup by the UsingDecl.
>
> There can be multiple UsingShadowDecls if the UsingDecl names an overload set.
> There can be zero if all the declarations for a class scope UsingDecl are hidden by
> derived class members.

It sounds so easy when spelled out like that :-)

And I see now that the UsingShadowDecl is necessary as the link
between the UsingDecl and the target decl, so that resolution can be
made both ways.

Thanks!

- Kim
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Loading...