Libclang get storage class


I'm trying to find out if a function/variable declaration in C was
done using static as storage class or not.

I'm trying to retrieve the storage class using libclang and it's
python bindings.

After checking the documentatation for libclang under

for storage class exports i could not find anything.

Is it really the case that no storage class access functions are
exported in libclang or did i just oversee it?

Is this the right way to retrieve if a function/variable was declared
static by looking at FunctionDecl::getStorageClass() and
VarDecl::getStorageClass()? Or is it also retrievable somewhere else
in libClang?

Thank you for your help.


I don't see a way to retrieve that either. Did you consider writing a patch
for that instead?

It should be pretty trivial to wrap the StorageClass enum in libclang and
provide a function such as 'clang_getCursorStorageClass' to retrieve the SC
from either the FunctionDecl or VarDecl.

I think it totally makes sense to expose that in the libclang API.

I suggest having a look at 'clang_getCursorAvailability' for inspiration on
how to do it. It does almost the same (exporting an enum from C++ to the C