[cfe-dev] How to tell if a NamedDecl is created by a FriendDecl?

Eric Fiselier via cfe-dev cfe-dev at lists.llvm.org
Wed May 30 09:33:00 PDT 2018


What about the lexical decl context?

/Eric

On Wed, May 30, 2018 at 10:26 AM, Eric Liu via cfe-dev <
cfe-dev at lists.llvm.org> wrote:

> In the following example, an "implicit" declaration of "class Y" will be
> created for "friend class Y" (it's not marked as implicit in AST because
> it's actually written in the friend declaration), and it will have the same
> USR as the real declaration. I couldn't find a way to tell whether such
> decl was created by the friend decl when only given the NamedDecl. Checking
> its DeclContext doesn't help because the context is the namespace nx.
>
>    - ```
>    namespace nx {
>    class X {
>      friend class Y;
>    };
>    class Y {};
>    }  // namespace nx
>    ``
>
> I'm wondering if this is actually possible. If not, would it make sense to
> flag decls created by friend decls in the AST?
>
> Thanks,
> Eric
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20180530/b5a80228/attachment.html>


More information about the cfe-dev mailing list