[cfe-dev] match OffsetOfExpr

Bruno Ricci via cfe-dev cfe-dev at lists.llvm.org
Fri Aug 14 03:11:17 PDT 2020



On 14/08/2020 10:35, Billy Araujo via cfe-dev wrote:
> Hi,
> 
> I don't know how it should be matched, using classOf, dyn_cast, or isa.
> 
> I tried:
> 
> namespace
> {
>     AST_MATCHER(clang::Stmt, isOffsetOf) { return clang::isa<clang::OffsetOfExpr>(&Node); }
> }
> 
> and still doesn't match.
> 

You can use a VariadicDynCastAllOfMatcher<Stmt, OffsetOfExpr> like the other matchers
for statements/expressions. That said, why are we manually adding matchers for each nodes?
It seems to me that they could be auto-generated from the statement/declaration/type databases.

~Bruno




More information about the cfe-dev mailing list