[cfe-dev] match OffsetOfExpr

Billy Araujo via cfe-dev cfe-dev at lists.llvm.org
Fri Aug 14 02:35:49 PDT 2020


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.


On Wed, Aug 12, 2020 at 7:37 PM Aaron Ballman <aaron at aaronballman.com>
wrote:

> On Wed, Aug 12, 2020 at 1:52 PM Billy Araujo via cfe-dev
> <cfe-dev at lists.llvm.org> wrote:
> >
> > Anyone know how to match OffsetOfExpr?
> >
> > |-FunctionDecl 0x2484fff0298 <line:9:1, line:12:1> line:9:13 used f1
> 'void ()' static
> > | `-CompoundStmt 0x2484fff03c8 <line:10:1, line:12:1>
> > |   `-OffsetOfExpr 0x2484fff0390 <C:\Program
> Files\LLVM\lib\clang\10.0.0\include\stddef.h:104:24, col:47> 'unsigned long
> long'
> >
> > In clang-query if I type: m offsetOfExpr() is says: matcher not found.
>
> We don't currently expose a matcher for it, so that's why it's not
> found. It wouldn't be difficult to add a matcher for it, however (feel
> free to add me as a review if you decide to author a patch for this).
>
> ~Aaron
>
> >
> >
> > _______________________________________________
> > cfe-dev mailing list
> > cfe-dev at lists.llvm.org
> > https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20200814/fe020b26/attachment-0001.html>


More information about the cfe-dev mailing list