Indexer: add CXObjCPropertyAttr_class for class properties.

rdar://25963227

llvm-svn: 271351
This commit is contained in:
Manman Ren 2016-05-31 23:22:04 +00:00
parent 656532075b
commit 04fd4d8bae
5 changed files with 13 additions and 2 deletions

View File

@ -3911,7 +3911,8 @@ typedef enum {
CXObjCPropertyAttr_atomic = 0x100,
CXObjCPropertyAttr_weak = 0x200,
CXObjCPropertyAttr_strong = 0x400,
CXObjCPropertyAttr_unsafe_unretained = 0x800
CXObjCPropertyAttr_unsafe_unretained = 0x800,
CXObjCPropertyAttr_class = 0x4000
} CXObjCPropertyAttrKind;
/**

View File

@ -73,6 +73,7 @@ struct X0 {};
@interface TestAttributes()
// <rdar://problem/9561076>
@property (retain) IBOutlet id anotherOutlet;
@property (class) int cProp;
@end
// CHECK: c-index-api-loadTU-test.m:4:12: ObjCInterfaceDecl=Foo:4:12 Extent=[4:1 - 12:5]
@ -167,7 +168,7 @@ struct X0 {};
// CHECK: c-index-api-loadTU-test.m:69:16: TypeRef=struct X0:71:8 Extent=[69:16 - 69:18]
// CHECK: c-index-api-loadTU-test.m:70:8: StructDecl=X0:70:8 Extent=[70:1 - 70:10]
// CHECK: c-index-api-loadTU-test.m:71:8: StructDecl=X0:71:8 (Definition) Extent=[71:1 - 71:14]
// CHECK: c-index-api-loadTU-test.m:73:12: ObjCCategoryDecl=:73:12 Extent=[73:1 - 76:5]
// CHECK: c-index-api-loadTU-test.m:73:12: ObjCCategoryDecl=:73:12 Extent=[73:1 - 77:5]
// CHECK: c-index-api-loadTU-test.m:73:12: ObjCClassRef=TestAttributes:62:12 Extent=[73:12 - 73:26]
// CHECK: c-index-api-loadTU-test.m:75:32: ObjCPropertyDecl=anotherOutlet:75:32 [retain,] Extent=[75:1 - 75:45]
// CHECK: c-index-api-loadTU-test.m:75:20: attribute(iboutlet)= Extent=[75:20 - 75:28]
@ -175,3 +176,7 @@ struct X0 {};
// CHECK: c-index-api-loadTU-test.m:75:32: ObjCInstanceMethodDecl=anotherOutlet:75:32 Extent=[75:32 - 75:45]
// CHECK: c-index-api-loadTU-test.m:75:32: ObjCInstanceMethodDecl=setAnotherOutlet::75:32 Extent=[75:32 - 75:45]
// CHECK: c-index-api-loadTU-test.m:75:32: ParmDecl=anotherOutlet:75:32 (Definition) Extent=[75:32 - 75:45]
// CHECK: c-index-api-loadTU-test.m:76:23: ObjCPropertyDecl=cProp:76:23 [class,] Extent=[76:1 - 76:28]
// CHECK: c-index-api-loadTU-test.m:76:23: ObjCClassMethodDecl=cProp:76:23 Extent=[76:23 - 76:28]
// CHECK: c-index-api-loadTU-test.m:76:23: ObjCClassMethodDecl=setCProp::76:23 Extent=[76:23 - 76:28]
// CHECK: c-index-api-loadTU-test.m:76:23: ParmDecl=cProp:76:23 (Definition) Extent=[76:23 - 76:28]

View File

@ -4,6 +4,7 @@
-(const id) mymethod2:(id)x blah:(Class)y boo:(SEL)z;
-(bycopy)methodIn:(in int)i andOut:(out short *)j , ...;
-(void)kindof_meth:(__kindof Foo *)p;
@property (class) int classProp;
@end
// RUN: c-index-test -test-print-type %s | FileCheck %s
@ -15,3 +16,4 @@
// CHECK: ParmDecl=i:5:27 (Definition) [In,] [type=int] [typekind=Int] [isPOD=1]
// 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] [isPOD=1] [pointeetype=Foo] [pointeekind=ObjCInterface]
// CHECK: ObjCPropertyDecl=classProp:7:23 [class,] [type=int] [typekind=Int] [isPOD=1]

View File

@ -937,6 +937,7 @@ static void PrintCursor(CXCursor Cursor, const char *CommentSchemaFile) {
PRINT_PROP_ATTR(weak);
PRINT_PROP_ATTR(strong);
PRINT_PROP_ATTR(unsafe_unretained);
PRINT_PROP_ATTR(class);
printf("]");
}
}

View File

@ -6720,6 +6720,7 @@ static void clang_annotateTokensImpl(CXTranslationUnit TU, ASTUnit *CXXUnit,
.Case("setter", true)
.Case("strong", true)
.Case("weak", true)
.Case("class", true)
.Default(false))
Tokens[I].int_data[0] = CXToken_Keyword;
}
@ -7166,6 +7167,7 @@ unsigned clang_Cursor_getObjCPropertyAttributes(CXCursor C, unsigned reserved) {
SET_CXOBJCPROP_ATTR(weak);
SET_CXOBJCPROP_ATTR(strong);
SET_CXOBJCPROP_ATTR(unsafe_unretained);
SET_CXOBJCPROP_ATTR(class);
#undef SET_CXOBJCPROP_ATTR
return Result;