[cfe-dev] Access default template parameters using libclang in python (or C)

Thomas Weidner thomas001le at googlemail.com
Sat Feb 22 03:42:57 PST 2014


Hello,

I am trying to do some C++ introspection using the AST generated by
libclang. I use the python bindings, but they seem to be a pretty
straightforward mapping to the C API.

There seems to be no way to access the default argument to template
parameters, like

template<class S, class T = bar<S> > struct foo {};

No AST node is generated for bar<S> and there is no method for access
the default argument. Using clangs internal API this is possible.

Is there any way to use libclang for this?

Thanks,
Thomas




More information about the cfe-dev mailing list