[cfe-dev] Finding default value for function argument with clang-c API

Milian Wolff mail at milianw.de
Mon Jan 6 08:10:53 PST 2014

Hello again.

When encountering a CXCursor_ParmDecl, how can I figure out if it has a 
default value and what that value is? E.g.:

void foo(int i = 42);

Here I'd like to know that "i" is 42 by default. A string representation of 
the default value would be sufficient to me, but even that doesn't seem to be 
accessible. I could find some range for where the "= 42" is, but then I cannot 
find any function in the C-API of clang to get a string representation of that 

Milian Wolff
mail at milianw.de

More information about the cfe-dev mailing list