[cfe-dev] Finding default value for function argument with clang-c API
doob at me.com
Tue Jan 7 07:59:51 PST 2014
On 2014-01-07 12:08, Milian Wolff wrote:
> When I'm already encountering a CXCursor_ParmDecl in my visitor,
> clang_Cursor_getArgument would not give me anything else - would it? The
> cursor it returns would point to the same ParmDecl I'm already trying to
> Now, I could continue visitChildren recursively on the ParmDecl cursor to
> figure out if it has any default argument. But I still cannot find any API to
> get a stringified version of the default argument.
> In the example above the "42" default value is represented as a
> CXCursor_IntegerLiteral. But neither clang_getCursorSpelling nor
> clang_getCursorDisplayName give me a string containing "42" - both return a
> null CXString...
> So, what other function can I use to get the stringified (raw) version of a
Ok, I see. How about clang_getCursorExtent?
More information about the cfe-dev