[cfe-dev] Matching a function in global namespace

Miklos Vajna via cfe-dev cfe-dev at lists.llvm.org
Thu Mar 29 16:22:24 PDT 2018


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20180330/b63e5572/attachment.sig>


More information about the cfe-dev mailing list