1*f4a2713aSLionel Sambuc struct X {
2*f4a2713aSLionel Sambuc int member1;
3*f4a2713aSLionel Sambuc void func1();
4*f4a2713aSLionel Sambuc protected:
5*f4a2713aSLionel Sambuc int member2;
6*f4a2713aSLionel Sambuc void func2();
7*f4a2713aSLionel Sambuc private:
8*f4a2713aSLionel Sambuc int member3;
9*f4a2713aSLionel Sambuc void func3();
10*f4a2713aSLionel Sambuc };
11*f4a2713aSLionel Sambuc
12*f4a2713aSLionel Sambuc struct Y: protected X {
13*f4a2713aSLionel Sambuc void doSomething();
14*f4a2713aSLionel Sambuc };
15*f4a2713aSLionel Sambuc
16*f4a2713aSLionel Sambuc class Z {
17*f4a2713aSLionel Sambuc public:
18*f4a2713aSLionel Sambuc int member1;
19*f4a2713aSLionel Sambuc void func1();
20*f4a2713aSLionel Sambuc protected:
21*f4a2713aSLionel Sambuc int member2;
22*f4a2713aSLionel Sambuc void func2();
23*f4a2713aSLionel Sambuc private:
24*f4a2713aSLionel Sambuc int member3;
25*f4a2713aSLionel Sambuc void func3();
26*f4a2713aSLionel Sambuc };
27*f4a2713aSLionel Sambuc
doSomething()28*f4a2713aSLionel Sambuc void Y::doSomething() {
29*f4a2713aSLionel Sambuc // RUN: c-index-test -code-completion-at=%s:30:9 %s | FileCheck -check-prefix=CHECK-SUPER-ACCESS %s
30*f4a2713aSLionel Sambuc this->;
31*f4a2713aSLionel Sambuc
32*f4a2713aSLionel Sambuc Z that;
33*f4a2713aSLionel Sambuc // RUN: c-index-test -code-completion-at=%s:34:8 %s | FileCheck -check-prefix=CHECK-ACCESS %s
34*f4a2713aSLionel Sambuc that.
35*f4a2713aSLionel Sambuc }
36*f4a2713aSLionel Sambuc
37*f4a2713aSLionel Sambuc // CHECK-SUPER-ACCESS: CXXMethod:{ResultType void}{TypedText doSomething}{LeftParen (}{RightParen )} (34)
38*f4a2713aSLionel Sambuc // CHECK-SUPER-ACCESS: CXXMethod:{ResultType void}{Informative X::}{TypedText func1}{LeftParen (}{RightParen )} (36)
39*f4a2713aSLionel Sambuc // CHECK-SUPER-ACCESS: CXXMethod:{ResultType void}{Informative X::}{TypedText func2}{LeftParen (}{RightParen )} (36) (inaccessible)
40*f4a2713aSLionel Sambuc // CHECK-SUPER-ACCESS: CXXMethod:{ResultType void}{Informative X::}{TypedText func3}{LeftParen (}{RightParen )} (36) (inaccessible)
41*f4a2713aSLionel Sambuc // CHECK-SUPER-ACCESS: FieldDecl:{ResultType int}{Informative X::}{TypedText member1} (37)
42*f4a2713aSLionel Sambuc // CHECK-SUPER-ACCESS: FieldDecl:{ResultType int}{Informative X::}{TypedText member2} (37) (inaccessible)
43*f4a2713aSLionel Sambuc // CHECK-SUPER-ACCESS: FieldDecl:{ResultType int}{Informative X::}{TypedText member3} (37) (inaccessible)
44*f4a2713aSLionel Sambuc // CHECK-SUPER-ACCESS: CXXMethod:{ResultType Y &}{TypedText operator=}{LeftParen (}{Placeholder const Y &}{RightParen )} (34)
45*f4a2713aSLionel Sambuc // CHECK-SUPER-ACCESS: CXXMethod:{ResultType X &}{Text X::}{TypedText operator=}{LeftParen (}{Placeholder const X &}{RightParen )} (36)
46*f4a2713aSLionel Sambuc // CHECK-SUPER-ACCESS: StructDecl:{TypedText X}{Text ::} (77)
47*f4a2713aSLionel Sambuc // CHECK-SUPER-ACCESS: StructDecl:{TypedText Y}{Text ::} (75)
48*f4a2713aSLionel Sambuc // CHECK-SUPER-ACCESS: CXXDestructor:{ResultType void}{Informative X::}{TypedText ~X}{LeftParen (}{RightParen )} (36)
49*f4a2713aSLionel Sambuc // CHECK-SUPER-ACCESS: CXXDestructor:{ResultType void}{TypedText ~Y}{LeftParen (}{RightParen )} (34)
50*f4a2713aSLionel Sambuc
51*f4a2713aSLionel Sambuc // CHECK-ACCESS: CXXMethod:{ResultType void}{TypedText func1}{LeftParen (}{RightParen )} (34)
52*f4a2713aSLionel Sambuc // CHECK-ACCESS: CXXMethod:{ResultType void}{TypedText func2}{LeftParen (}{RightParen )} (34) (inaccessible)
53*f4a2713aSLionel Sambuc // CHECK-ACCESS: CXXMethod:{ResultType void}{TypedText func3}{LeftParen (}{RightParen )} (34) (inaccessible)
54*f4a2713aSLionel Sambuc // CHECK-ACCESS: FieldDecl:{ResultType int}{TypedText member1} (35)
55*f4a2713aSLionel Sambuc // CHECK-ACCESS: FieldDecl:{ResultType int}{TypedText member2} (35) (inaccessible)
56*f4a2713aSLionel Sambuc // CHECK-ACCESS: FieldDecl:{ResultType int}{TypedText member3} (35) (inaccessible)
57*f4a2713aSLionel Sambuc // CHECK-ACCESS: CXXMethod:{ResultType Z &}{TypedText operator=}{LeftParen (}{Placeholder const Z &}{RightParen )} (34)
58*f4a2713aSLionel Sambuc // CHECK-ACCESS: ClassDecl:{TypedText Z}{Text ::} (75)
59*f4a2713aSLionel Sambuc // CHECK-ACCESS: CXXDestructor:{ResultType void}{TypedText ~Z}{LeftParen (}{RightParen )} (34)
60*f4a2713aSLionel Sambuc
61*f4a2713aSLionel Sambuc class P {
62*f4a2713aSLionel Sambuc protected:
63*f4a2713aSLionel Sambuc int member;
64*f4a2713aSLionel Sambuc };
65*f4a2713aSLionel Sambuc
66*f4a2713aSLionel Sambuc class Q : public P {
67*f4a2713aSLionel Sambuc public:
68*f4a2713aSLionel Sambuc using P::member;
69*f4a2713aSLionel Sambuc };
70*f4a2713aSLionel Sambuc
f(P x,Q y)71*f4a2713aSLionel Sambuc void f(P x, Q y) {
72*f4a2713aSLionel Sambuc // RUN: c-index-test -code-completion-at=%s:73:5 %s | FileCheck -check-prefix=CHECK-USING-INACCESSIBLE %s
73*f4a2713aSLionel Sambuc x.; // member is inaccessible
74*f4a2713aSLionel Sambuc // RUN: c-index-test -code-completion-at=%s:75:5 %s | FileCheck -check-prefix=CHECK-USING-ACCESSIBLE %s
75*f4a2713aSLionel Sambuc y.; // member is accessible
76*f4a2713aSLionel Sambuc }
77*f4a2713aSLionel Sambuc
78*f4a2713aSLionel Sambuc // CHECK-USING-INACCESSIBLE: FieldDecl:{ResultType int}{TypedText member} (35) (inaccessible)
79*f4a2713aSLionel Sambuc // CHECK-USING-INACCESSIBLE: CXXMethod:{ResultType P &}{TypedText operator=}{LeftParen (}{Placeholder const P &}{RightParen )} (34)
80*f4a2713aSLionel Sambuc // CHECK-USING-INACCESSIBLE: ClassDecl:{TypedText P}{Text ::} (75)
81*f4a2713aSLionel Sambuc // CHECK-USING-INACCESSIBLE: CXXDestructor:{ResultType void}{TypedText ~P}{LeftParen (}{RightParen )} (34)
82*f4a2713aSLionel Sambuc
83*f4a2713aSLionel Sambuc // CHECK-USING-ACCESSIBLE: FieldDecl:{ResultType int}{TypedText member} (35)
84*f4a2713aSLionel Sambuc // CHECK-USING-ACCESSIBLE: CXXMethod:{ResultType Q &}{TypedText operator=}{LeftParen (}{Placeholder const Q &}{RightParen )} (34)
85*f4a2713aSLionel Sambuc // CHECK-USING-ACCESSIBLE: CXXMethod:{ResultType P &}{Text P::}{TypedText operator=}{LeftParen (}{Placeholder const P &}{RightParen )} (36)
86*f4a2713aSLionel Sambuc // CHECK-USING-ACCESSIBLE: ClassDecl:{TypedText P}{Text ::} (77)
87*f4a2713aSLionel Sambuc // CHECK-USING-ACCESSIBLE: ClassDecl:{TypedText Q}{Text ::} (75)
88*f4a2713aSLionel Sambuc // CHECK-USING-ACCESSIBLE: CXXDestructor:{ResultType void}{Informative P::}{TypedText ~P}{LeftParen (}{RightParen )} (36)
89*f4a2713aSLionel Sambuc // CHECK-USING-ACCESSIBLE: CXXDestructor:{ResultType void}{TypedText ~Q}{LeftParen (}{RightParen )} (34)
90