xref: /minix3/external/bsd/llvm/dist/clang/test/Index/complete-memfunc-cvquals.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // The run lines are below, because this test is line- and
2*f4a2713aSLionel Sambuc // column-number sensitive.
3*f4a2713aSLionel Sambuc struct Foo {
4*f4a2713aSLionel Sambuc   void babble() const volatile;
5*f4a2713aSLionel Sambuc   void bar();
6*f4a2713aSLionel Sambuc   void baz() const;
7*f4a2713aSLionel Sambuc   void bingo() volatile;
8*f4a2713aSLionel Sambuc   void theend() const volatile;
9*f4a2713aSLionel Sambuc };
10*f4a2713aSLionel Sambuc 
11*f4a2713aSLionel Sambuc template<typename T>
12*f4a2713aSLionel Sambuc struct smart_ptr {
13*f4a2713aSLionel Sambuc   T *operator->();
14*f4a2713aSLionel Sambuc   const T* operator->() const;
15*f4a2713aSLionel Sambuc };
16*f4a2713aSLionel Sambuc 
text(Foo f,Foo * fp,const Foo & fc,const Foo * fcp,smart_ptr<Foo> sf,const smart_ptr<Foo> & sfc,Foo volatile * fvp)17*f4a2713aSLionel Sambuc void text(Foo f, Foo *fp, const Foo &fc, const Foo *fcp,
18*f4a2713aSLionel Sambuc           smart_ptr<Foo> sf, const smart_ptr<Foo> &sfc, Foo volatile *fvp) {
19*f4a2713aSLionel Sambuc   f.bar();
20*f4a2713aSLionel Sambuc   fp->bar();
21*f4a2713aSLionel Sambuc   fc.baz();
22*f4a2713aSLionel Sambuc   fcp->baz();
23*f4a2713aSLionel Sambuc   sf->bar();
24*f4a2713aSLionel Sambuc   sfc->baz();
25*f4a2713aSLionel Sambuc   fvp->babble();
26*f4a2713aSLionel Sambuc }
27*f4a2713aSLionel Sambuc 
bar()28*f4a2713aSLionel Sambuc void Foo::bar() {
29*f4a2713aSLionel Sambuc 
30*f4a2713aSLionel Sambuc }
31*f4a2713aSLionel Sambuc 
baz() const32*f4a2713aSLionel Sambuc void Foo::baz() const {
33*f4a2713aSLionel Sambuc 
34*f4a2713aSLionel Sambuc }
35*f4a2713aSLionel Sambuc 
bingo()36*f4a2713aSLionel Sambuc void Foo::bingo() volatile {
37*f4a2713aSLionel Sambuc 
38*f4a2713aSLionel Sambuc }
39*f4a2713aSLionel Sambuc 
40*f4a2713aSLionel Sambuc // Check member access expressions.
41*f4a2713aSLionel Sambuc // RUN: c-index-test -code-completion-at=%s:19:5 %s | FileCheck -check-prefix=CHECK-NOQUALS %s
42*f4a2713aSLionel Sambuc // RUN: c-index-test -code-completion-at=%s:20:7 %s | FileCheck -check-prefix=CHECK-NOQUALS %s
43*f4a2713aSLionel Sambuc // RUN: c-index-test -code-completion-at=%s:23:7 %s | FileCheck -check-prefix=CHECK-NOQUALS %s
44*f4a2713aSLionel Sambuc // CHECK-NOQUALS: CXXMethod:{ResultType void}{TypedText babble}{LeftParen (}{RightParen )}{Informative  const volatile} (35)
45*f4a2713aSLionel Sambuc // CHECK-NOQUALS: CXXMethod:{ResultType void}{TypedText bar}{LeftParen (}{RightParen )} (34)
46*f4a2713aSLionel Sambuc // CHECK-NOQUALS: CXXMethod:{ResultType void}{TypedText baz}{LeftParen (}{RightParen )}{Informative  const} (35)
47*f4a2713aSLionel Sambuc // CHECK-NOQUALS: CXXMethod:{ResultType void}{TypedText bingo}{LeftParen (}{RightParen )}{Informative  volatile} (35)
48*f4a2713aSLionel Sambuc // RUN: c-index-test -code-completion-at=%s:21:6 %s | FileCheck -check-prefix=CHECK-CONST %s
49*f4a2713aSLionel Sambuc // RUN: c-index-test -code-completion-at=%s:22:8 %s | FileCheck -check-prefix=CHECK-CONST %s
50*f4a2713aSLionel Sambuc // RUN: c-index-test -code-completion-at=%s:24:8 %s | FileCheck -check-prefix=CHECK-CONST %s
51*f4a2713aSLionel Sambuc // CHECK-CONST: CXXMethod:{ResultType void}{TypedText babble}{LeftParen (}{RightParen )}{Informative  const volatile} (35)
52*f4a2713aSLionel Sambuc // CHECK-CONST-NOT: bar
53*f4a2713aSLionel Sambuc // CHECK-CONST: CXXMethod:{ResultType void}{TypedText baz}{LeftParen (}{RightParen )}{Informative  const} (34)
54*f4a2713aSLionel Sambuc // CHECK-CONST-NOT: bingo
55*f4a2713aSLionel Sambuc // CHECK-CONST: theend
56*f4a2713aSLionel Sambuc // RUN: c-index-test -code-completion-at=%s:25:8 %s | FileCheck -check-prefix=CHECK-VOLATILE %s
57*f4a2713aSLionel Sambuc // CHECK-VOLATILE: CXXMethod:{ResultType void}{TypedText babble}{LeftParen (}{RightParen )}{Informative  const volatile} (35)
58*f4a2713aSLionel Sambuc // CHECK-VOLATILE-NOT: baz
59*f4a2713aSLionel Sambuc // CHECK-VOLATILE: CXXMethod:{ResultType void}{TypedText bingo}{LeftParen (}{RightParen )}{Informative  volatile} (34)
60*f4a2713aSLionel Sambuc 
61*f4a2713aSLionel Sambuc // Check implicit member access expressions.
62*f4a2713aSLionel Sambuc // RUN: c-index-test -code-completion-at=%s:29:2 %s | FileCheck -check-prefix=CHECK-IMPLICIT-NOQUALS %s
63*f4a2713aSLionel Sambuc // CHECK-IMPLICIT-NOQUALS: CXXMethod:{ResultType void}{TypedText babble}{LeftParen (}{RightParen )}{Informative  const volatile} (35)
64*f4a2713aSLionel Sambuc // CHECK-IMPLICIT-NOQUALS: CXXMethod:{ResultType void}{TypedText bar}{LeftParen (}{RightParen )} (34)
65*f4a2713aSLionel Sambuc // CHECK-IMPLICIT-NOQUALS: CXXMethod:{ResultType void}{TypedText baz}{LeftParen (}{RightParen )}{Informative  const} (35)
66*f4a2713aSLionel Sambuc // CHECK-IMPLICIT-NOQUALS: CXXMethod:{ResultType void}{TypedText bingo}{LeftParen (}{RightParen )}{Informative  volatile} (35)
67*f4a2713aSLionel Sambuc 
68*f4a2713aSLionel Sambuc // RUN: c-index-test -code-completion-at=%s:33:1 %s | FileCheck -check-prefix=CHECK-IMPLICIT-CONST %s
69*f4a2713aSLionel Sambuc // CHECK-IMPLICIT-CONST: CXXMethod:{ResultType void}{TypedText babble}{LeftParen (}{RightParen )}{Informative  const volatile} (35)
70*f4a2713aSLionel Sambuc // CHECK-IMPLICIT-CONST-NOT: bar
71*f4a2713aSLionel Sambuc // CHECK-IMPLICIT-CONST: CXXMethod:{ResultType void}{TypedText baz}{LeftParen (}{RightParen )}{Informative  const} (34)
72*f4a2713aSLionel Sambuc // CHECK-IMPLICIT-CONST-NOT: bingo
73*f4a2713aSLionel Sambuc // CHECK-IMPLICIT-CONST: theend
74*f4a2713aSLionel Sambuc 
75*f4a2713aSLionel Sambuc // RUN: c-index-test -code-completion-at=%s:37:1 %s | FileCheck -check-prefix=CHECK-IMPLICIT-VOLATILE %s
76*f4a2713aSLionel Sambuc // CHECK-IMPLICIT-VOLATILE: CXXMethod:{ResultType void}{TypedText babble}{LeftParen (}{RightParen )}{Informative  const volatile} (35)
77*f4a2713aSLionel Sambuc // CHECK-IMPLICIT-VOLATILE-NOT: baz
78*f4a2713aSLionel Sambuc // CHECK-IMPLICIT-VOLATILE: CXXMethod:{ResultType void}{TypedText bingo}{LeftParen (}{RightParen )}{Informative  volatile} (34)
79*f4a2713aSLionel Sambuc 
80*f4a2713aSLionel Sambuc // RUN: c-index-test -code-completion-at=%s:4:17 %s | FileCheck -check-prefix=CHECK-CVQUAL-AFTER %s
81*f4a2713aSLionel Sambuc // CHECK-CVQUAL-AFTER: NotImplemented:{TypedText const} (40)
82*f4a2713aSLionel Sambuc // CHECK-CVQUAL-AFTER: NotImplemented:{TypedText volatile} (40)
83*f4a2713aSLionel Sambuc 
84*f4a2713aSLionel Sambuc // RUN: c-index-test -code-completion-at=%s:4:23 %s | FileCheck -check-prefix=CHECK-CVQUAL-AFTER2 %s
85*f4a2713aSLionel Sambuc // CHECK-CVQUAL-AFTER2-NOT: NotImplemented:{TypedText const} (40)
86*f4a2713aSLionel Sambuc // CHECK-CVQUAL-AFTER2: NotImplemented:{TypedText volatile} (40)
87