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