Skip to content

Commit ced99b9

Browse files
committedAug 3, 2018
[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 llvm-svn: 338807
1 parent b2cc9a1 commit ced99b9

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed
 

‎clang/include/clang-c/Index.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3267,7 +3267,8 @@ enum CXTypeKind {
32673267
CXType_OCLQueue = 159,
32683268
CXType_OCLReserveID = 160,
32693269

3270-
CXType_ObjCObject = 161
3270+
CXType_ObjCObject = 161,
3271+
CXType_ObjCTypeParam = 162
32713272
};
32723273

32733274
/**

‎clang/test/Index/print-type.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ -(void)kindof_meth:(__kindof Foo *)p;
77
@property (class) int classProp;
88
@end
99

10+
@interface Bar<SomeType> : Foo
11+
-(SomeType)generic;
12+
@end
13+
1014
// RUN: c-index-test -test-print-type %s | FileCheck %s
1115
// CHECK: ObjCPropertyDecl=x:2:25 [readonly,] [type=id] [typekind=ObjCId] [canonicaltype=id] [canonicaltypekind=ObjCObjectPointer] [isPOD=1]
1216
// CHECK: ObjCInstanceMethodDecl=mymethod:3:8 [type=] [typekind=Invalid] [resulttype=int] [resulttypekind=Int] [isPOD=0]
@@ -17,3 +21,4 @@ -(void)kindof_meth:(__kindof Foo *)p;
1721
// CHECK: ParmDecl=j:5:49 (Definition) [Out,] [type=short *] [typekind=Pointer] [isPOD=1] [pointeetype=short] [pointeekind=Short]
1822
// 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]
1923
// CHECK: ObjCPropertyDecl=classProp:7:23 [class,] [type=int] [typekind=Int] [isPOD=1]
24+
// CHECK: ObjCInstanceMethodDecl=generic:11:12 [type=] [typekind=Invalid] [resulttype=SomeType] [resulttypekind=ObjCTypeParam] [isPOD=0]

‎clang/tools/libclang/CXType.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ static CXTypeKind GetTypeKind(QualType T) {
100100
TKCASE(ObjCInterface);
101101
TKCASE(ObjCObject);
102102
TKCASE(ObjCObjectPointer);
103+
TKCASE(ObjCTypeParam);
103104
TKCASE(FunctionNoProto);
104105
TKCASE(FunctionProto);
105106
TKCASE(ConstantArray);
@@ -578,6 +579,7 @@ CXString clang_getTypeKindSpelling(enum CXTypeKind K) {
578579
TKIND(ObjCInterface);
579580
TKIND(ObjCObject);
580581
TKIND(ObjCObjectPointer);
582+
TKIND(ObjCTypeParam);
581583
TKIND(FunctionNoProto);
582584
TKIND(FunctionProto);
583585
TKIND(ConstantArray);

0 commit comments

Comments
 (0)
Please sign in to comment.