xref: /llvm-project/clang/test/Index/complete-documentation-properties.m (revision 0f1c1be1968076d6f96f8a7bcc4a15cf195ecd97)
1// Note: the run lines follow their respective tests, since line/column numbers
2// matter in this test.
3// This test is for when property accessors do not have their own code
4// completion comments. Use those in their properties in this case.
5
6@interface AppDelegate
7/**
8  \brief This is ReadonlyProperty
9*/
10@property (readonly, getter = ReadonlyGetter) id MyProperty;
11
12/**
13  \brief This is GeneralProperty
14*/
15@property int GeneralProperty;
16
17/**
18  \brief This is PropertyInPrimaryClass
19*/
20@property (copy, nonatomic) id PropertyInPrimaryClass;
21
22- (void) setThisRecord : (id)arg;
23- (id) Record;
24@end
25
26
27@interface AppDelegate()
28- (id) GetterInClassExtension;
29/**
30  \brief This is Record
31*/
32@property (copy, setter = setThisRecord:) id Record;
33@end
34
35@interface AppDelegate()
36/**
37  \brief This is PropertyInClassExtension
38*/
39@property (copy, getter = GetterInClassExtension) id PropertyInClassExtension;
40
41- (id) PropertyInPrimaryClass;
42@end
43
44@implementation AppDelegate
45- (id) PropertyInPrimaryClass {
46  id p = [self ReadonlyGetter];
47  p = [self GetterInClassExtension];
48  p = [self PropertyInPrimaryClass];
49  p = [self Record];
50  [self setThisRecord : (id)0 ];
51  p = self.GetterInClassExtension;
52  return 0;
53}
54@end
55// RUN: env CINDEXTEST_COMPLETION_BRIEF_COMMENTS=1 c-index-test -code-completion-at=%s:46:16 %s | FileCheck -check-prefix=CHECK-CC1 %s
56// CHECK-CC1: {TypedText ReadonlyGetter}{{.*}}(brief comment: This is ReadonlyProperty)
57
58// RUN: env CINDEXTEST_COMPLETION_BRIEF_COMMENTS=1 c-index-test -code-completion-at=%s:47:13 %s | FileCheck -check-prefix=CHECK-CC2 %s
59// CHECK-CC2: {TypedText GetterInClassExtension}{{.*}}(brief comment: This is PropertyInClassExtension)
60
61// RUN: env CINDEXTEST_COMPLETION_BRIEF_COMMENTS=1 c-index-test -code-completion-at=%s:48:13 %s | FileCheck -check-prefix=CHECK-CC3 %s
62// CHECK-CC3: {TypedText PropertyInPrimaryClass}{{.*}}(brief comment: This is PropertyInPrimaryClass)
63
64// RUN: env CINDEXTEST_COMPLETION_BRIEF_COMMENTS=1 c-index-test -code-completion-at=%s:49:13 %s | FileCheck -check-prefix=CHECK-CC4 %s
65// CHECK-CC4: {TypedText Record}{{.*}}(brief comment: This is Record)
66
67// RUN: env CINDEXTEST_COMPLETION_BRIEF_COMMENTS=1 c-index-test -code-completion-at=%s:50:9 %s | FileCheck -check-prefix=CHECK-CC5 %s
68// CHECK-CC5: {TypedText setThisRecord:}{Placeholder (id)}{{.*}}(brief comment: This is Record)
69
70// RUN: env CINDEXTEST_COMPLETION_BRIEF_COMMENTS=1 c-index-test -code-completion-at=%s:51:12 %s | FileCheck -check-prefix=CHECK-CC6 %s
71// CHECK-CC6: {TypedText GetterInClassExtension}{{.*}}(brief comment: This is PropertyInClassExtension)
72
73@interface AnotherAppDelegate
74/**
75  \brief This is ReadonlyProperty
76*/
77@property (getter = ReadonlyGetter) int MyProperty;
78/**
79  \brief This is getter = ReadonlyGetter
80*/
81- (int) ReadonlyGetter;
82@end
83
84@implementation AnotherAppDelegate
85- (int) PropertyInPrimaryClass {
86self.ReadonlyGetter;
87}
88@end
89// RUN: env CINDEXTEST_COMPLETION_BRIEF_COMMENTS=1 c-index-test -code-completion-at=%s:86:6 %s | FileCheck -check-prefix=CHECK-CC7 %s
90// CHECK-CC7: {TypedText ReadonlyGetter}{{.*}}(brief comment: This is getter = ReadonlyGetter)
91
92