Here is a list of queries I'd like to express via libclang, but presumably can't.
Could you please confirm that these aren't yet implemented ? (I may start working on patches in that case.)
* clang_CXXMethod_isStatic() queries whether a member function is static. There appears to be no such thing for 'virtual' and 'const'. Also, a similar query (for static) would be useful for non-function members ("fields").
* clang_getCXXAccessSpecifiers() is documented to report the access control for a base class (which the cursor argument is referring to). May this function be extended to also report access level for members.
* There doesn't appear to be any function to query a function's exception specifier.
* Would it be possible to report dependent types / expressions with a new cursor type, instead of the common "UnexposedExpr" ?
Thanks,
Stefan
Here is a list of queries I'd like to express via libclang, but
presumably can't.
Could you please confirm that these aren't yet implemented ? (I may
start working on patches in that case.)
* clang_CXXMethod_isStatic() queries whether a member function is
static. There appears to be no such thing for 'virtual' and 'const'.
Correct. The API should expose information about 'virtual', cv-qualifiers, and ref-qualifiers on C++ member functions.
Also, a similar query (for static) would be useful for non-function
members ("fields").
It's actually not needed. Non-static data members are fields; static data members are described as variables.
* clang_getCXXAccessSpecifiers() is documented to report the access
control for a base class (which the cursor argument is referring to).
May this function be extended to also report access level for members.
I think that's a great idea.
* There doesn't appear to be any function to query a function's
exception specifier.
Correct; we don't expose that information.
* Would it be possible to report dependent types / expressions with a
new cursor type, instead of the common "UnexposedExpr" ?
Dependent types and expressions can take many forms, including forms that already have "exposed" cursor kinds (e.g., a declaration reference expression can be type-dependent). If you need type- and value-dependence information, I suggest adding clang_isTypeDependent()/clang_isValueDependent() that operates on expression cursors.
- Doug
* There doesn't appear to be any function to query a function's
exception specifier.
Correct; we don't expose that information.
What would be the best way to add support for that ? Adding a new CXCursor_ExceptionSpec cursor, which has child cursors of of some appropriate reference kind ? Or a query function that gives the equivalent information explicitly ?
* Would it be possible to report dependent types / expressions with a
new cursor type, instead of the common "UnexposedExpr" ?
Dependent types and expressions can take many forms, including forms that already have "exposed" cursor kinds (e.g., a declaration reference expression can be type-dependent). If you need type- and value-dependence information, I suggest adding clang_isTypeDependent()/clang_isValueDependent() that operates on expression cursors.
OK, understood. I think what I was trying to ask is for CXType_Unexposed, not CXCursor_UnexposedDecl.
That is:
template <typename T>
struct foo
{
T member;
};
would report a FieldDecl cursor for 'member'. When calling clang_getCursorType() on that, I obtain a CXType_Unexposed, while I think something more indicative of this being a dependent type would be more useful. (If that is not possible, a new clang_isTypeDependent() function would certainly be helpful.)
Thanks,
Stefan
Well, if you had a member such as
T *member_ptr;
then that would represented as a pointer type that is also a dependent type. Probably what you want for this is clang_isDependentType(CXType); that essentially maps down to Type::isDependentType().
- Doug