[cfe-dev] recordDecl() matching weirdness

Manuel Klimek via cfe-dev cfe-dev at lists.llvm.org
Tue Feb 16 02:20:10 PST 2016


On Mon, Feb 15, 2016 at 10:39 PM Richard via cfe-dev <cfe-dev at lists.llvm.org>
wrote:

> For reference, please see:
> <https://llvm.org/bugs/show_bug.cgi?id=26613>
>     recordDecl(unless(isDefinition())) is not the inverse of
>     recordDecl(isDefinition())
>
> <https://llvm.org/bugs/show_bug.cgi?id=26614>
>     recordDecl() matches same declaration twice
>
> I'm working in trunk, but I checked against release_36 branch and saw
> the same results.
>
> Given this source:
>
>  1      class Foo;
>  2      class Foo;
>  3
>  4      class Bar {
>  5      };
>  6
>  7      class Bar;
>
> Why does line 4 match recordDecl() twice?
>

That's the injected class name. The injected class name is implicit, and is
a declaration and not a definition. You'll basically want to exclude
matches on Bar::Bar


> If I try to filter declarations from definitions using
> TagDecl::isThisDeclarationADefinition(), then one of the matches is
> rejected, but the fact that it matches twice means that:
>
> recordDecl(isDefinition()) matches line 4, but none of the others.
> recordDecl(unless(isDefinition())) matches line 4 as well as the others.
>
> What is going on here?
> --
> "The Direct3D Graphics Pipeline" free book <
> http://tinyurl.com/d3d-pipeline>
>      The Computer Graphics Museum <http://ComputerGraphicsMuseum.org>
>          The Terminals Wiki <http://terminals.classiccmp.org>
>   Legalize Adulthood! (my blog) <http://LegalizeAdulthood.wordpress.com>
> _______________________________________________
> 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/20160216/14f6fe43/attachment.html>


More information about the cfe-dev mailing list