This patch implements clang_getCursorVisibility which provides access to NamedDecl::getVisibility. It's been very useful for me when generating bindings.
Isn't r246931 what you're looking for?
Index: expose visibility attribute
Expose the previously unexposed visibility attribute via the python and C
Can't you use/improve that API instead?
Well, I think it's ok then. Still there is no test for visibility set from command line case.
Also adding comment to clang_getCursorVisibility explaining that it also works with visibility set from command line would be very useful.
Are you sure that this is correct?
Not sure about this. For most purposes, default and hidden is all you need so I don't think there's much lost by cutting this part of this test. I was on the fence about whether to test for protected.