Home | History | Annotate | Download | only in Index
      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   Z that;
     33   // RUN: c-index-test -code-completion-at=%s:34:8 %s | FileCheck -check-prefix=CHECK-ACCESS %s
     34   that.
     35 }
     36 
     37 // CHECK-SUPER-ACCESS: CXXMethod:{ResultType void}{TypedText doSomething}{LeftParen (}{RightParen )} (34)
     38 // CHECK-SUPER-ACCESS: CXXMethod:{ResultType void}{Informative X::}{TypedText func1}{LeftParen (}{RightParen )} (36)
     39 // CHECK-SUPER-ACCESS: CXXMethod:{ResultType void}{Informative X::}{TypedText func2}{LeftParen (}{RightParen )} (36) (inaccessible)
     40 // CHECK-SUPER-ACCESS: CXXMethod:{ResultType void}{Informative X::}{TypedText func3}{LeftParen (}{RightParen )} (36) (inaccessible)
     41 // CHECK-SUPER-ACCESS: FieldDecl:{ResultType int}{Informative X::}{TypedText member1} (37)
     42 // CHECK-SUPER-ACCESS: FieldDecl:{ResultType int}{Informative X::}{TypedText member2} (37) (inaccessible)
     43 // CHECK-SUPER-ACCESS: FieldDecl:{ResultType int}{Informative X::}{TypedText member3} (37) (inaccessible)
     44 // CHECK-SUPER-ACCESS: CXXMethod:{ResultType Y &}{TypedText operator=}{LeftParen (}{Placeholder const Y &}{RightParen )} (34)
     45 // CHECK-SUPER-ACCESS: CXXMethod:{ResultType X &}{Text X::}{TypedText operator=}{LeftParen (}{Placeholder const X &}{RightParen )} (36)
     46 // CHECK-SUPER-ACCESS: StructDecl:{TypedText X}{Text ::} (77)
     47 // CHECK-SUPER-ACCESS: StructDecl:{TypedText Y}{Text ::} (75)
     48 // CHECK-SUPER-ACCESS: CXXDestructor:{ResultType void}{Informative X::}{TypedText ~X}{LeftParen (}{RightParen )} (36)
     49 // CHECK-SUPER-ACCESS: CXXDestructor:{ResultType void}{TypedText ~Y}{LeftParen (}{RightParen )} (34)
     50 
     51 // CHECK-ACCESS: CXXMethod:{ResultType void}{TypedText func1}{LeftParen (}{RightParen )} (34)
     52 // CHECK-ACCESS: CXXMethod:{ResultType void}{TypedText func2}{LeftParen (}{RightParen )} (34) (inaccessible)
     53 // CHECK-ACCESS: CXXMethod:{ResultType void}{TypedText func3}{LeftParen (}{RightParen )} (34) (inaccessible)
     54 // CHECK-ACCESS: FieldDecl:{ResultType int}{TypedText member1} (35)
     55 // CHECK-ACCESS: FieldDecl:{ResultType int}{TypedText member2} (35) (inaccessible)
     56 // CHECK-ACCESS: FieldDecl:{ResultType int}{TypedText member3} (35) (inaccessible)
     57 // CHECK-ACCESS: CXXMethod:{ResultType Z &}{TypedText operator=}{LeftParen (}{Placeholder const Z &}{RightParen )} (34)
     58 // CHECK-ACCESS: ClassDecl:{TypedText Z}{Text ::} (75)
     59 // CHECK-ACCESS: CXXDestructor:{ResultType void}{TypedText ~Z}{LeftParen (}{RightParen )} (34)
     60 
     61 class P {
     62 protected:
     63   int member;
     64 };
     65 
     66 class Q : public P {
     67 public:
     68   using P::member;
     69 };
     70 
     71 void f(P x, Q y) {
     72   // RUN: c-index-test -code-completion-at=%s:73:5 %s | FileCheck -check-prefix=CHECK-USING-INACCESSIBLE %s
     73   x.; // member is inaccessible
     74   // RUN: c-index-test -code-completion-at=%s:75:5 %s | FileCheck -check-prefix=CHECK-USING-ACCESSIBLE %s
     75   y.; // member is accessible
     76 }
     77 
     78 // CHECK-USING-INACCESSIBLE: FieldDecl:{ResultType int}{TypedText member} (35) (inaccessible)
     79 // CHECK-USING-INACCESSIBLE: CXXMethod:{ResultType P &}{TypedText operator=}{LeftParen (}{Placeholder const P &}{RightParen )} (34)
     80 // CHECK-USING-INACCESSIBLE: ClassDecl:{TypedText P}{Text ::} (75)
     81 // CHECK-USING-INACCESSIBLE: CXXDestructor:{ResultType void}{TypedText ~P}{LeftParen (}{RightParen )} (34)
     82 
     83 // CHECK-USING-ACCESSIBLE: FieldDecl:{ResultType int}{TypedText member} (35)
     84 // CHECK-USING-ACCESSIBLE: CXXMethod:{ResultType Q &}{TypedText operator=}{LeftParen (}{Placeholder const Q &}{RightParen )} (34)
     85 // CHECK-USING-ACCESSIBLE: CXXMethod:{ResultType P &}{Text P::}{TypedText operator=}{LeftParen (}{Placeholder const P &}{RightParen )} (36)
     86 // CHECK-USING-ACCESSIBLE: ClassDecl:{TypedText P}{Text ::} (77)
     87 // CHECK-USING-ACCESSIBLE: ClassDecl:{TypedText Q}{Text ::} (75)
     88 // CHECK-USING-ACCESSIBLE: CXXDestructor:{ResultType void}{Informative P::}{TypedText ~P}{LeftParen (}{RightParen )} (36)
     89 // CHECK-USING-ACCESSIBLE: CXXDestructor:{ResultType void}{TypedText ~Q}{LeftParen (}{RightParen )} (34)
     90