xref: /aosp_15_r20/external/clang/test/Index/annotate-comments-property-accessor.m (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li// RUN: rm -rf %t
2*67e74705SXin Li// RUN: mkdir %t
3*67e74705SXin Li// RUN: c-index-test -test-load-source all -comments-xml-schema=%S/../../bindings/xml/comment-xml-schema.rng %s > %t/out
4*67e74705SXin Li// RUN: FileCheck %s < %t/out
5*67e74705SXin Li// rdar://12378879
6*67e74705SXin Li
7*67e74705SXin Li// Ensure that XML we generate is not invalid.
8*67e74705SXin Li// RUN: FileCheck %s -check-prefix=WRONG < %t/out
9*67e74705SXin Li// WRONG-NOT: CommentXMLInvalid
10*67e74705SXin Li
11*67e74705SXin Li@interface AppDelegate
12*67e74705SXin Li/**
13*67e74705SXin Li  \brief This is ReadonlyProperty
14*67e74705SXin Li*/
15*67e74705SXin Li@property (readonly, getter = ReadonlyGetter) int MyProperty;
16*67e74705SXin Li// CHECK: FullCommentAsXML=[<Function isInstanceMethod="1" file="{{[^"]+}}annotate-comments-property-accessor.m" line="[[@LINE-1]]" column="51"><Name>MyProperty</Name><USR>c:objc(cs)AppDelegate(py)MyProperty</USR><Declaration>- (int)ReadonlyGetter;</Declaration><Abstract><Para> This is ReadonlyProperty</Para></Abstract></Function>]
17*67e74705SXin Li
18*67e74705SXin Li/**
19*67e74705SXin Li  \brief This is GeneralProperty
20*67e74705SXin Li*/
21*67e74705SXin Li@property int GeneralProperty;
22*67e74705SXin Li// CHECK: FullCommentAsXML=[<Function isInstanceMethod="1" file="{{[^"]+}}annotate-comments-property-accessor.m" line="[[@LINE-1]]" column="15"><Name>GeneralProperty</Name><USR>c:objc(cs)AppDelegate(py)GeneralProperty</USR><Declaration>- (int)GeneralProperty;</Declaration><Abstract><Para> This is GeneralProperty</Para></Abstract></Function>]
23*67e74705SXin Li// CHECK: FullCommentAsXML=[<Function isInstanceMethod="1" file="{{[^"]+}}annotate-comments-property-accessor.m" line="[[@LINE-2]]" column="15"><Name>GeneralProperty</Name><USR>c:objc(cs)AppDelegate(py)GeneralProperty</USR><Declaration>- (void)setGeneralProperty:(int)GeneralProperty;</Declaration><Abstract><Para> This is GeneralProperty</Para></Abstract></Function>]
24*67e74705SXin Li
25*67e74705SXin Li/**
26*67e74705SXin Li  \brief This is PropertyInPrimaryClass
27*67e74705SXin Li*/
28*67e74705SXin Li@property (copy, nonatomic) id PropertyInPrimaryClass;
29*67e74705SXin Li- (void) setThisRecord : (id)arg;
30*67e74705SXin Li- (id) Record;
31*67e74705SXin Li@end
32*67e74705SXin Li// CHECK: FullCommentAsXML=[<Function isInstanceMethod="1" file="{{[^"]+}}annotate-comments-property-accessor.m" line="[[@LINE-4]]" column="32"><Name>PropertyInPrimaryClass</Name><USR>c:objc(cs)AppDelegate(py)PropertyInPrimaryClass</USR><Declaration>- (id)PropertyInPrimaryClass;</Declaration><Abstract><Para> This is PropertyInPrimaryClass</Para></Abstract></Function>]
33*67e74705SXin Li// CHECK: FullCommentAsXML=[<Function isInstanceMethod="1" file="{{[^"]+}}annotate-comments-property-accessor.m" line="[[@LINE-5]]" column="32"><Name>PropertyInPrimaryClass</Name><USR>c:objc(cs)AppDelegate(py)PropertyInPrimaryClass</USR><Declaration>- (void)setPropertyInPrimaryClass:(id)PropertyInPrimaryClass;</Declaration><Abstract><Para> This is PropertyInPrimaryClass</Para></Abstract></Function>]
34*67e74705SXin Li
35*67e74705SXin Li@interface AppDelegate()
36*67e74705SXin Li- (id) GetterInClassExtension;
37*67e74705SXin Li/**
38*67e74705SXin Li  \brief This is Record
39*67e74705SXin Li*/
40*67e74705SXin Li@property (copy, setter = setThisRecord:) id Record;
41*67e74705SXin Li@end
42*67e74705SXin Li// CHECK: FullCommentAsXML=[<Function isInstanceMethod="1" file="{{[^"]+}}annotate-comments-property-accessor.m" line="[[@LINE-6]]" column="1"><Name>PropertyInClassExtension</Name><USR>c:objc(cs)AppDelegate(py)PropertyInClassExtension</USR><Declaration>- (id)GetterInClassExtension;</Declaration><Abstract><Para> This is PropertyInClassExtension</Para></Abstract></Function>]
43*67e74705SXin Li
44*67e74705SXin Li@interface AppDelegate()
45*67e74705SXin Li/**
46*67e74705SXin Li  \brief This is PropertyInClassExtension
47*67e74705SXin Li*/
48*67e74705SXin Li@property (copy, getter = GetterInClassExtension) id PropertyInClassExtension;
49*67e74705SXin Li
50*67e74705SXin Li- (id) PropertyInPrimaryClass;
51*67e74705SXin Li@end
52*67e74705SXin Li// CHECK: FullCommentAsXML=[<Function isInstanceMethod="1" file="{{[^"]+}}annotate-comments-property-accessor.m" line="[[@LINE-4]]" column="54"><Name>PropertyInClassExtension</Name><USR>c:objc(cs)AppDelegate(py)PropertyInClassExtension</USR><Declaration>- (id)GetterInClassExtension;</Declaration><Abstract><Para> This is PropertyInClassExtension</Para></Abstract></Function>]
53*67e74705SXin Li// CHECK: FullCommentAsXML=[<Function isInstanceMethod="1" file="{{[^"]+}}annotate-comments-property-accessor.m" line="[[@LINE-5]]" column="54"><Name>PropertyInClassExtension</Name><USR>c:objc(cs)AppDelegate(py)PropertyInClassExtension</USR><Declaration>- (void)setPropertyInClassExtension:(id)PropertyInClassExtension;</Declaration><Abstract><Para> This is PropertyInClassExtension</Para></Abstract></Function>]
54*67e74705SXin Li
55*67e74705SXin Li@implementation AppDelegate
56*67e74705SXin Li- (id) PropertyInPrimaryClass { return 0; }
57*67e74705SXin Li@end
58*67e74705SXin Li
59*67e74705SXin Li
60*67e74705SXin Li
61*67e74705SXin Li
62*67e74705SXin Li
63