Getting a field's access class

Hey all,

Phase two of what I am doing is starting.

Given a c++ record in clang, I need to get whether it is public or
not. Is this done using the linkage member?

I will also need to, given an enumeration, get the names and the
values of the enumeration type. Given a field's type, how do I get to
the enumeration declaration?

Chris

Hey all,

Phase two of what I am doing is starting.

Given a c++ record in clang, I need to get whether it is public or
not. Is this done using the linkage member?

Decl::getAccess()

I will also need to, given an enumeration, get the names and the
values of the enumeration type.

Use EnumType::getDecl() to get to the EnumDecl, then EnumDecl::enumerator_begin()/EnumDecl::enumerator_end() to iterate over the enumerators, each of which has a name and a value.

Given a field's type, how do I get to
the enumeration declaration?

FieldDecl is a ValueDecl, which has ValueDecl::getType(). Then use ->getAs<EnumType>() to see if it has enumeration type.

  - Doug