[cfe-dev] Getting the class name for a category in libclang

Ted Kremenek kremenek at apple.com
Fri Oct 29 13:55:32 PDT 2010


On Oct 29, 2010, at 1:45 PM, David Chisnall wrote:

>> I think this is a succinct API; the only thing I'm mixed on is that this really isn't exposing more raw functionality in the library.  We've been trying to keep the API surface parsimonious.
> 
> For ObjC, there is never more than one superclass,

Ah, right!

> so simply clang_getObjCSuperClass(CXCursor) would be sufficient.  I was intending to support C++ classes via the same API, so users only needed one code path to build C++ and ObjC class hierarchies (the same cursor will never be both a valid C++ and ObjC class, so the hierarchies will be distinct).

With C++, we have the CXCursor_CXXBaseSpecifier cursor.  It encapsulates both the reference to the super class as well as the access control and kind of inheritance.

We should probably not to overly collapse APIs for querying the two object type systems from Objective-C and C++.  While they both have the notions of superclasses, they semantically are very different.



More information about the cfe-dev mailing list