| 1 | struct Base1 { |
| 2 | Base1() : {} |
| 3 | // RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:2:12 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s |
| 4 | // RUN: %clang_cc1 -fsyntax-only -std=c++14 -code-completion-at=%s:2:12 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s |
| 5 | // CHECK-CC1: COMPLETION: Pattern : member1(<#int#>) |
| 6 | // CHECK-CC1: COMPLETION: Pattern : member2(<#float#>) |
| 7 | |
| 8 | Base1(int) : member1(123), {} |
| 9 | // RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:8:30 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s |
| 10 | // RUN: %clang_cc1 -fsyntax-only -std=c++14 -code-completion-at=%s:8:30 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s |
| 11 | // CHECK-CC2-NOT: COMPLETION: Pattern : member1(<#int#>) |
| 12 | // CHECK-CC2: COMPLETION: Pattern : member2(<#float#>) |
| 13 | |
| 14 | int member1; |
| 15 | float member2; |
| 16 | }; |
| 17 | |
| 18 | struct Derived : public Base1 { |
| 19 | Derived(); |
| 20 | Derived(int); |
| 21 | Derived(float); |
| 22 | int deriv1; |
| 23 | }; |
| 24 | |
| 25 | Derived::Derived() : {} |
| 26 | // RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:25:22 %s -o - | FileCheck -check-prefix=CHECK-CC3 %s |
| 27 | // RUN: %clang_cc1 -fsyntax-only -std=c++14 -code-completion-at=%s:25:22 %s -o - | FileCheck -check-prefix=CHECK-CC3 %s |
| 28 | // CHECK-CC3: COMPLETION: Pattern : Base1() |
| 29 | // CHECK-CC3: COMPLETION: Pattern : Base1(<#int#>) |
| 30 | // CHECK-CC3: COMPLETION: Pattern : deriv1(<#int#>) |
| 31 | |
| 32 | Derived::Derived(int) try : { |
| 33 | } catch (...) { |
| 34 | } |
| 35 | // RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:32:29 %s -o - | FileCheck -check-prefix=CHECK-CC3 %s |
| 36 | // RUN: %clang_cc1 -fsyntax-only -std=c++14 -code-completion-at=%s:32:29 %s -o - | FileCheck -check-prefix=CHECK-CC3 %s |
| 37 | |
| 38 | Derived::Derived(float) try : Base1(), |
| 39 | { |
| 40 | } catch (...) { |
| 41 | } |
| 42 | // RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:38:39 %s -o - | FileCheck -check-prefix=CHECK-CC5 %s |
| 43 | // RUN: %clang_cc1 -fsyntax-only -std=c++14 -code-completion-at=%s:38:39 %s -o - | FileCheck -check-prefix=CHECK-CC5 %s |
| 44 | // CHECK-CC5-NOT: COMPLETION: Pattern : Base1 |
| 45 | // CHECK-CC5: COMPLETION: Pattern : deriv1(<#int#>) |
| 46 | |
| 47 | struct A { |
| 48 | A() : , member2() {} |
| 49 | // RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:48:9 %s -o - | FileCheck -check-prefix=CHECK-CC6 %s |
| 50 | // RUN: %clang_cc1 -fsyntax-only -std=c++14 -code-completion-at=%s:48:9 %s -o - | FileCheck -check-prefix=CHECK-CC6 %s |
| 51 | // CHECK-CC6: COMPLETION: Pattern : member1(<#int#>) |
| 52 | int member1, member2; |
| 53 | }; |
| 54 | |
| 55 | struct B { |
| 56 | B() : member2() {} |
| 57 | // RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:56:9 %s -o - | FileCheck -check-prefix=CHECK-CC7 %s |
| 58 | // RUN: %clang_cc1 -fsyntax-only -std=c++14 -code-completion-at=%s:56:9 %s -o - | FileCheck -check-prefix=CHECK-CC7 %s |
| 59 | // CHECK-CC7: COMPLETION: Pattern : member1(<#int#>) |
| 60 | // Check in the middle and at the end of identifier too. |
| 61 | // RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:56:13 %s -o - | FileCheck -check-prefix=CHECK-CC8 %s |
| 62 | // RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:56:16 %s -o - | FileCheck -check-prefix=CHECK-CC8 %s |
| 63 | // CHECK-CC8: COMPLETION: Pattern : member2(<#int#>) |
| 64 | int member1, member2; |
| 65 | }; |
| 66 | |
| 67 | struct Base2 { |
| 68 | Base2(int); |
| 69 | }; |
| 70 | |
| 71 | struct Composition1 { |
| 72 | Composition1() : b2_elem(2) {} |
| 73 | // RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:72:28 %s -o - | FileCheck -check-prefix=CHECK-CC9 %s |
| 74 | // RUN: %clang_cc1 -fsyntax-only -std=c++14 -code-completion-at=%s:72:28 %s -o - | FileCheck -check-prefix=CHECK-CC9 %s |
| 75 | // CHECK-CC9: OVERLOAD: Base2(<#int#>) |
| 76 | // CHECK-CC9: OVERLOAD: Base2(<#const Base2 &#>) |
| 77 | // CHECK-CC9-NOT: OVERLOAD: Composition1 |
| 78 | Composition1(Base2); |
| 79 | Base2 b2_elem; |
| 80 | }; |
| 81 | |
| 82 | struct Composition2 { |
| 83 | Composition2() : c1_elem(Base2(1)) {} |
| 84 | // RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:83:34 %s -o - | FileCheck -check-prefix=CHECK-CC9 %s |
| 85 | // RUN: %clang_cc1 -fsyntax-only -std=c++14 -code-completion-at=%s:83:34 %s -o - | FileCheck -check-prefix=CHECK-CC9 %s |
| 86 | // RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:83:35 %s -o - | FileCheck -check-prefix=CHECK-CC9 %s |
| 87 | // RUN: %clang_cc1 -fsyntax-only -std=c++14 -code-completion-at=%s:83:35 %s -o - | FileCheck -check-prefix=CHECK-CC9 %s |
| 88 | Composition1 c1_elem; |
| 89 | }; |
| 90 | // RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:83:20 %s -o - | FileCheck -check-prefix=CHECK-CC10 %s |
| 91 | // RUN: %clang_cc1 -fsyntax-only -std=c++14 -code-completion-at=%s:83:20 %s -o - | FileCheck -check-prefix=CHECK-CC10 %s |
| 92 | // CHECK-CC10: Pattern : c1_elem() |
| 93 | // CHECK-CC10: Pattern : c1_elem(<#Base2#>) |
| 94 | |
| 95 | template <class T> |
| 96 | struct Y : T {}; |
| 97 | |
| 98 | template <class T> |
| 99 | struct X : Y<T> { |
| 100 | X() : Y<T>() {}; |
| 101 | }; |
| 102 | |
| 103 | // RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:100:9 %s -o - | FileCheck -check-prefix=CHECK-CC11 %s |
| 104 | // RUN: %clang_cc1 -fsyntax-only -std=c++14 -code-completion-at=%s:100:9 %s -o - | FileCheck -check-prefix=CHECK-CC11 %s |
| 105 | // CHECK-CC11: Pattern : Y<T>(<#Y<T>#>) |
| 106 | |