ParmVarDecl of CXXConstructorDecl Matcher

Hello everyone,

How would one write a matcher that looks for ParmVarDecls that don’t occur in constructor decls?
I’d figure

parmVarDecl(unless(hasParent(cxxConstructorDecl()))),

but that doesn’t work.
Replacing hasParent with hasAncestor seems to work, but looks weird considering ParmVarDecls look like direct children of FunctionDecls in the AST. Is there something special about ParmVarDecls, also since there is the hasAnyParameter matcher?

Thanks!
Sigi

Hi Sigi,

I’m not sure if this is intended behaviour, but it seems the parent of a ParmVarDecl is a TypeLoc.
For now this should serve your purpose, but I think this may need looking into.
parmVarDecl(hasParent(typeLoc(unless(hasParent(cxxConstructorDecl())))))

~Nathan