diff options
author | Michael Wu <mwu.code@gmail.com> | 2018-08-03 03:03:20 +0000 |
---|---|---|
committer | Michael Wu <mwu.code@gmail.com> | 2018-08-03 03:03:20 +0000 |
commit | cfa6f95d761c637715ade56c863d2e9921ad8f87 (patch) | |
tree | 5a3a16e250015491c8cec6727b36484240e80d60 /include | |
parent | b7133123731b658bd5b55b9c1cca4088b49a268f (diff) | |
download | clang-cfa6f95d761c637715ade56c863d2e9921ad8f87.tar.gz |
[libclang 1/8] Add support for ObjCObjectType
Summary: This patch adds support to the clang-c API for identifying ObjCObjects in CXTypes, enumerating type args and protocols on ObjCObjectTypes, and retrieving the base type of ObjCObjectTypes. Currently only ObjCInterfaceTypes are exposed, which do not have type args or protocols.
Reviewers: yvvan, jbcoe
Reviewed By: yvvan
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D49063
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@338804 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/clang-c/Index.h | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/include/clang-c/Index.h b/include/clang-c/Index.h index 5178048bf7..170c658f57 100644 --- a/include/clang-c/Index.h +++ b/include/clang-c/Index.h @@ -3265,7 +3265,9 @@ enum CXTypeKind { CXType_OCLSampler = 157, CXType_OCLEvent = 158, CXType_OCLQueue = 159, - CXType_OCLReserveID = 160 + CXType_OCLReserveID = 160, + + CXType_ObjCObject = 161 }; /** @@ -3627,6 +3629,43 @@ CINDEX_LINKAGE int clang_getNumArgTypes(CXType T); CINDEX_LINKAGE CXType clang_getArgType(CXType T, unsigned i); /** + * Retrieves the base type of the ObjCObjectType. + * + * If the type is not an ObjC object, an invalid type is returned. + */ +CINDEX_LINKAGE CXType clang_Type_getObjCObjectBaseType(CXType T); + +/** + * Retrieve the number of protocol references associated with an ObjC object/id. + * + * If the type is not an ObjC object, 0 is returned. + */ +CINDEX_LINKAGE unsigned clang_Type_getNumObjCProtocolRefs(CXType T); + +/** + * Retrieve the decl for a protocol reference for an ObjC object/id. + * + * If the type is not an ObjC object or there are not enough protocol + * references, an invalid cursor is returned. + */ +CINDEX_LINKAGE CXCursor clang_Type_getObjCProtocolDecl(CXType T, unsigned i); + +/** + * Retreive the number of type arguments associated with an ObjC object. + * + * If the type is not an ObjC object, 0 is returned. + */ +CINDEX_LINKAGE unsigned clang_Type_getNumObjCTypeArgs(CXType T); + +/** + * Retrieve a type argument associated with an ObjC object. + * + * If the type is not an ObjC or the index is not valid, + * an invalid type is returned. + */ +CINDEX_LINKAGE CXType clang_Type_getObjCTypeArg(CXType T, unsigned i); + +/** * Return 1 if the CXType is a variadic function type, and 0 otherwise. */ CINDEX_LINKAGE unsigned clang_isFunctionTypeVariadic(CXType T); |