Clang AST Matcher's "AND" and "OR"
Asked Answered
L

1

5

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?

Lakeishalakeland answered 31/7, 2017 at 18:23 Comment(0)
R
11

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") ))
Rashida answered 3/8, 2017 at 23:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.