querying access spec for declaration in clang-c

Hello,

The clang-c API at present doesn't (appear to) support querying the
access spec associated with a given declaration. If I parse a
struct/class, I want to know whether a given member (field) is
public/protected/private, but that information isn't available right
now. I'm considering submitting a patch but I would like to ask for some
help:

1) What is the appropriate API in the AST API underneath to query that ?
2) Would it be OK to augment the clang-c function
clang_getCXXAccessSpecifier to accept arbitrary declarations and return
their associated access specs ? Right now it appears that function is
restricted to be used with base specs or access specs themselves.

Thanks,
    Stefan

Hello,

The clang-c API at present doesn't (appear to) support querying the
access spec associated with a given declaration. If I parse a
struct/class, I want to know whether a given member (field) is
public/protected/private, but that information isn't available right
now. I'm considering submitting a patch but I would like to ask for some
help:

1) What is the appropriate API in the AST API underneath to query that ?

Decl::getAccess()

2) Would it be OK to augment the clang-c function
clang_getCXXAccessSpecifier to accept arbitrary declarations and return
their associated access specs ? Right now it appears that function is
restricted to be used with base specs or access specs themselves.

Yes!

  - Doug