Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Clang AST Matcher's "AND" and "OR"

Is it possible to use or in function declarations? like:

functionDecl(hasName("a") or hasName("b"))

or we have to use addMatcher to add more matchers to get the same result?

like image 623
ignorer Avatar asked Dec 24 '22 15:12

ignorer


1 Answers

There are several narrowing matchers that form logical combinations of other matchers: anyOf is like "or", allOf can implement "and", and unless is like "not". Your example might look like

functionDecl(
  anyOf(
    hasName("a"),
    hasName("b") ))
like image 140
Some Who Call Me Tim Avatar answered Jan 22 '23 16:01

Some Who Call Me Tim