[cfe-dev] TraverseExplicitCastExpr?

scott constable via cfe-dev cfe-dev at lists.llvm.org
Tue May 23 06:53:30 PDT 2017


I figured out the problem myself. Traverse* only hits the base class of
each node (e.g. Decl, Stmt, or Type), and the dynamic class of each node.
Since ExplicitCastExpr is abstract, TraverseExplicitCastExpr is not valid.
Instead I needed to use VisitExplicitCastExpr.

On Mon, May 22, 2017 at 11:55 AM, scott constable <sdconsta at syr.edu> wrote:

> Hi,
>
> I'm writing a clang libtool using RecursiveASTVisitor, and I've noticed
> that I can define Traverse* for some types, but not others. For instance, I
> can define TraverseArraySubscriptExpr() and TraverseMemberExpr(), but not
> TraverseExplicitCastExpr(). So I can write
>
> bool MyVisitor::TraverseExplicitCastExpr(ExplicitCastExpr *ECE) {
>   // do some stuff
>   return RecursiveASTVisitor<MyVisitor>::TraverseExplicitCastExpr(ECE);
> }
>
> but then the compiler complains that there is no TraverseExplicitCastExpr
> in the base class RecursiveASTVisitor<MyVisitor>. But if I do the same
> for an ArraySubscriptExpr, it compiles just fine.
>
> Any insight into this matter would be much appreciated.
>
> Thanks,
>
> Scott Constable
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170523/03aad433/attachment.html>


More information about the cfe-dev mailing list