[cfe-users] Order of matchers

Robert Ankeney via cfe-users cfe-users at lists.llvm.org
Mon Jul 20 09:48:57 PDT 2020


I have a tool with multiple matchers. Each different matcher is added to
MatchFinder with a call to addMatcher(). It seems like the order of matches
that are called isn't dependent on the order I added them with addMatcher.
To give a specific example, I'm looking to match variables whose type is a
template parameter (matcher 1) using
fieldDecl(hasType(templateTypeParmType())), which works fine. If I want to
also have a matcher 2 just for fieldDecl(), that matcher is always called
before the more specific template parameter matcher 1.
I tried looking for template parameters inside the fieldDecl matcher with a
"if (isa<TemplateTypeParmType>(TY))", where TY is the FieldDecl type, but
with no success. Instead the type appears to have been already determined
(e.g. float). So is there a way to assure the order that matchers are
called?

Thanks,
Robert
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20200720/8e25c594/attachment.html>


More information about the cfe-users mailing list