| 1 |
struct X { |
| 2 |
int member1; |
| 3 |
void func1(); |
| 4 |
protected: |
| 5 |
int member2; |
| 6 |
void func2(); |
| 7 |
private: |
| 8 |
int member3; |
| 9 |
void func3(); |
| 10 |
}; |
| 11 |
|
| 12 |
struct Y: protected X { |
| 13 |
void doSomething(); |
| 14 |
}; |
| 15 |
|
| 16 |
class Z { |
| 17 |
public: |
| 18 |
int member1; |
| 19 |
void func1(); |
| 20 |
protected: |
| 21 |
int member2; |
| 22 |
void func2(); |
| 23 |
private: |
| 24 |
int member3; |
| 25 |
void func3(); |
| 26 |
}; |
| 27 |
|
| 28 |
void Y::doSomething() { |
| 29 |
// RUN: c-index-test -code-completion-at=%s:30:9 %s | FileCheck -check-prefix=CHECK-SUPER-ACCESS %s |
| 30 |
this->; |
| 31 |
|
| 32 |
// RUN: c-index-test -code-completion-at=%s:33:3 %s | FileCheck -check-prefix=CHECK-SUPER-ACCESS-IMPLICIT %s |
| 33 |
|
| 34 |
|
| 35 |
Z that; |
| 36 |
// RUN: c-index-test -code-completion-at=%s:37:8 %s | FileCheck -check-prefix=CHECK-ACCESS %s |
| 37 |
that. |
| 38 |
} |
| 39 |
|
| 40 |
// CHECK-SUPER-ACCESS: CXXMethod:{ResultType void}{TypedText doSomething}{LeftParen (}{RightParen )} (34) |
| 41 |
// CHECK-SUPER-ACCESS: CXXMethod:{ResultType void}{Informative X::}{TypedText func1}{LeftParen (}{RightParen )} (36) |
| 42 |
// CHECK-SUPER-ACCESS: CXXMethod:{ResultType void}{Informative X::}{TypedText func2}{LeftParen (}{RightParen )} (36){{$}} |
| 43 |
// CHECK-SUPER-ACCESS: CXXMethod:{ResultType void}{Informative X::}{TypedText func3}{LeftParen (}{RightParen )} (36) (inaccessible) |
| 44 |
// CHECK-SUPER-ACCESS: FieldDecl:{ResultType int}{Informative X::}{TypedText member1} (37) |
| 45 |
// CHECK-SUPER-ACCESS: FieldDecl:{ResultType int}{Informative X::}{TypedText member2} (37){{$}} |
| 46 |
// CHECK-SUPER-ACCESS: FieldDecl:{ResultType int}{Informative X::}{TypedText member3} (37) (inaccessible) |
| 47 |
// CHECK-SUPER-ACCESS: CXXMethod:{ResultType Y &}{TypedText operator=}{LeftParen (}{Placeholder const Y &}{RightParen )} (79) |
| 48 |
// CHECK-SUPER-ACCESS: CXXMethod:{ResultType X &}{Text X::}{TypedText operator=}{LeftParen (}{Placeholder const X &}{RightParen )} (81) |
| 49 |
// CHECK-SUPER-ACCESS: StructDecl:{TypedText X}{Text ::} (77) |
| 50 |
// CHECK-SUPER-ACCESS: StructDecl:{TypedText Y}{Text ::} (75) |
| 51 |
// CHECK-SUPER-ACCESS: CXXDestructor:{ResultType void}{Informative X::}{TypedText ~X}{LeftParen (}{RightParen )} (81) |
| 52 |
// CHECK-SUPER-ACCESS: CXXDestructor:{ResultType void}{TypedText ~Y}{LeftParen (}{RightParen )} (79) |
| 53 |
|
| 54 |
// CHECK-SUPER-ACCESS-IMPLICIT: CXXMethod:{ResultType void}{TypedText doSomething}{LeftParen (}{RightParen )} (34) |
| 55 |
// CHECK-SUPER-ACCESS-IMPLICIT: CXXMethod:{ResultType void}{TypedText func1}{LeftParen (}{RightParen )} (36) |
| 56 |
// CHECK-SUPER-ACCESS-IMPLICIT: CXXMethod:{ResultType void}{TypedText func2}{LeftParen (}{RightParen )} (36){{$}} |
| 57 |
// CHECK-SUPER-ACCESS-IMPLICIT: CXXMethod:{ResultType void}{TypedText func3}{LeftParen (}{RightParen )} (36) (inaccessible) |
| 58 |
// CHECK-SUPER-ACCESS-IMPLICIT: FieldDecl:{ResultType int}{TypedText member1} (37) |
| 59 |
// CHECK-SUPER-ACCESS-IMPLICIT: FieldDecl:{ResultType int}{TypedText member2} (37){{$}} |
| 60 |
// CHECK-SUPER-ACCESS-IMPLICIT: FieldDecl:{ResultType int}{TypedText member3} (37) (inaccessible) |
| 61 |
|
| 62 |
// CHECK-ACCESS: CXXMethod:{ResultType void}{TypedText func1}{LeftParen (}{RightParen )} (34) |
| 63 |
// CHECK-ACCESS: CXXMethod:{ResultType void}{TypedText func2}{LeftParen (}{RightParen )} (34) (inaccessible) |
| 64 |
// CHECK-ACCESS: CXXMethod:{ResultType void}{TypedText func3}{LeftParen (}{RightParen )} (34) (inaccessible) |
| 65 |
// CHECK-ACCESS: FieldDecl:{ResultType int}{TypedText member1} (35) |
| 66 |
// CHECK-ACCESS: FieldDecl:{ResultType int}{TypedText member2} (35) (inaccessible) |
| 67 |
// CHECK-ACCESS: FieldDecl:{ResultType int}{TypedText member3} (35) (inaccessible) |
| 68 |
// CHECK-ACCESS: CXXMethod:{ResultType Z &}{TypedText operator=}{LeftParen (}{Placeholder const Z &}{RightParen )} (79) |
| 69 |
// CHECK-ACCESS: ClassDecl:{TypedText Z}{Text ::} (75) |
| 70 |
// CHECK-ACCESS: CXXDestructor:{ResultType void}{TypedText ~Z}{LeftParen (}{RightParen )} (79) |
| 71 |
|
| 72 |
class P { |
| 73 |
protected: |
| 74 |
int member; |
| 75 |
}; |
| 76 |
|
| 77 |
class Q : public P { |
| 78 |
public: |
| 79 |
using P::member; |
| 80 |
}; |
| 81 |
|
| 82 |
void f(P x, Q y) { |
| 83 |
// RUN: c-index-test -code-completion-at=%s:84:5 %s | FileCheck -check-prefix=CHECK-USING-INACCESSIBLE %s |
| 84 |
x.; // member is inaccessible |
| 85 |
// RUN: c-index-test -code-completion-at=%s:86:5 %s | FileCheck -check-prefix=CHECK-USING-ACCESSIBLE %s |
| 86 |
y.; // member is accessible |
| 87 |
} |
| 88 |
|
| 89 |
// CHECK-USING-INACCESSIBLE: FieldDecl:{ResultType int}{TypedText member} (35) (inaccessible) |
| 90 |
// CHECK-USING-INACCESSIBLE: CXXMethod:{ResultType P &}{TypedText operator=}{LeftParen (}{Placeholder const P &}{RightParen )} (79) |
| 91 |
// CHECK-USING-INACCESSIBLE: ClassDecl:{TypedText P}{Text ::} (75) |
| 92 |
// CHECK-USING-INACCESSIBLE: CXXDestructor:{ResultType void}{TypedText ~P}{LeftParen (}{RightParen )} (79) |
| 93 |
|
| 94 |
// CHECK-USING-ACCESSIBLE: FieldDecl:{ResultType int}{TypedText member} (35) |
| 95 |
// CHECK-USING-ACCESSIBLE: CXXMethod:{ResultType Q &}{TypedText operator=}{LeftParen (}{Placeholder const Q &}{RightParen )} (79) |
| 96 |
// CHECK-USING-ACCESSIBLE: CXXMethod:{ResultType P &}{Text P::}{TypedText operator=}{LeftParen (}{Placeholder const P &}{RightParen )} (81) |
| 97 |
// CHECK-USING-ACCESSIBLE: ClassDecl:{TypedText P}{Text ::} (77) |
| 98 |
// CHECK-USING-ACCESSIBLE: ClassDecl:{TypedText Q}{Text ::} (75) |
| 99 |
// CHECK-USING-ACCESSIBLE: CXXDestructor:{ResultType void}{Informative P::}{TypedText ~P}{LeftParen (}{RightParen )} (81) |
| 100 |
// CHECK-USING-ACCESSIBLE: CXXDestructor:{ResultType void}{TypedText ~Q}{LeftParen (}{RightParen )} (79) |
| 101 |
|
| 102 |
class B { |
| 103 |
protected: |
| 104 |
int member; |
| 105 |
}; |
| 106 |
|
| 107 |
class C : private B {}; |
| 108 |
|
| 109 |
|
| 110 |
class D : public C { |
| 111 |
public: |
| 112 |
void f(::B *b); |
| 113 |
}; |
| 114 |
|
| 115 |
void D::f(::B *that) { |
| 116 |
// RUN: c-index-test -code-completion-at=%s:117:9 %s | FileCheck -check-prefix=CHECK-PRIVATE-SUPER-THIS %s |
| 117 |
this->; |
| 118 |
// CHECK-PRIVATE-SUPER-THIS: FieldDecl:{ResultType int}{Informative B::}{TypedText member} (37) (inaccessible) |
| 119 |
|
| 120 |
// RUN: c-index-test -code-completion-at=%s:121:9 %s | FileCheck -check-prefix=CHECK-PRIVATE-SUPER-THAT %s |
| 121 |
that->; |
| 122 |
// CHECK-PRIVATE-SUPER-THAT: FieldDecl:{ResultType int}{TypedText member} (35) (inaccessible) |
| 123 |
} |