[cfe-dev] Matching a function in global namespace
Matthieu Brucher via cfe-dev
cfe-dev at lists.llvm.org
Thu Mar 29 16:26:27 PDT 2018
Le ven. 30 mars 2018 à 00:22, Miklos Vajna <vmiklos at vmiklos.hu> a écrit :
> Hi,
>
> On Thu, Mar 29, 2018 at 03:58:36PM +0000, Matthieu Brucher via cfe-dev <
> cfe-dev at lists.llvm.org> wrote:
> > I know how to match a function by its name, but how is it possible to
> check
> > that it's in the global namespace or namespace Foo?
>
> Let's say you have:
>
> ----
> int foo();
>
> namespace n
> {
> int foo();
> }
> ----
>
> If you load this into clang-query, then just functionDecl() matches both
> function declarations, but
> functionDecl(hasParent(translationUnitDecl())) only matches the one in
> the global namespace.
>
> HTH,
>
> Miklos
>
That was my missing piece, thanks a lot! With allOf, I can combine this
with what I want to create and I suppose that even I could use
namespaceDecl for hasParent as well.
Thanks, I will end up figuring this by myself...
Regards
Matthieu Brucher
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20180329/1bb037ea/attachment.html>
More information about the cfe-dev
mailing list