Douglas Gregor | 01dfea0 | 2010-01-10 23:08:15 +0000 | [diff] [blame^] | 1 | struct X { int x; }; |
| 2 | void z(int); |
| 3 | typedef struct t TYPEDEF; |
| 4 | |
| 5 | void foo() { |
| 6 | int y = 17; |
| 7 | // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:6:14 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s |
| 8 | // CHECK-CC1: COMPLETION: y : 0 : [#int#]y |
| 9 | // CHECK-CC1-NEXT: COMPLETION: foo : 2 : [#void#]foo() |
| 10 | // CHECK-CC1-NEXT: COMPLETION: t : 2 : t |
| 11 | // CHECK-CC1-NEXT: COMPLETION: TYPEDEF : 2 : TYPEDEF |
| 12 | // CHECK-CC1-NEXT: COMPLETION: X : 2 : X |
| 13 | // CHECK-CC1-NOT: x |
| 14 | // CHECK-CC1-NEXT: COMPLETION: z : 2 : [#void#]z(<#int#>) |
| 15 | // CHECK-CC1-NEXT: COMPLETION: bool : 3 |
| 16 | // CHECK-CC1-NEXT: COMPLETION: char : 3 |
| 17 | // CHECK-CC1-NEXT: COMPLETION: class : 3 |
| 18 | // CHECK-CC1-NEXT: COMPLETION: const : 3 |
| 19 | // CHECK-CC1-NEXT: COMPLETION: Pattern : 3 : const_cast<<#type-id#>>(<#expression#>) |
| 20 | // CHECK-CC1-NEXT: COMPLETION: Pattern : 3 : delete <#expression#> |
| 21 | // CHECK-CC1-NEXT: COMPLETION: Pattern : 3 : delete[] <#expression#> |
| 22 | // CHECK-CC1-NEXT: COMPLETION: Pattern : 3 : do{<#statements#> |
| 23 | // CHECK-CC1: COMPLETION: double : 3 |
| 24 | // CHECK-CC1-NEXT: COMPLETION: Pattern : 3 : dynamic_cast<<#type-id#>>(<#expression#>) |
| 25 | // CHECK-CC1-NEXT: COMPLETION: enum : 3 |
| 26 | // CHECK-CC1-NEXT: COMPLETION: extern : 3 |
| 27 | // CHECK-CC1-NEXT: COMPLETION: false : 3 |
| 28 | // CHECK-CC1-NEXT: COMPLETION: float : 3 |
| 29 | // CHECK-CC1-NEXT: COMPLETION: Pattern : 3 : for(<#init-statement#>;<#condition#>;<#inc-expression#>){<#statements#> |
| 30 | // CHECK-CC1: COMPLETION: Pattern : 3 : goto <#identifier#>; |
| 31 | // CHECK-CC1-NEXT: COMPLETION: Pattern : 3 : if(<#condition#>){<#statements#> |
| 32 | // CHECK-CC1: COMPLETION: int : 3 |
| 33 | // CHECK-CC1-NEXT: COMPLETION: long : 3 |
| 34 | // CHECK-CC1-NEXT: COMPLETION: Pattern : 3 : new <#type-id#>(<#expressions#>) |
| 35 | // CHECK-CC1-NEXT: COMPLETION: Pattern : 3 : new <#type-id#>[<#size#>](<#expressions#>) |
| 36 | // CHECK-CC1-NEXT: COMPLETION: operator : 3 |
| 37 | // CHECK-CC1-NEXT: COMPLETION: Pattern : 3 : reinterpret_cast<<#type-id#>>(<#expression#>) |
| 38 | // CHECK-CC1-NEXT: COMPLETION: Pattern : 3 : return; |
| 39 | // CHECK-CC1-NEXT: COMPLETION: short : 3 |
| 40 | // CHECK-CC1-NEXT: COMPLETION: signed : 3 |
| 41 | // CHECK-CC1-NEXT: COMPLETION: Pattern : 3 : sizeof(<#expression-or-type#>) |
| 42 | // CHECK-CC1-NEXT: COMPLETION: static : 3 |
| 43 | // CHECK-CC1-NEXT: COMPLETION: Pattern : 3 : static_cast<<#type-id#>>(<#expression#>) |
| 44 | // CHECK-CC1-NEXT: COMPLETION: struct : 3 |
| 45 | // CHECK-CC1-NEXT: COMPLETION: Pattern : 3 : switch(<#condition#>){ |
| 46 | // CHECK-CC1: COMPLETION: Pattern : 3 : throw <#expression#> |
| 47 | // CHECK-CC1-NEXT: COMPLETION: true : 3 |
| 48 | // CHECK-CC1-NEXT: COMPLETION: Pattern : 3 : try{<#statements#> |
| 49 | // CHECK-CC1: COMPLETION: typedef : 3 |
| 50 | // CHECK-CC1-NEXT: COMPLETION: Pattern : 3 : typeid(<#expression-or-type#>) |
| 51 | // CHECK-CC1-NEXT: COMPLETION: Pattern : 3 : typename <#qualified-id#> |
| 52 | // CHECK-CC1-NEXT: COMPLETION: Pattern : 3 : typeof(<#expression-or-type#>) |
| 53 | // CHECK-CC1-NEXT: COMPLETION: union : 3 |
| 54 | // CHECK-CC1-NEXT: COMPLETION: unsigned : 3 |
| 55 | // CHECK-CC1-NEXT: COMPLETION: Pattern : 3 : using namespace <#identifier#>; |
| 56 | // CHECK-CC1-NEXT: COMPLETION: void : 3 |
| 57 | // CHECK-CC1-NEXT: COMPLETION: volatile : 3 |
| 58 | // CHECK-CC1-NEXT: COMPLETION: wchar_t : 3 |
| 59 | // CHECK-CC1-NEXT: COMPLETION: Pattern : 3 : while(<#condition#>){<#statements#> |
| 60 | // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:4:1 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s |
| 61 | // CHECK-CC2: COMPLETION: t : 1 : t |
| 62 | // CHECK-CC2-NEXT: COMPLETION: TYPEDEF : 1 : TYPEDEF |
| 63 | // CHECK-CC2-NEXT: COMPLETION: X : 1 : X |
| 64 | // CHECK-CC2-NOT: COMPLETION: z |
| 65 | // CHECK-CC2-NEXT: COMPLETION: Pattern : 2 : asm(<#string-literal#>); |
| 66 | // CHECK-CC2-NEXT: COMPLETION: bool : 2 |
| 67 | // CHECK-CC2-NEXT: COMPLETION: char : 2 |
| 68 | // CHECK-CC2-NEXT: COMPLETION: class : 2 |
| 69 | // CHECK-CC2-NEXT: COMPLETION: const : 2 |
| 70 | // CHECK-CC2-NEXT: COMPLETION: double : 2 |
| 71 | // CHECK-CC2-NEXT: COMPLETION: enum : 2 |
| 72 | // CHECK-CC2-NEXT: COMPLETION: extern : 2 |
| 73 | // CHECK-CC2-NEXT: COMPLETION: float : 2 |
| 74 | // CHECK-CC2-NEXT: COMPLETION: inline : 2 |
| 75 | // CHECK-CC2-NEXT: COMPLETION: int : 2 |
| 76 | // CHECK-CC2-NEXT: COMPLETION: long : 2 |
| 77 | // CHECK-CC2-NEXT: COMPLETION: Pattern : 2 : namespace <#identifier#>{<#declarations#> |
| 78 | // CHECK-CC2: COMPLETION: Pattern : 2 : namespace <#identifier#> = <#identifier#>; |
| 79 | // CHECK-CC2-NEXT: COMPLETION: operator : 2 |
| 80 | // CHECK-CC2-NEXT: COMPLETION: short : 2 |
| 81 | // CHECK-CC2-NEXT: COMPLETION: signed : 2 |
| 82 | // CHECK-CC2-NEXT: COMPLETION: static : 2 |
| 83 | // CHECK-CC2-NEXT: COMPLETION: struct : 2 |
| 84 | // CHECK-CC2-NEXT: COMPLETION: Pattern : 2 : template <#declaration#>; |
| 85 | // CHECK-CC2-NEXT: COMPLETION: Pattern : 2 : template<<#parameters#>> |
| 86 | // CHECK-CC2-NEXT: COMPLETION: typedef : 2 |
| 87 | // CHECK-CC2-NEXT: COMPLETION: Pattern : 2 : typename <#qualified-id#> |
| 88 | // CHECK-CC2-NEXT: COMPLETION: Pattern : 2 : typeof(<#expression-or-type#>) |
| 89 | // CHECK-CC2-NEXT: COMPLETION: union : 2 |
| 90 | // CHECK-CC2-NEXT: COMPLETION: unsigned : 2 |
| 91 | // CHECK-CC2-NEXT: COMPLETION: Pattern : 2 : using namespace <#identifier#>; |
| 92 | // CHECK-CC2-NEXT: COMPLETION: Pattern : 2 : using <#qualified-id#>; |
| 93 | // CHECK-CC2-NEXT: COMPLETION: void : 2 |
| 94 | // CHECK-CC2-NEXT: COMPLETION: volatile : 2 |
| 95 | // CHECK-CC2-NEXT: COMPLETION: wchar_t : 2 |
| 96 | // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:1:19 %s -o - | FileCheck -check-prefix=CHECK-CC3 %s |
| 97 | // CHECK-CC3: COMPLETION: X : 1 : X |
| 98 | // CHECK-CC3-NEXT: COMPLETION: bool : 4 |
| 99 | // CHECK-CC3-NEXT: COMPLETION: char : 4 |
| 100 | // CHECK-CC3-NEXT: COMPLETION: class : 4 |
| 101 | // CHECK-CC3-NEXT: COMPLETION: const : 4 |
| 102 | // CHECK-CC3-NEXT: COMPLETION: double : 4 |
| 103 | // CHECK-CC3-NEXT: COMPLETION: enum : 4 |
| 104 | // CHECK-CC3-NEXT: COMPLETION: explicit : 4 |
| 105 | // CHECK-CC3-NEXT: COMPLETION: extern : 4 |
| 106 | // CHECK-CC3-NEXT: COMPLETION: float : 4 |
| 107 | // CHECK-CC3-NEXT: COMPLETION: friend : 4 |
| 108 | // CHECK-CC3-NEXT: COMPLETION: inline : 4 |
| 109 | // CHECK-CC3-NEXT: COMPLETION: int : 4 |
| 110 | // CHECK-CC3-NEXT: COMPLETION: long : 4 |
| 111 | // CHECK-CC3-NEXT: COMPLETION: mutable : 4 |
| 112 | // CHECK-CC3-NEXT: COMPLETION: operator : 4 |
| 113 | // CHECK-CC3-NEXT: COMPLETION: Pattern : 4 : private: |
| 114 | // CHECK-CC3-NEXT: COMPLETION: Pattern : 4 : protected: |
| 115 | // CHECK-CC3-NEXT: COMPLETION: Pattern : 4 : public: |
| 116 | // CHECK-CC3-NEXT: COMPLETION: short : 4 |
| 117 | // CHECK-CC3-NEXT: COMPLETION: signed : 4 |
| 118 | // CHECK-CC3-NEXT: COMPLETION: static : 4 |
| 119 | // CHECK-CC3-NEXT: COMPLETION: struct : 4 |
| 120 | // CHECK-CC3-NEXT: COMPLETION: Pattern : 4 : template<<#parameters#>> |
| 121 | // CHECK-CC3-NEXT: COMPLETION: typedef : 4 |
| 122 | // CHECK-CC3-NEXT: COMPLETION: Pattern : 4 : typename <#qualified-id#> |
| 123 | // CHECK-CC3-NEXT: COMPLETION: Pattern : 4 : typeof(<#expression-or-type#>) |
| 124 | // CHECK-CC3-NEXT: COMPLETION: union : 4 |
| 125 | // CHECK-CC3-NEXT: COMPLETION: unsigned : 4 |
| 126 | // CHECK-CC3-NEXT: COMPLETION: Pattern : 4 : using <#qualified-id#>; |
| 127 | // CHECK-CC3-NEXT: COMPLETION: virtual : 4 |
| 128 | // CHECK-CC3-NEXT: COMPLETION: void : 4 |
| 129 | // CHECK-CC3-NEXT: COMPLETION: volatile : 4 |
| 130 | // CHECK-CC3-NEXT: COMPLETION: wchar_t : 4 |
| 131 | // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:6:11 %s -o - | FileCheck -check-prefix=CHECK-CC4 %s |
| 132 | // CHECK-CC4: COMPLETION: y : 0 : [#int#]y |
| 133 | // CHECK-CC4-NEXT: COMPLETION: foo : 2 : [#void#]foo() |
| 134 | // CHECK-CC4-NEXT: COMPLETION: t : 2 : t |
| 135 | // CHECK-CC4-NEXT: COMPLETION: TYPEDEF : 2 : TYPEDEF |
| 136 | // CHECK-CC4-NEXT: COMPLETION: X : 2 : X |
| 137 | // CHECK-CC4-NEXT: COMPLETION: z : 2 : [#void#]z(<#int#>) |
| 138 | // CHECK-CC4-NEXT: COMPLETION: bool : 3 |
| 139 | // CHECK-CC4-NEXT: COMPLETION: char : 3 |
| 140 | // CHECK-CC4-NEXT: COMPLETION: class : 3 |
| 141 | // CHECK-CC4-NEXT: COMPLETION: const : 3 |
| 142 | // CHECK-CC4-NEXT: COMPLETION: Pattern : 3 : const_cast<<#type-id#>>(<#expression#>) |
| 143 | // CHECK-CC4-NEXT: COMPLETION: Pattern : 3 : delete <#expression#> |
| 144 | // CHECK-CC4-NEXT: COMPLETION: Pattern : 3 : delete[] <#expression#> |
| 145 | // CHECK-CC4-NEXT: COMPLETION: double : 3 |
| 146 | // CHECK-CC4-NEXT: COMPLETION: Pattern : 3 : dynamic_cast<<#type-id#>>(<#expression#>) |
| 147 | // CHECK-CC4-NEXT: COMPLETION: enum : 3 |
| 148 | // CHECK-CC4-NEXT: COMPLETION: false : 3 |
| 149 | // CHECK-CC4-NEXT: COMPLETION: float : 3 |
| 150 | // CHECK-CC4-NEXT: COMPLETION: int : 3 |
| 151 | // CHECK-CC4-NEXT: COMPLETION: long : 3 |
| 152 | // CHECK-CC4-NEXT: COMPLETION: Pattern : 3 : new <#type-id#>(<#expressions#>) |
| 153 | // CHECK-CC4-NEXT: COMPLETION: Pattern : 3 : new <#type-id#>[<#size#>](<#expressions#>) |
| 154 | // CHECK-CC4-NEXT: COMPLETION: operator : 3 |
| 155 | // CHECK-CC4-NEXT: COMPLETION: Pattern : 3 : reinterpret_cast<<#type-id#>>(<#expression#>) |
| 156 | // CHECK-CC4-NEXT: COMPLETION: short : 3 |
| 157 | // CHECK-CC4-NEXT: COMPLETION: signed : 3 |
| 158 | // CHECK-CC4-NEXT: COMPLETION: Pattern : 3 : sizeof(<#expression-or-type#>) |
| 159 | // CHECK-CC4-NEXT: COMPLETION: Pattern : 3 : static_cast<<#type-id#>>(<#expression#>) |
| 160 | // CHECK-CC4-NEXT: COMPLETION: struct : 3 |
| 161 | // CHECK-CC4-NEXT: COMPLETION: Pattern : 3 : throw <#expression#> |
| 162 | // CHECK-CC4-NEXT: COMPLETION: true : 3 |
| 163 | // CHECK-CC4-NEXT: COMPLETION: Pattern : 3 : typeid(<#expression-or-type#>) |
| 164 | // CHECK-CC4-NEXT: COMPLETION: Pattern : 3 : typename <#qualified-id#> |
| 165 | // CHECK-CC4-NEXT: COMPLETION: Pattern : 3 : typeof(<#expression-or-type#>) |
| 166 | // CHECK-CC4-NEXT: COMPLETION: union : 3 |
| 167 | // CHECK-CC4-NEXT: COMPLETION: unsigned : 3 |
| 168 | // CHECK-CC4-NEXT: COMPLETION: void : 3 |
| 169 | // CHECK-CC4-NEXT: COMPLETION: volatile : 3 |
| 170 | // CHECK-CC4-NEXT: COMPLETION: wchar_t : 3 |