[cfe-dev] How to print the forward declaration of an object visited through RecursiveASTVisitor ?

Manasij Mukherjee manasij7479 at gmail.com
Thu Jun 5 01:49:54 PDT 2014


Hi,
I am writing a tool that has to generate forward declarations of the
classes, functions and templates.
So, if it encounters,
class Foo {
};
The output should be:
class Foo;

I am just trying to consider a specific case first by overriding
VisitCXXRecordDecl .

The print method of the declaration seems to print the whole definition.
Declaration->print(llvm::outs(),clang::PrintingPolicy(clang::LangOptions()));


Is there a general way of doing this?
Or should I try to generate declaration in an adhoc way?
Something like...
llvm::outs()<< `GET TYPE` << `GET NAME` << `ATTRIBUTES` ;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140605/83128db4/attachment.html>


More information about the cfe-dev mailing list