[cfe-dev] ast-print-xml for C++ and templates

Michael Lehn michael.lehn at uni-ulm.de
Wed Feb 16 02:46:10 PST 2011


Hi,

I am working on a little documentation tool for C++.   For this I need
to parse C++ files to some degree.  For this purpose I want to extract
from source/header files what function signature gets defined/declared
in what line.  

I figured out that all I need can be done perfectly with ast-print-xml as long
as functions and classes are not templated.

So for clang-developers this question might sound stupid:  Is this technically
not possible.  I mean is the information I am looking for "not in the AST"? Or
does the ast-print-xml just skip certain template-nodes?

Just to make sure that I make clear what I am looking for.  If I have a code like

template <typename T>
    int
    dummy(const T a);

// ....

template <typename T>
int
dummy(const T a)
{
    // ...
}

I merely would like to extract the information:

1)  Funktion "template <typename T>  int dummy(const T a)" declared in line ...
2)  Funktion "template <typename T>  int dummy(const T a)" defined in line ...



Thanks,

Michael





More information about the cfe-dev mailing list