<div dir="ltr"><div>The thread linked below says it is necessary to use the tokenizer to get the value for default function arguments.</div><div>A similar solution may work for template args.</div><div><br></div><div><a href="http://clang-developers.42468.n3.nabble.com/Finding-default-value-for-function-argument-with-clang-c-API-td4036919.html">http://clang-developers.42468.n3.nabble.com/Finding-default-value-for-function-argument-with-clang-c-API-td4036919.html</a><br>
</div><div><br></div><div>Here is an approach to find function arguments using the Julia libclang bindings - I think the Python tokenizer API is similar:</div><div><br></div><div><a href="https://github.com/ihnorton/Clang.jl/issues/63#issuecomment-35749378">https://github.com/ihnorton/Clang.jl/issues/63#issuecomment-35749378</a><br>
</div><div><br></div><div>And, just in case you haven't seen it, there is a fantastic blog post about Python+libclang and C++:</div><div><br></div><div><a href="http://eli.thegreenplace.net/2011/07/03/parsing-c-in-python-with-clang/">http://eli.thegreenplace.net/2011/07/03/parsing-c-in-python-with-clang/</a><br>
</div><div><br></div><div><br></div><div>Isaiah</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Feb 22, 2014 at 6:42 AM, Thomas Weidner <span dir="ltr"><<a href="mailto:thomas001le@googlemail.com" target="_blank">thomas001le@googlemail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<br>
I am trying to do some C++ introspection using the AST generated by<br>
libclang. I use the python bindings, but they seem to be a pretty<br>
straightforward mapping to the C API.<br>
<br>
There seems to be no way to access the default argument to template<br>
parameters, like<br>
<br>
template<class S, class T = bar<S> > struct foo {};<br>
<br>
No AST node is generated for bar<S> and there is no method for access<br>
the default argument. Using clangs internal API this is possible.<br>
<br>
Is there any way to use libclang for this?<br>
<br>
Thanks,<br>
Thomas<br>
<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
</blockquote></div><br></div>