r338807 - [libclang 2/8] Add support for ObjCTypeParam
Michael Wu via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 2 21:02:40 PDT 2018
Author: mwu
Date: Thu Aug 2 21:02:40 2018
New Revision: 338807
URL: http://llvm.org/viewvc/llvm-project?rev=338807&view=rev
Log:
[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
Modified:
cfe/trunk/include/clang-c/Index.h
cfe/trunk/test/Index/print-type.m
cfe/trunk/tools/libclang/CXType.cpp
Modified: cfe/trunk/include/clang-c/Index.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang-c/Index.h?rev=338807&r1=338806&r2=338807&view=diff
==============================================================================
--- cfe/trunk/include/clang-c/Index.h (original)
+++ cfe/trunk/include/clang-c/Index.h Thu Aug 2 21:02:40 2018
@@ -3267,7 +3267,8 @@ enum CXTypeKind {
CXType_OCLQueue = 159,
CXType_OCLReserveID = 160,
- CXType_ObjCObject = 161
+ CXType_ObjCObject = 161,
+ CXType_ObjCTypeParam = 162
};
/**
Modified: cfe/trunk/test/Index/print-type.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/print-type.m?rev=338807&r1=338806&r2=338807&view=diff
==============================================================================
--- cfe/trunk/test/Index/print-type.m (original)
+++ cfe/trunk/test/Index/print-type.m Thu Aug 2 21:02:40 2018
@@ -7,6 +7,10 @@
@property (class) int classProp;
@end
+ at interface Bar<SomeType> : Foo
+-(SomeType)generic;
+ at 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]
Modified: cfe/trunk/tools/libclang/CXType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CXType.cpp?rev=338807&r1=338806&r2=338807&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CXType.cpp (original)
+++ cfe/trunk/tools/libclang/CXType.cpp Thu Aug 2 21:02:40 2018
@@ -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
TKIND(ObjCInterface);
TKIND(ObjCObject);
TKIND(ObjCObjectPointer);
+ TKIND(ObjCTypeParam);
TKIND(FunctionNoProto);
TKIND(FunctionProto);
TKIND(ConstantArray);
More information about the cfe-commits
mailing list