Home | History | Annotate | Download | only in CodeCompletion
      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 -fcxx-exceptions -code-completion-patterns -code-completion-at=%s:6:14 -std=gnu++11 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
      8   // CHECK-CC1: COMPLETION: bool
      9   // CHECK-CC1-NEXT: COMPLETION: char
     10   // CHECK-CC1-NEXT: COMPLETION: char16
     11   // CHECK-CC1-NEXT: COMPLETION: char32
     12   // CHECK-CC1-NEXT: COMPLETION: class
     13   // CHECK-CC1-NEXT: COMPLETION: const
     14   // CHECK-CC1-NEXT: COMPLETION: Pattern : const_cast<<#type#>>(<#expression#>)
     15   // CHECK-CC1: COMPLETION: Pattern : [#void#]delete <#expression#>
     16   // CHECK-CC1-NEXT: COMPLETION: Pattern : [#void#]delete [] <#expression#>
     17   // CHECK-CC1-NEXT: COMPLETION: Pattern : do{<#statements#>
     18   // CHECK-CC1: COMPLETION: double
     19   // CHECK-CC1-NEXT: COMPLETION: Pattern : dynamic_cast<<#type#>>(<#expression#>)
     20   // CHECK-CC1-NEXT: COMPLETION: enum
     21   // CHECK-CC1-NEXT: COMPLETION: extern
     22   // CHECK-CC1-NEXT: COMPLETION: Pattern : [#bool#]false
     23   // CHECK-CC1-NEXT: COMPLETION: float
     24   // CHECK-CC1-NEXT: COMPLETION: foo : [#void#]foo()
     25   // CHECK-CC1-NEXT: COMPLETION: Pattern : for(<#init-statement#>;<#condition#>;<#inc-expression#>){
     26   // CHECK-CC1: COMPLETION: Pattern : goto <#label#>
     27   // CHECK-CC1-NEXT: COMPLETION: Pattern : if(<#condition#>){<#statements#>
     28   // CHECK-CC1: COMPLETION: int
     29   // CHECK-CC1-NEXT: COMPLETION: long
     30   // CHECK-CC1-NEXT: COMPLETION: Pattern : new <#type#>(<#expressions#>)
     31   // CHECK-CC1-NEXT: COMPLETION: Pattern : new <#type#>[<#size#>](<#expressions#>)
     32   // CHECK-CC1-NEXT: COMPLETION: Pattern : [#bool#]noexcept(<#expression#>)
     33   // CHECK-CC1-NEXT: COMPLETION: Pattern : [#std::nullptr_t#]nullptr
     34   // CHECK-CC1-NEXT: COMPLETION: operator
     35   // CHECK-CC1-NEXT: COMPLETION: Pattern : reinterpret_cast<<#type#>>(<#expression#>)
     36   // CHECK-CC1-NEXT: COMPLETION: Pattern : return
     37   // CHECK-CC1-NEXT: COMPLETION: short
     38   // CHECK-CC1-NEXT: COMPLETION: signed
     39   // CHECK-CC1-NEXT: COMPLETION: Pattern : [#size_t#]sizeof(<#expression-or-type#>)
     40   // CHECK-CC1-NEXT: COMPLETION: Pattern : [#size_t#]sizeof...(<#parameter-pack#>)
     41   // CHECK-CC1-NEXT: COMPLETION: static
     42   // CHECK-CC1-NEXT: COMPLETION: Pattern : static_cast<<#type#>>(<#expression#>)
     43   // CHECK-CC1-NEXT: COMPLETION: struct
     44   // CHECK-CC1-NEXT: COMPLETION: Pattern : switch(<#condition#>){
     45   // CHECK-CC1: COMPLETION: t : t
     46   // CHECK-CC1-NEXT: COMPLETION: Pattern : [#void#]throw <#expression#>
     47   // CHECK-CC1-NEXT: COMPLETION: Pattern : [#bool#]true
     48   // CHECK-CC1-NEXT: COMPLETION: Pattern : try{<#statements#>
     49   // CHECK-CC1: COMPLETION: TYPEDEF : TYPEDEF
     50   // CHECK-CC1-NEXT: COMPLETION: Pattern : typedef <#type#> <#name#>
     51   // CHECK-CC1-NEXT: COMPLETION: Pattern : [#std::type_info#]typeid(<#expression-or-type#>)
     52   // CHECK-CC1-NEXT: COMPLETION: Pattern : typename <#qualifier#>::<#name#>
     53   // CHECK-CC1-NEXT: COMPLETION: Pattern : typeof <#expression#>
     54   // CHECK-CC1-NEXT: COMPLETION: Pattern : typeof(<#type#>)
     55   // CHECK-CC1-NEXT: COMPLETION: union
     56   // CHECK-CC1-NEXT: COMPLETION: unsigned
     57   // CHECK-CC1-NEXT: COMPLETION: Pattern : using namespace <#identifier#>
     58   // CHECK-CC1-NEXT: COMPLETION: void
     59   // CHECK-CC1-NEXT: COMPLETION: volatile
     60   // CHECK-CC1-NEXT: COMPLETION: wchar_t
     61   // CHECK-CC1-NEXT: COMPLETION: Pattern : while(<#condition#>){<#statements#>
     62   // CHECK-CC1: COMPLETION: X : X
     63   // CHECK-CC1-NEXT: COMPLETION: y : [#int#]y
     64   // CHECK-CC1-NEXT: COMPLETION: z : [#void#]z(<#int#>)
     65 
     66   // RUN: %clang_cc1 -fsyntax-only  -code-completion-patterns -code-completion-at=%s:4:1 -std=gnu++11 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
     67   // CHECK-CC2: COMPLETION: Pattern : asm(<#string-literal#>)
     68   // CHECK-CC2: COMPLETION: auto
     69   // CHECK-CC2-NEXT: COMPLETION: bool
     70   // CHECK-CC2-NEXT: COMPLETION: char
     71   // CHECK-CC2-NEXT: COMPLETION: char16
     72   // CHECK-CC2-NEXT: COMPLETION: char32
     73   // CHECK-CC2-NEXT: COMPLETION: class
     74   // CHECK-CC2-NEXT: COMPLETION: const
     75   // CHECK-CC2-NEXT: COMPLETION: Pattern : decltype(<#expression#>)
     76   // CHECK-CC2-NEXT: COMPLETION: double
     77   // CHECK-CC2-NEXT: COMPLETION: enum
     78   // CHECK-CC2-NEXT: COMPLETION: extern
     79   // CHECK-CC2-NEXT: COMPLETION: float
     80   // CHECK-CC2-NEXT: COMPLETION: inline
     81   // CHECK-CC2-NEXT: COMPLETION: int
     82   // CHECK-CC2-NEXT: COMPLETION: long
     83   // CHECK-CC2-NEXT: COMPLETION: Pattern : namespace <#identifier#>{<#declarations#>
     84   // CHECK-CC2: COMPLETION: Pattern : namespace <#name#> = <#namespace#>
     85   // CHECK-CC2-NEXT: COMPLETION: operator
     86   // CHECK-CC2-NEXT: COMPLETION: short
     87   // CHECK-CC2-NEXT: COMPLETION: signed
     88   // CHECK-CC2-NEXT: COMPLETION: static
     89   // CHECK-CC2-NEXT: COMPLETION: struct
     90   // CHECK-CC2-NEXT: COMPLETION: t : t
     91   // CHECK-CC2-NEXT: COMPLETION: Pattern : template <#declaration#>
     92   // CHECK-CC2-NEXT: COMPLETION: Pattern : template<<#parameters#>>
     93   // CHECK-CC2-NEXT: COMPLETION: TYPEDEF : TYPEDEF
     94   // CHECK-CC2-NEXT: COMPLETION: Pattern : typedef <#type#> <#name#>
     95   // CHECK-CC2-NEXT: COMPLETION: Pattern : typename <#qualifier#>::<#name#>
     96   // CHECK-CC2-NEXT: COMPLETION: Pattern : typeof <#expression#>
     97   // CHECK-CC2-NEXT: COMPLETION: Pattern : typeof(<#type#>)
     98   // CHECK-CC2-NEXT: COMPLETION: union
     99   // CHECK-CC2-NEXT: COMPLETION: unsigned
    100   // CHECK-CC2-NEXT: COMPLETION: Pattern : using namespace <#identifier#>
    101   // CHECK-CC2-NEXT: COMPLETION: Pattern : using <#qualifier#>::<#name#>
    102   // CHECK-CC2-NEXT: COMPLETION: void
    103   // CHECK-CC2-NEXT: COMPLETION: volatile
    104   // CHECK-CC2-NEXT: COMPLETION: wchar_t
    105   // CHECK-CC2-NEXT: COMPLETION: X : X
    106 
    107   // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:1:19 -std=gnu++11 %s -o - | FileCheck -check-prefix=CHECK-CC3 %s
    108   // CHECK-CC3: COMPLETION: bool
    109   // CHECK-CC3-NEXT: COMPLETION: char
    110   // CHECK-CC3-NEXT: COMPLETION: char16_t
    111   // CHECK-CC3-NEXT: COMPLETION: char32_t
    112   // CHECK-CC3-NEXT: COMPLETION: class
    113   // CHECK-CC3-NEXT: COMPLETION: const
    114   // CHECK-CC3-NEXT: COMPLETION: Pattern : decltype(<#expression#>)
    115   // CHECK-CC3-NEXT: COMPLETION: double
    116   // CHECK-CC3-NEXT: COMPLETION: enum
    117   // CHECK-CC3-NEXT: COMPLETION: explicit
    118   // CHECK-CC3-NEXT: COMPLETION: extern
    119   // CHECK-CC3-NEXT: COMPLETION: float
    120   // CHECK-CC3-NEXT: COMPLETION: friend
    121   // CHECK-CC3-NEXT: COMPLETION: inline
    122   // CHECK-CC3-NEXT: COMPLETION: int
    123   // CHECK-CC3-NEXT: COMPLETION: long
    124   // CHECK-CC3-NEXT: COMPLETION: mutable
    125   // CHECK-CC3-NEXT: COMPLETION: operator
    126   // CHECK-CC3-NEXT: COMPLETION: Pattern : private:
    127   // CHECK-CC3-NEXT: COMPLETION: Pattern : protected:
    128   // CHECK-CC3-NEXT: COMPLETION: Pattern : public:
    129   // CHECK-CC3-NEXT: COMPLETION: short
    130   // CHECK-CC3-NEXT: COMPLETION: signed
    131   // CHECK-CC3-NEXT: COMPLETION: static
    132   // CHECK-CC3-NEXT: COMPLETION: struct
    133   // CHECK-CC3-NEXT: COMPLETION: Pattern : template<<#parameters#>>
    134   // CHECK-CC3-NEXT: COMPLETION: Pattern : typedef <#type#> <#name#>
    135   // CHECK-CC3-NEXT: COMPLETION: Pattern : typename <#qualifier#>::<#name#>
    136   // CHECK-CC3-NEXT: COMPLETION: Pattern : typeof <#expression#>
    137   // CHECK-CC3-NEXT: COMPLETION: Pattern : typeof(<#type#>)
    138   // CHECK-CC3-NEXT: COMPLETION: union
    139   // CHECK-CC3-NEXT: COMPLETION: unsigned
    140   // CHECK-CC3-NEXT: COMPLETION: Pattern : using <#qualifier#>::<#name#>
    141   // CHECK-CC3-NEXT: COMPLETION: virtual
    142   // CHECK-CC3-NEXT: COMPLETION: void
    143   // CHECK-CC3-NEXT: COMPLETION: volatile
    144   // CHECK-CC3-NEXT: COMPLETION: wchar_t
    145   // CHECK-CC3-NEXT: COMPLETION: X : X
    146 
    147   // RUN: %clang_cc1 -fsyntax-only -fcxx-exceptions -code-completion-patterns -code-completion-at=%s:6:11 -std=gnu++11 %s -o - | FileCheck -check-prefix=CHECK-CC4 %s
    148   // CHECK-CC4: COMPLETION: bool
    149   // CHECK-CC4-NEXT: COMPLETION: char
    150   // CHECK-CC4-NEXT: COMPLETION: char16_t
    151   // CHECK-CC4-NEXT: COMPLETION: char32_t
    152   // CHECK-CC4-NEXT: COMPLETION: class
    153   // CHECK-CC4-NEXT: COMPLETION: const
    154   // CHECK-CC4-NEXT: COMPLETION: Pattern : const_cast<<#type#>>(<#expression#>)
    155   // CHECK-CC4-NEXT: COMPLETION: Pattern : decltype(<#expression#>)
    156   // CHECK-CC4-NEXT: COMPLETION: Pattern : [#void#]delete <#expression#>
    157   // CHECK-CC4-NEXT: COMPLETION: Pattern : [#void#]delete [] <#expression#>
    158   // CHECK-CC4-NEXT: COMPLETION: double
    159   // CHECK-CC4-NEXT: COMPLETION: Pattern : dynamic_cast<<#type#>>(<#expression#>)
    160   // CHECK-CC4-NEXT: COMPLETION: enum
    161   // CHECK-CC4-NEXT: COMPLETION: Pattern : [#bool#]false
    162   // CHECK-CC4-NEXT: COMPLETION: float
    163   // CHECK-CC4-NEXT: COMPLETION: foo : [#void#]foo()
    164   // CHECK-CC4-NEXT: COMPLETION: int
    165   // CHECK-CC4-NEXT: COMPLETION: long
    166   // CHECK-CC4-NEXT: COMPLETION: Pattern : new <#type#>(<#expressions#>)
    167   // CHECK-CC4-NEXT: COMPLETION: Pattern : new <#type#>[<#size#>](<#expressions#>)
    168   // CHECK-CC4-NEXT: COMPLETION: Pattern : [#bool#]noexcept(<#expression#>)
    169   // CHECK-CC4-NEXT: COMPLETION: Pattern : [#std::nullptr_t#]nullptr
    170   // CHECK-CC4-NEXT: COMPLETION: operator
    171   // CHECK-CC4-NEXT: COMPLETION: Pattern : reinterpret_cast<<#type#>>(<#expression#>)
    172   // CHECK-CC4-NEXT: COMPLETION: short
    173   // CHECK-CC4-NEXT: COMPLETION: signed
    174   // CHECK-CC4-NEXT: COMPLETION: Pattern : [#size_t#]sizeof(<#expression-or-type#>)
    175   // CHECK-CC4-NEXT: COMPLETION: Pattern : [#size_t#]sizeof...(<#parameter-pack#>)
    176   // CHECK-CC4-NEXT: COMPLETION: Pattern : static_cast<<#type#>>(<#expression#>)
    177   // CHECK-CC4-NEXT: COMPLETION: struct
    178   // CHECK-CC4-NEXT: COMPLETION: t : t
    179   // CHECK-CC4-NEXT: COMPLETION: Pattern : [#void#]throw <#expression#>
    180   // CHECK-CC4-NEXT: COMPLETION: Pattern : [#bool#]true
    181   // CHECK-CC4-NEXT: COMPLETION: TYPEDEF : TYPEDEF
    182   // CHECK-CC4-NEXT: COMPLETION: Pattern : [#std::type_info#]typeid(<#expression-or-type#>)
    183   // CHECK-CC4-NEXT: COMPLETION: Pattern : typename <#qualifier#>::<#name#>
    184   // CHECK-CC4-NEXT: COMPLETION: Pattern : typeof <#expression#>
    185   // CHECK-CC4-NEXT: COMPLETION: Pattern : typeof(<#type#>)
    186   // CHECK-CC4-NEXT: COMPLETION: union
    187   // CHECK-CC4-NEXT: COMPLETION: unsigned
    188   // CHECK-CC4-NEXT: COMPLETION: void
    189   // CHECK-CC4-NEXT: COMPLETION: volatile
    190   // CHECK-CC4-NEXT: COMPLETION: wchar_t
    191   // CHECK-CC4-NEXT: COMPLETION: X : X
    192   // CHECK-CC4-NEXT: COMPLETION: y : [#int#]y
    193   // CHECK-CC4-NEXT: COMPLETION: z : [#void#]z(<#int#>)
    194 
    195   // RUN: %clang_cc1 -fsyntax-only -fno-rtti -code-completion-patterns -code-completion-at=%s:6:14 -std=gnu++11 %s -o - | FileCheck -check-prefix=CHECK-NO-RTTI %s
    196   // CHECK-NO-RTTI: COMPLETION: bool
    197   // CHECK-NO-RTTI-NEXT: COMPLETION: char
    198   // CHECK-NO-RTTI-NEXT: COMPLETION: char16_t
    199   // CHECK-NO-RTTI-NEXT: COMPLETION: char32_t
    200   // CHECK-NO-RTTI-NEXT: COMPLETION: class
    201   // CHECK-NO-RTTI-NEXT: COMPLETION: const
    202   // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : const_cast<<#type#>>(<#expression#>)
    203   // CHECK-NO-RTTI: COMPLETION: Pattern : [#void#]delete <#expression#>
    204   // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : [#void#]delete [] <#expression#>
    205   // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : do{<#statements#>
    206   // CHECK-NO-RTTI: COMPLETION: double
    207   // CHECK-NO-RTTI-NOT: dynamic_cast
    208   // CHECK-NO-RTTI: COMPLETION: enum
    209   // CHECK-NO-RTTI-NEXT: COMPLETION: extern
    210   // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : [#bool#]false
    211   // CHECK-NO-RTTI-NEXT: COMPLETION: float
    212   // CHECK-NO-RTTI-NEXT: COMPLETION: foo : [#void#]foo()
    213   // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : for(<#init-statement#>;<#condition#>;<#inc-expression#>){
    214   // CHECK-NO-RTTI: COMPLETION: Pattern : goto <#label#>
    215   // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : if(<#condition#>){<#statements#>
    216   // CHECK-NO-RTTI: COMPLETION: int
    217   // CHECK-NO-RTTI-NEXT: COMPLETION: long
    218   // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : new <#type#>(<#expressions#>)
    219   // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : new <#type#>[<#size#>](<#expressions#>)
    220   // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : [#bool#]noexcept(<#expression#>)
    221   // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : [#std::nullptr_t#]nullptr
    222   // CHECK-NO-RTTI-NEXT: COMPLETION: operator
    223   // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : reinterpret_cast<<#type#>>(<#expression#>)
    224   // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : return
    225   // CHECK-NO-RTTI-NEXT: COMPLETION: short
    226   // CHECK-NO-RTTI-NEXT: COMPLETION: signed
    227   // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : [#size_t#]sizeof(<#expression-or-type#>)
    228   // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : [#size_t#]sizeof...(<#parameter-pack#>)
    229   // CHECK-NO-RTTI-NEXT: COMPLETION: static
    230   // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : static_cast<<#type#>>(<#expression#>)
    231   // CHECK-NO-RTTI-NEXT: COMPLETION: struct
    232   // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : switch(<#condition#>){
    233   // CHECK-NO-RTTI: COMPLETION: t : t
    234   // CHECK-NO-RTTI-NOT: throw
    235   // CHECK-NO-RTTI: COMPLETION: Pattern : [#bool#]true
    236   // CHECK-NO-RTTI-NOT: try
    237   // CHECK-NO-RTTI: COMPLETION: TYPEDEF : TYPEDEF
    238   // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : typedef <#type#> <#name#>
    239   // CHECK-NO-RTTI-NOT: typeid
    240   // CHECK-NO-RTTI: COMPLETION: Pattern : typename <#qualifier#>::<#name#>
    241   // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : typeof <#expression#>
    242   // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : typeof(<#type#>)
    243   // CHECK-NO-RTTI-NEXT: COMPLETION: union
    244   // CHECK-NO-RTTI-NEXT: COMPLETION: unsigned
    245   // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : using namespace <#identifier#>
    246   // CHECK-NO-RTTI-NEXT: COMPLETION: void
    247   // CHECK-NO-RTTI-NEXT: COMPLETION: volatile
    248   // CHECK-NO-RTTI-NEXT: COMPLETION: wchar_t
    249   // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : while(<#condition#>){<#statements#>
    250   // CHECK-NO-RTTI: COMPLETION: X : X
    251   // CHECK-NO-RTTI-NEXT: COMPLETION: y : [#int#]y
    252   // CHECK-NO-RTTI-NEXT: COMPLETION: z : [#void#]z(<#int#>)
    253