[cfe-dev] Loss "template <class T> " in Decl::dump().

Manuel Klimek klimek at google.com
Sun Oct 21 22:56:19 PDT 2012


On Fri, Oct 19, 2012 at 8:48 PM, boba2001 <asasasdd at mail.ru> wrote:

> Hello all!
>
> I use RecursiveASTVisitor to pass over the top level declarations.
> I determined the VisitDecl method in class derived from RecursiveASTVisitor
> as:
> bool MyASTVisitor::VisitDecl (Decl * D){
>         D -> dump();
> }
>
> I use the test example:
> --- 1.cpp ---
> template <class T> void templ_a(T x){
>         int b = 123;
> }
>
> int main(){
>         int a = 123;
>         templ_a<int>(a);
>         return 0;
> }
> ------------
>
> My question is: why does template function have the form:
> void templ_a(T x) {
>     int b = 123;
> }
>
> That is lost "template <class T> ". How can I get the declaration with
> "template <class T>"?
>

The question is: why do you need it? dump() is as far as I understand
considered a debugging aid,  not a (for some definition correct)
pretty-printer.

Cheers,
/Manuel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20121022/b5d45d12/attachment.html>


More information about the cfe-dev mailing list