On 2012-07-20 15:04, Andrej Mitrovic wrote:
On 7/7/12, Jacob Carlborg <[email protected]> wrote:
snip

Nice work!

Can I ask you something? Do you know if (lib)clang exports typeinfo
for default values? For example:

namespace Foo
{
     enum En
     {
         Val1,
         Val2
     };
}

void test(int x = Foo::Val1) { }

'x' has typeinfo (it's an int), but I'm interested in the typeinfo for
the default value "Foo::Val1". In other tools (like gccxml) the
default value is exported as a string which makes generating default
values in D hard (not impossible but just hard).

In libclang, the kind of "Foo::Val1" in the above example is:

CXCursor_FirstExpr -> CXCursor_DeclRefExpr -> CXCursor_NamespaceRef.

What I did here was I checked the kind of "Foo::Val1" cursor, drilled down into the cursor children as far as possible.

Cursor kinds:

http://clang.llvm.org/doxygen/group__CINDEX.html#gaaccc432245b4cd9f2d470913f9ef0013

--
/Jacob Carlborg


Reply via email to