From: Michael Wu Date: Fri, 3 Aug 2018 04:02:40 +0000 (+0000) Subject: [libclang 2/8] Add support for ObjCTypeParam X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ff3bc9c864f30c4d6d3b239bbee6cec4f40c6bf8;p=clang [libclang 2/8] Add support for ObjCTypeParam Summary: This patch adds support to the libclang API for identifying ObjCTypeParams in CXTypes. This patch depends on D49063 since both patches add new values to CXTypeKind. Reviewers: yvvan, jbcoe Reviewed By: yvvan Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D49066 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@338807 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang-c/Index.h b/include/clang-c/Index.h index 170c658f57..572d24acb2 100644 --- a/include/clang-c/Index.h +++ b/include/clang-c/Index.h @@ -3267,7 +3267,8 @@ enum CXTypeKind { CXType_OCLQueue = 159, CXType_OCLReserveID = 160, - CXType_ObjCObject = 161 + CXType_ObjCObject = 161, + CXType_ObjCTypeParam = 162 }; /** diff --git a/test/Index/print-type.m b/test/Index/print-type.m index 64a161aa45..2afdfc0ff8 100644 --- a/test/Index/print-type.m +++ b/test/Index/print-type.m @@ -7,6 +7,10 @@ @property (class) int classProp; @end +@interface Bar : Foo +-(SomeType)generic; +@end + // RUN: c-index-test -test-print-type %s | FileCheck %s // CHECK: ObjCPropertyDecl=x:2:25 [readonly,] [type=id] [typekind=ObjCId] [canonicaltype=id] [canonicaltypekind=ObjCObjectPointer] [isPOD=1] // CHECK: ObjCInstanceMethodDecl=mymethod:3:8 [type=] [typekind=Invalid] [resulttype=int] [resulttypekind=Int] [isPOD=0] @@ -17,3 +21,4 @@ // CHECK: ParmDecl=j:5:49 (Definition) [Out,] [type=short *] [typekind=Pointer] [isPOD=1] [pointeetype=short] [pointeekind=Short] // CHECK: ParmDecl=p:6:36 (Definition) [type=__kindof Foo *] [typekind=ObjCObjectPointer] [canonicaltype=__kindof Foo *] [canonicaltypekind=ObjCObjectPointer] [basetype=Foo] [basekind=ObjCInterface] [isPOD=1] [pointeetype=Foo] [pointeekind=ObjCInterface] // CHECK: ObjCPropertyDecl=classProp:7:23 [class,] [type=int] [typekind=Int] [isPOD=1] +// CHECK: ObjCInstanceMethodDecl=generic:11:12 [type=] [typekind=Invalid] [resulttype=SomeType] [resulttypekind=ObjCTypeParam] [isPOD=0] diff --git a/tools/libclang/CXType.cpp b/tools/libclang/CXType.cpp index 81fd87ae3f..d9e0371b47 100644 --- a/tools/libclang/CXType.cpp +++ b/tools/libclang/CXType.cpp @@ -100,6 +100,7 @@ static CXTypeKind GetTypeKind(QualType T) { TKCASE(ObjCInterface); TKCASE(ObjCObject); TKCASE(ObjCObjectPointer); + TKCASE(ObjCTypeParam); TKCASE(FunctionNoProto); TKCASE(FunctionProto); TKCASE(ConstantArray); @@ -578,6 +579,7 @@ CXString clang_getTypeKindSpelling(enum CXTypeKind K) { TKIND(ObjCInterface); TKIND(ObjCObject); TKIND(ObjCObjectPointer); + TKIND(ObjCTypeParam); TKIND(FunctionNoProto); TKIND(FunctionProto); TKIND(ConstantArray);