[cfe-dev] RecursiveASTVisitor tutorial + counting nodes in AST?

Aaron W. Hsu arcfide at sacrideo.us
Wed Oct 1 10:05:04 PDT 2014


Dear Clang Dev:

I've worked through the tutorial on using the RecursiveASTVisitor and
it's working quite well. Things are making sense more or less. However,
I've not quite understood the best way to get extra data back out of a
visitor once you have traversed an AST. In this case, let's take the
RecursiveASTVisitor tutorial code and modify it so that it counts the
number of nodes in the AST for a file. How would I do this? I can store
a count field in the visitor and use that, which works fine, but I don't
know how to get access to the visitor after Tool.run() completes. What's
the best way to do this?

     Yours truly,

          Aaron W. Hsu

-- 
Aaron W. Hsu | arcfide at sacrideo.us | http://www.sacrideo.us
Please support my work: https://www.gratipay.com/arcfide/
לֵ֤ב חֲכָמִים֙ בְּבֵ֣ית אֵ֔בֶל וְלֵ֥ב כְּסִילִ֖ים בְּבֵ֥ית שִׂמְחָֽה׃




More information about the cfe-dev mailing list