[cfe-dev] example of VisitCallExpr()?
Joshua Cranmer
Pidgeot18 at verizon.net
Mon Jun 13 10:07:23 PDT 2011
On 6/13/2011 9:54 AM, ret val wrote:
> Tried that first in another thread actually. It wasn't going anywhere.
> though...
>
> Anyway Ive been modification the Print Functions
> example(llvm/tools/clang/examples) and besides from the inheritence
> and implementing one function I'm not sure what else is required. Here
> it is https://gist.github.com/1015907
>
If I make the class the following, i can get it to work:
class PrintFunctionsConsumer : public ASTConsumer, public
RecursiveASTVisitor<PrintFunctionsConsumer> {
public:
bool VisitCallExpr (CallExpr *E) {
llvm::errs() << "Function call maybe?!";
return true;
}
virtual void HandleTranslationUnit(ASTContext &ctx) {
TraverseDecl(ctx.getTranslationUnitDecl());
}
};
--
Beware of bugs in the above code; I have only proved it correct, not tried it. -- Donald E. Knuth
More information about the cfe-dev
mailing list