[cfe-dev] example of VisitCallExpr()?

ret val retval386 at gmail.com
Mon Jun 13 10:17:50 PDT 2011


That does not work for me

Code: https://gist.github.com/1023214
Test program I'm using: https://gist.github.com/1023217
Loading the pluggin and calling the compiler: clang -cc1 -load
~/llvm/Release+Asserts/lib/libPrintFunctionNames.so -plugin print-fns
test2.c

Thanks

On Mon, Jun 13, 2011 at 1:07 PM, Joshua Cranmer <Pidgeot18 at verizon.net>wrote:

> 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
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110613/1d79a51b/attachment.html>


More information about the cfe-dev mailing list