[cfe-dev] querying access spec for declaration in clang-c

Douglas Gregor dgregor at apple.com
Mon Dec 17 12:04:07 PST 2012


On Dec 11, 2012, at 6:40 AM, Stefan Seefeld <stefan at seefeld.name> wrote:

> 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



More information about the cfe-dev mailing list