[cfe-dev] libclang: inspecting function parameters with default arguments
Milian Wolff
mail at milianw.de
Thu Feb 6 02:00:35 PST 2014
On Thursday 06 February 2014 10:02:04 Tamás Szelei wrote:
> Hello,
>
> I would like to detect when a PARM_DECL has a default value, i.e.
>
> in the case:
>
> void foo(int x = 5);
>
> I want to be able to tell that x has a default value. I'm not interested in
> the statement after the = sign, only the fact that it has a default
> parameter.
>
> Is this possible with libclang?
I've asked this before on this list and apparently it is not easily possible
with libclang currently. What you can do if you just want to figure out if a
default argument is there, is to recurse manually into the cursor and see if
it has any children - if so, it has a default argument.
See also: http://clang-developers.42468.n3.nabble.com/Finding-default-value-for-function-argument-with-clang-c-API-td4036919.html
Bye
--
Milian Wolff
mail at milianw.de
http://milianw.de
More information about the cfe-dev
mailing list