Second Lit tests C++11 compatibility patch: using preprocessor to filter expected-error

Justin Bogner via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 17 21:27:52 PDT 2015


"Li, Charles" <charles_li at playstation.sony.com> writes:
> Hi Richard,
>
> I have modified the “expected-“ lines as you requested.
>
> Cheers,
>
> Charles
>
> From: metafoo at gmail.com [mailto:metafoo at gmail.com] On Behalf Of Richard Smith
> Sent: Monday, August 17, 2015 5:41 PM
> To: Li, Charles
> Cc: Justin Bogner; cfe-commits at lists.llvm.org
> Subject: Re: Second Lit tests C++11 compatibility patch: using preprocessor to
> filter expected-error
>
> On Mon, Aug 17, 2015 at 5:15 PM, Li, Charles via cfe-commits <
> cfe-commits at lists.llvm.org> wrote:
>
> Hi Richard and Justin,
>
>> What's the upside to this approach? AFAICT it makes the test harder to read
> and errors less informative due to pointing at the wrong lines, but (at least
> in switch-1.c) it doesn't actually reduce any code duplication or anything
> like that. What is this gaining us apart from not having to create one more
> file?
>
> Thank you Justin.
>
> Our original intention was to get the Lit tests to run at any default C++
> dialect.
>
> We first discovered that FileCheck does not respect #ifdef since it does not
> know about pre-defined macros.
>
> So we figured if we preprocess the source first, the preprocessor will filter
> the #ifdef sections and the output will feed nicely into FileCheck.
>
> The upside is the test can run at the default dialect in addition to
> explicitly specified dialect.
>
> The downside is, as you mentioned, the errors diagnostics would point to the
> wrong lines.
>
>> The only thing novel about this approach is using the preprocessor to
> achieve it. -verify *does* respect #ifdef, and we have a lot of tests that
> rely on that.
>
> Thank you Richard.
>
> We erroneously assumed that “// CHECK:” and “// expected-error” work the same
> way.
>
> But now we realized that assumption was wrong.
>
> In light this discussion, I have removed the preprocessing to temporary step
> for all tests.
>
> The attached patch (Lit_24.patch) revised 2 test fixes relative to the
> previous patch (Lit_22.patch)
>
>   test/Analysis/temp-obj-dtors-cfg-output.cpp
>
>     This test uses FileCheck to check for CFG dump.
>
>     Instead of using #ifdef for the dialect specific “// CHECK:” lines,
>
>     I have created 2 check-prefixes “CXX11” and “CXX98”.
>
>     The pre-process step have been removed.
>
>   test/Sema/switch-1.c
>
>     This test uses –verify to check for integer overflows diagnostics.
>
>     The pre-process step have been removed.
>
>     The #ifdef is kept since it works with -verify.
>
> Instead of duplicating the code, you can do this:
>
> case blah:
>
> #if __cplusplus >= 201103L
>
> // expected-error at -2 {{error 2 lines above}}
>
> #else
>
> // expected-error at -4 {{error 4 lines above}}
>
> #endif
>
>     Please let me know how you feel about this patch.
>
>     Sincerely,
>    
>     Charles
>
>     From: metafoo at gmail.com [mailto:metafoo at gmail.com] On Behalf Of Richard
>     Smith
>     Sent: Monday, August 17, 2015 1:07 PM
>     To: Li, Charles
>     Cc: cfe-commits at lists.llvm.org
>     Subject: Re: Second Lit tests C++11 compatibility patch: using
>     preprocessor to filter expected-error
>
>     On Mon, Aug 17, 2015 at 9:56 AM, Li, Charles via cfe-commits <
>     cfe-commits at lists.llvm.org> wrote:
>    
>     Hi Clang developers,
>
>     We here at Sony are continuing to update the Lit tests for C++ dialects
>     compatibility.
>    
>     Attached is the second patch. (As a reference, here is the link to the
>     discussion on the previous Lit patch. http://lists.cs.uiuc.edu/pipermail/
>     cfe-commits/Week-of-Mon-20150727/134667.html)
>    
>     In this second patch, there is 1 complicated change and 3 simple changes.
>
>     Here is the complicated change first.
>
>     test/Sema/switch-1.c
>    
>       This test verifies the diagnostics for integer overflows.
>    
>       Due to C++11’s more strict requirements on constant-expressions in
>     5.19p2 [expr.const],
>    
>       The diagnostics have changed from “overflow in expression” to “not a
>     constant expression”.
>
>       Usually we would create a C++11 version of the switch-1.c file.
>    
>       But here we propose a novel approach to “#ifdef” the expected
>     diagnostics. (We hope to use this approach for all similar cases in the
>     future.)
>    
>       Normally ‘// expected-error’ does not honor any ‘#ifdef’.
>    
>       But if we first preprocess the source into a temporary file, only the
>     valid ‘#ifdef’ sections remain.
>    
>       We then run the preprocessed file at the desired dialect.
>    
>       The main downside to this approach is If the test fails, the errors are
>     reported on the temporary file, not on the original file, and the line
>     numbers of these two files  do not match
>
>     The only thing novel about this approach is using the preprocessor to
>     achieve it. -verify *does* respect #ifdef, and we have a lot of tests that
>     rely on that.
>
>         Here are the simple changes.
>
>         test/Analysis/temp-obj-dtors-cfg-output.cpp
>        
>           This test verifies CFG dump for temporary destructors
>        
>           C++11 no longer has the following implicit cast.
>        
>             (ImplicitCastExpr, NoOp, const struct D)
>        
>           We modified the test using the #ifdef approach to have the
>         preprocessor generate the desired CHECK lines.
>
>         test/CodeCompletion/ordinary-name.cpp
>        
>           This test verifies for code completion patterns.
>        
>           Since C++11 has more keywords than C++98,
>        
>           We made this test to be C++98 specific, and create a separate C++11
>         version.
>
>         test/CodeCompletion/ordinary-name-cxx11.cpp
>        
>           This is the C++11 specific version of the code completion.
>        
>           This test added patterns for the following keywords:
>        
>             char16, char32, noexcept, nullptr, sizeof...,
>        
>             auto, decltype, char16_t, char32_t
>
>         test/Sema/thread-specifier.c
>        
>           Tests for __thread specifier at various C++ dialects
>        
>           We made the default RUN line explicit to be at –std=c++98
>
>         If there is anything that seems confusing to you, please let me know.
>        
>         I would be more than happy to expand on the reasons for the these
>         changes.
>
>         Thanks,
>        
>         Charles
>
>         _______________________________________________
>         cfe-commits mailing list
>         cfe-commits at lists.llvm.org
>         http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
>     _______________________________________________
>     cfe-commits mailing list
>     cfe-commits at lists.llvm.org
>     http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
> diff --git test/Analysis/temp-obj-dtors-cfg-output.cpp test/Analysis/temp-obj-dtors-cfg-output.cpp
> index 491c68e..dc10e87 100644
> --- test/Analysis/temp-obj-dtors-cfg-output.cpp
> +++ test/Analysis/temp-obj-dtors-cfg-output.cpp
> @@ -1,6 +1,8 @@
>  // RUN: rm -f %t
> -// RUN: %clang_cc1 -analyze -analyzer-checker=debug.DumpCFG -analyzer-config cfg-temporary-dtors=true %s > %t 2>&1
> -// RUN: FileCheck --input-file=%t %s
> +// RUN: %clang_cc1 -analyze -analyzer-checker=debug.DumpCFG -analyzer-config cfg-temporary-dtors=true -std=c++98 %s > %t 2>&1
> +// RUN: FileCheck --input-file=%t -check-prefix=CXX98 -check-prefix=CHECK %s
> +// RUN: %clang_cc1 -analyze -analyzer-checker=debug.DumpCFG -analyzer-config cfg-temporary-dtors=true -std=c++11 %s > %t 2>&1
> +// RUN: FileCheck --input-file=%t -check-prefix=CXX11 -check-prefix=CHECK %s
>  
>  class A {
>  public:
> @@ -671,15 +673,23 @@ int testConsistencyNestedNormalReturn(bool value) {
>  // CHECK:     Succs (1): B0
>  // CHECK:   [B3]
>  // CHECK:     1: D() (CXXConstructExpr, struct D)
> -// CHECK:     2: [B3.1] (ImplicitCastExpr, NoOp, const struct D)
> -// CHECK:     3: [B3.2]
> -// CHECK:     4: [B3.3] (CXXConstructExpr, struct D)
> -// CHECK:     5: D d = D();
> -// CHECK:     6: d
> -// CHECK:     7: [B3.6].operator bool
> -// CHECK:     8: [B3.6]
> -// CHECK:     9: [B3.8] (ImplicitCastExpr, UserDefinedConversion, _Bool)
> -// CHECK:     T: if [B3.9]
> +// CXX98:     2: [B3.1] (ImplicitCastExpr, NoOp, const struct D)
> +// CXX98:     3: [B3.2]
> +// CXX98:     4: [B3.3] (CXXConstructExpr, struct D)
> +// CXX98:     5: D d = D();
> +// CXX98:     6: d
> +// CXX98:     7: [B3.6].operator bool
> +// CXX98:     8: [B3.6]
> +// CXX98:     9: [B3.8] (ImplicitCastExpr, UserDefinedConversion, _Bool)
> +// CXX98:     T: if [B3.9]
> +// CXX11:     2: [B3.1]
> +// CXX11:     3: [B3.2] (CXXConstructExpr, struct D)
> +// CXX11:     4: D d = D();
> +// CXX11:     5: d
> +// CXX11:     6: [B3.5].operator bool
> +// CXX11:     7: [B3.5]
> +// CXX11:     8: [B3.7] (ImplicitCastExpr, UserDefinedConversion, _Bool)
> +// CXX11:     T: if [B3.8]
>  // CHECK:     Preds (1): B4
>  // CHECK:     Succs (2): B2 B1
>  // CHECK:   [B0 (EXIT)]
> diff --git test/CodeCompletion/ordinary-name.cpp test/CodeCompletion/ordinary-name.cpp
> index d0b09b5..03dbbca 100644
> --- test/CodeCompletion/ordinary-name.cpp
> +++ test/CodeCompletion/ordinary-name.cpp
> @@ -4,7 +4,7 @@ typedef struct t TYPEDEF;
>  
>  void foo() {
>    int y = 17;
> -  // RUN: %clang_cc1 -fsyntax-only -fcxx-exceptions -code-completion-patterns -code-completion-at=%s:6:14 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
> +  // 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
>    // CHECK-CC1: COMPLETION: bool
>    // CHECK-CC1-NEXT: COMPLETION: char
>    // CHECK-CC1-NEXT: COMPLETION: class
> @@ -58,7 +58,7 @@ void foo() {
>    // CHECK-CC1-NEXT: COMPLETION: y : [#int#]y
>    // CHECK-CC1-NEXT: COMPLETION: z : [#void#]z(<#int#>)
>  
> -  // RUN: %clang_cc1 -fsyntax-only  -code-completion-patterns -code-completion-at=%s:4:1 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
> +  // 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
>    // CHECK-CC2: COMPLETION: Pattern : asm(<#string-literal#>)
>    // CHECK-CC2-NEXT: COMPLETION: bool
>    // CHECK-CC2-NEXT: COMPLETION: char
> @@ -95,7 +95,7 @@ void foo() {
>    // CHECK-CC2-NEXT: COMPLETION: wchar_t
>    // CHECK-CC2-NEXT: COMPLETION: X : X
>  
> -  // RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:1:19 %s -o - | FileCheck -check-prefix=CHECK-CC3 %s
> +  // 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
>    // CHECK-CC3: COMPLETION: bool
>    // CHECK-CC3-NEXT: COMPLETION: char
>    // CHECK-CC3-NEXT: COMPLETION: class
> @@ -132,7 +132,7 @@ void foo() {
>    // CHECK-CC3-NEXT: COMPLETION: wchar_t
>    // CHECK-CC3-NEXT: COMPLETION: X : X
>  
> -  // RUN: %clang_cc1 -fsyntax-only -fcxx-exceptions -code-completion-patterns -code-completion-at=%s:6:11 %s -o - | FileCheck -check-prefix=CHECK-CC4 %s
> +  // 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
>    // CHECK-CC4: COMPLETION: bool
>    // CHECK-CC4-NEXT: COMPLETION: char
>    // CHECK-CC4-NEXT: COMPLETION: class
> @@ -174,7 +174,7 @@ void foo() {
>    // CHECK-CC4-NEXT: COMPLETION: y : [#int#]y
>    // CHECK-CC4-NEXT: COMPLETION: z : [#void#]z(<#int#>)
>  
> -  // RUN: %clang_cc1 -fsyntax-only -fno-rtti -code-completion-patterns -code-completion-at=%s:6:14 %s -o - | FileCheck -check-prefix=CHECK-NO-RTTI %s
> +  // 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
>    // CHECK-NO-RTTI: COMPLETION: bool
>    // CHECK-NO-RTTI-NEXT: COMPLETION: char
>    // CHECK-NO-RTTI-NEXT: COMPLETION: class
> diff --git test/Sema/switch-1.c test/Sema/switch-1.c
> index 5191c92..ae1bd9c 100644
> --- test/Sema/switch-1.c
> +++ test/Sema/switch-1.c
> @@ -1,18 +1,51 @@
> -// RUN: %clang_cc1 -fsyntax-only -verify -triple x86_64-apple-darwin10 %s
> +// RUN: %clang_cc1 -E -C -P -triple x86_64-apple-darwin10 %s > %t1.c
> +// RUN: %clang_cc1 -fsyntax-only -verify -triple x86_64-apple-darwin10 %t1.c

I think you forgot to switch this one to stop preprocessing first.

>  // RUN: %clang_cc1 -x c++ -fsyntax-only -verify -triple x86_64-apple-darwin10 %s
> +// RUN: %clang_cc1 -x c++ -fsyntax-only -verify -triple x86_64-apple-darwin10 -std=c++98 %s
> +// RUN: %clang_cc1 -x c++ -fsyntax-only -verify -triple x86_64-apple-darwin10 -std=c++11 %s
>  // rdar://11577384
>  // rdar://13423975
>  
>  int f(int i) {
>    switch (i) {
> -    case 2147483647 + 2: // expected-warning {{overflow in expression; result is -2147483647 with type 'int'}}
> +    case 2147483647 + 2:
> +#if (!defined(__cplusplus)) || (__cplusplus <= 199711L) // C or C++03 or earlier modes
> +    // expected-warning at -2 {{overflow in expression; result is -2147483647 with type 'int'}}
> +#else
> +    // expected-error at -4 {{case value is not a constant expression}} \
> +    // expected-note at -4 {{value 2147483649 is outside the range of representable values of type 'int'}}
> +#endif
>        return 1;
> -    case 9223372036854775807L * 4: // expected-warning {{overflow in expression; result is -4 with type 'long'}}
> +    case 9223372036854775807L * 4:
> +#if (!defined(__cplusplus)) || (__cplusplus <= 199711L)
> +    // expected-warning at -2 {{overflow in expression; result is -4 with type 'long'}}
> +#else
> +    // expected-error at -4 {{case value is not a constant expression}} \
> +    // expected-note at -4 {{value 36893488147419103228 is outside the range of representable values of type 'long'}}
> +#endif
>        return 2;
> -    case (123456 *789012) + 1:  // expected-warning {{overflow in expression; result is -1375982336 with type 'int'}}
> +    case (123456 *789012) + 1:
> +#if (!defined(__cplusplus)) || (__cplusplus <= 199711L)
> +    // expected-warning at -2 {{overflow in expression; result is -1375982336 with type 'int'}}
> +#else
> +    // expected-error at -4 {{case value is not a constant expression}} \
> +    // expected-note at -4 {{value 97408265472 is outside the range of representable values of type 'int'}}
> +#endif
>        return 3;
> -    case (2147483647*4)/4: 	// expected-warning {{overflow in expression; result is -4 with type 'int'}}
> -    case (2147483647*4)%4: 	// expected-warning {{overflow in expression; result is -4 with type 'int'}}
> +    case (2147483647*4)/4:
> +#if (!defined(__cplusplus)) || (__cplusplus <= 199711L)
> +    // expected-warning at -2 {{overflow in expression; result is -4 with type 'int'}}
> +#else
> +    // expected-error at -4 {{case value is not a constant expression}} \
> +    // expected-note at -4 {{value 8589934588 is outside the range of representable values of type 'int'}}
> +#endif
> +    case (2147483647*4)%4:
> +#if (!defined(__cplusplus)) || (__cplusplus <= 199711L)
> +    // expected-warning at -2 {{overflow in expression; result is -4 with type 'int'}}
> +#else
> +    // expected-error at -4 {{case value is not a constant expression}} \
> +    // expected-note at -4 {{value 8589934588 is outside the range of representable values of type 'int'}}
> +#endif
>        return 4;
>      case 2147483647:
>        return 0;
> diff --git test/Sema/thread-specifier.c test/Sema/thread-specifier.c
> index 3968ae1..a93850d 100644
> --- test/Sema/thread-specifier.c
> +++ test/Sema/thread-specifier.c
> @@ -1,7 +1,7 @@
>  // RUN: %clang_cc1 -triple i686-pc-linux-gnu -fsyntax-only -Wno-private-extern -verify -pedantic %s -DGNU
> -// RUN: %clang_cc1 -triple i686-pc-linux-gnu -fsyntax-only -Wno-private-extern -verify -pedantic -x c++ %s -DGNU
> +// RUN: %clang_cc1 -triple i686-pc-linux-gnu -fsyntax-only -Wno-private-extern -verify -pedantic -x c++ %s -DGNU -std=c++98
>  // RUN: %clang_cc1 -triple i686-pc-linux-gnu -fsyntax-only -Wno-private-extern -verify -pedantic %s -DC11 -D__thread=_Thread_local
> -// RUN: %clang_cc1 -triple i686-pc-linux-gnu -fsyntax-only -Wno-private-extern -verify -pedantic -x c++ %s -DC11 -D__thread=_Thread_local
> +// RUN: %clang_cc1 -triple i686-pc-linux-gnu -fsyntax-only -Wno-private-extern -verify -pedantic -x c++ %s -DC11 -D__thread=_Thread_local -std=c++98
>  // RUN: %clang_cc1 -triple i686-pc-linux-gnu -fsyntax-only -Wno-private-extern -verify -pedantic -x c++ %s -DCXX11 -D__thread=thread_local -std=c++11 -Wno-deprecated
>  // RUN: %clang_cc1 -triple i686-pc-linux-gnu -fsyntax-only -Wno-private-extern -verify -pedantic -x c++ %s -DC11 -D__thread=_Thread_local -std=c++11 -Wno-deprecated
>  
> diff --git test/CodeCompletion/ordinary-name-cxx11.cpp test/CodeCompletion/ordinary-name-cxx11.cpp
> new file mode 100644
> index 0000000..8e6f383
> --- /dev/null
> +++ test/CodeCompletion/ordinary-name-cxx11.cpp
> @@ -0,0 +1,252 @@
> +struct X { int x; };
> +void z(int);
> +typedef struct t TYPEDEF;
> +
> +void foo() {
> +  int y = 17;
> +  // 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
> +  // CHECK-CC1: COMPLETION: bool
> +  // CHECK-CC1-NEXT: COMPLETION: char
> +  // CHECK-CC1-NEXT: COMPLETION: char16
> +  // CHECK-CC1-NEXT: COMPLETION: char32
> +  // CHECK-CC1-NEXT: COMPLETION: class
> +  // CHECK-CC1-NEXT: COMPLETION: const
> +  // CHECK-CC1-NEXT: COMPLETION: Pattern : const_cast<<#type#>>(<#expression#>)
> +  // CHECK-CC1: COMPLETION: Pattern : [#void#]delete <#expression#>
> +  // CHECK-CC1-NEXT: COMPLETION: Pattern : [#void#]delete [] <#expression#>
> +  // CHECK-CC1-NEXT: COMPLETION: Pattern : do{<#statements#>
> +  // CHECK-CC1: COMPLETION: double
> +  // CHECK-CC1-NEXT: COMPLETION: Pattern : dynamic_cast<<#type#>>(<#expression#>)
> +  // CHECK-CC1-NEXT: COMPLETION: enum
> +  // CHECK-CC1-NEXT: COMPLETION: extern
> +  // CHECK-CC1-NEXT: COMPLETION: Pattern : [#bool#]false
> +  // CHECK-CC1-NEXT: COMPLETION: float
> +  // CHECK-CC1-NEXT: COMPLETION: foo : [#void#]foo()
> +  // CHECK-CC1-NEXT: COMPLETION: Pattern : for(<#init-statement#>;<#condition#>;<#inc-expression#>){
> +  // CHECK-CC1: COMPLETION: Pattern : goto <#label#>
> +  // CHECK-CC1-NEXT: COMPLETION: Pattern : if(<#condition#>){<#statements#>
> +  // CHECK-CC1: COMPLETION: int
> +  // CHECK-CC1-NEXT: COMPLETION: long
> +  // CHECK-CC1-NEXT: COMPLETION: Pattern : new <#type#>(<#expressions#>)
> +  // CHECK-CC1-NEXT: COMPLETION: Pattern : new <#type#>[<#size#>](<#expressions#>)
> +  // CHECK-CC1-NEXT: COMPLETION: Pattern : [#bool#]noexcept(<#expression#>)
> +  // CHECK-CC1-NEXT: COMPLETION: Pattern : [#std::nullptr_t#]nullptr
> +  // CHECK-CC1-NEXT: COMPLETION: operator
> +  // CHECK-CC1-NEXT: COMPLETION: Pattern : reinterpret_cast<<#type#>>(<#expression#>)
> +  // CHECK-CC1-NEXT: COMPLETION: Pattern : return
> +  // CHECK-CC1-NEXT: COMPLETION: short
> +  // CHECK-CC1-NEXT: COMPLETION: signed
> +  // CHECK-CC1-NEXT: COMPLETION: Pattern : [#size_t#]sizeof(<#expression-or-type#>)
> +  // CHECK-CC1-NEXT: COMPLETION: Pattern : [#size_t#]sizeof...(<#parameter-pack#>)
> +  // CHECK-CC1-NEXT: COMPLETION: static
> +  // CHECK-CC1-NEXT: COMPLETION: Pattern : static_cast<<#type#>>(<#expression#>)
> +  // CHECK-CC1-NEXT: COMPLETION: struct
> +  // CHECK-CC1-NEXT: COMPLETION: Pattern : switch(<#condition#>){
> +  // CHECK-CC1: COMPLETION: t : t
> +  // CHECK-CC1-NEXT: COMPLETION: Pattern : [#void#]throw <#expression#>
> +  // CHECK-CC1-NEXT: COMPLETION: Pattern : [#bool#]true
> +  // CHECK-CC1-NEXT: COMPLETION: Pattern : try{<#statements#>
> +  // CHECK-CC1: COMPLETION: TYPEDEF : TYPEDEF
> +  // CHECK-CC1-NEXT: COMPLETION: Pattern : typedef <#type#> <#name#>
> +  // CHECK-CC1-NEXT: COMPLETION: Pattern : [#std::type_info#]typeid(<#expression-or-type#>)
> +  // CHECK-CC1-NEXT: COMPLETION: Pattern : typename <#qualifier#>::<#name#>
> +  // CHECK-CC1-NEXT: COMPLETION: Pattern : typeof <#expression#>
> +  // CHECK-CC1-NEXT: COMPLETION: Pattern : typeof(<#type#>)
> +  // CHECK-CC1-NEXT: COMPLETION: union
> +  // CHECK-CC1-NEXT: COMPLETION: unsigned
> +  // CHECK-CC1-NEXT: COMPLETION: Pattern : using namespace <#identifier#>
> +  // CHECK-CC1-NEXT: COMPLETION: void
> +  // CHECK-CC1-NEXT: COMPLETION: volatile
> +  // CHECK-CC1-NEXT: COMPLETION: wchar_t
> +  // CHECK-CC1-NEXT: COMPLETION: Pattern : while(<#condition#>){<#statements#>
> +  // CHECK-CC1: COMPLETION: X : X
> +  // CHECK-CC1-NEXT: COMPLETION: y : [#int#]y
> +  // CHECK-CC1-NEXT: COMPLETION: z : [#void#]z(<#int#>)
> +
> +  // 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
> +  // CHECK-CC2: COMPLETION: Pattern : asm(<#string-literal#>)
> +  // CHECK-CC2: COMPLETION: auto
> +  // CHECK-CC2-NEXT: COMPLETION: bool
> +  // CHECK-CC2-NEXT: COMPLETION: char
> +  // CHECK-CC2-NEXT: COMPLETION: char16
> +  // CHECK-CC2-NEXT: COMPLETION: char32
> +  // CHECK-CC2-NEXT: COMPLETION: class
> +  // CHECK-CC2-NEXT: COMPLETION: const
> +  // CHECK-CC2-NEXT: COMPLETION: Pattern : decltype(<#expression#>)
> +  // CHECK-CC2-NEXT: COMPLETION: double
> +  // CHECK-CC2-NEXT: COMPLETION: enum
> +  // CHECK-CC2-NEXT: COMPLETION: extern
> +  // CHECK-CC2-NEXT: COMPLETION: float
> +  // CHECK-CC2-NEXT: COMPLETION: inline
> +  // CHECK-CC2-NEXT: COMPLETION: int
> +  // CHECK-CC2-NEXT: COMPLETION: long
> +  // CHECK-CC2-NEXT: COMPLETION: Pattern : namespace <#identifier#>{<#declarations#>
> +  // CHECK-CC2: COMPLETION: Pattern : namespace <#name#> = <#namespace#>
> +  // CHECK-CC2-NEXT: COMPLETION: operator
> +  // CHECK-CC2-NEXT: COMPLETION: short
> +  // CHECK-CC2-NEXT: COMPLETION: signed
> +  // CHECK-CC2-NEXT: COMPLETION: static
> +  // CHECK-CC2-NEXT: COMPLETION: struct
> +  // CHECK-CC2-NEXT: COMPLETION: t : t
> +  // CHECK-CC2-NEXT: COMPLETION: Pattern : template <#declaration#>
> +  // CHECK-CC2-NEXT: COMPLETION: Pattern : template<<#parameters#>>
> +  // CHECK-CC2-NEXT: COMPLETION: TYPEDEF : TYPEDEF
> +  // CHECK-CC2-NEXT: COMPLETION: Pattern : typedef <#type#> <#name#>
> +  // CHECK-CC2-NEXT: COMPLETION: Pattern : typename <#qualifier#>::<#name#>
> +  // CHECK-CC2-NEXT: COMPLETION: Pattern : typeof <#expression#>
> +  // CHECK-CC2-NEXT: COMPLETION: Pattern : typeof(<#type#>)
> +  // CHECK-CC2-NEXT: COMPLETION: union
> +  // CHECK-CC2-NEXT: COMPLETION: unsigned
> +  // CHECK-CC2-NEXT: COMPLETION: Pattern : using namespace <#identifier#>
> +  // CHECK-CC2-NEXT: COMPLETION: Pattern : using <#qualifier#>::<#name#>
> +  // CHECK-CC2-NEXT: COMPLETION: void
> +  // CHECK-CC2-NEXT: COMPLETION: volatile
> +  // CHECK-CC2-NEXT: COMPLETION: wchar_t
> +  // CHECK-CC2-NEXT: COMPLETION: X : X
> +
> +  // 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
> +  // CHECK-CC3: COMPLETION: bool
> +  // CHECK-CC3-NEXT: COMPLETION: char
> +  // CHECK-CC3-NEXT: COMPLETION: char16_t
> +  // CHECK-CC3-NEXT: COMPLETION: char32_t
> +  // CHECK-CC3-NEXT: COMPLETION: class
> +  // CHECK-CC3-NEXT: COMPLETION: const
> +  // CHECK-CC3-NEXT: COMPLETION: Pattern : decltype(<#expression#>)
> +  // CHECK-CC3-NEXT: COMPLETION: double
> +  // CHECK-CC3-NEXT: COMPLETION: enum
> +  // CHECK-CC3-NEXT: COMPLETION: explicit
> +  // CHECK-CC3-NEXT: COMPLETION: extern
> +  // CHECK-CC3-NEXT: COMPLETION: float
> +  // CHECK-CC3-NEXT: COMPLETION: friend
> +  // CHECK-CC3-NEXT: COMPLETION: inline
> +  // CHECK-CC3-NEXT: COMPLETION: int
> +  // CHECK-CC3-NEXT: COMPLETION: long
> +  // CHECK-CC3-NEXT: COMPLETION: mutable
> +  // CHECK-CC3-NEXT: COMPLETION: operator
> +  // CHECK-CC3-NEXT: COMPLETION: Pattern : private: 
> +  // CHECK-CC3-NEXT: COMPLETION: Pattern : protected: 
> +  // CHECK-CC3-NEXT: COMPLETION: Pattern : public: 
> +  // CHECK-CC3-NEXT: COMPLETION: short
> +  // CHECK-CC3-NEXT: COMPLETION: signed
> +  // CHECK-CC3-NEXT: COMPLETION: static
> +  // CHECK-CC3-NEXT: COMPLETION: struct
> +  // CHECK-CC3-NEXT: COMPLETION: Pattern : template<<#parameters#>>
> +  // CHECK-CC3-NEXT: COMPLETION: Pattern : typedef <#type#> <#name#>
> +  // CHECK-CC3-NEXT: COMPLETION: Pattern : typename <#qualifier#>::<#name#>
> +  // CHECK-CC3-NEXT: COMPLETION: Pattern : typeof <#expression#>
> +  // CHECK-CC3-NEXT: COMPLETION: Pattern : typeof(<#type#>)
> +  // CHECK-CC3-NEXT: COMPLETION: union
> +  // CHECK-CC3-NEXT: COMPLETION: unsigned
> +  // CHECK-CC3-NEXT: COMPLETION: Pattern : using <#qualifier#>::<#name#>
> +  // CHECK-CC3-NEXT: COMPLETION: virtual
> +  // CHECK-CC3-NEXT: COMPLETION: void
> +  // CHECK-CC3-NEXT: COMPLETION: volatile
> +  // CHECK-CC3-NEXT: COMPLETION: wchar_t
> +  // CHECK-CC3-NEXT: COMPLETION: X : X
> +
> +  // 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
> +  // CHECK-CC4: COMPLETION: bool
> +  // CHECK-CC4-NEXT: COMPLETION: char
> +  // CHECK-CC4-NEXT: COMPLETION: char16_t
> +  // CHECK-CC4-NEXT: COMPLETION: char32_t
> +  // CHECK-CC4-NEXT: COMPLETION: class
> +  // CHECK-CC4-NEXT: COMPLETION: const
> +  // CHECK-CC4-NEXT: COMPLETION: Pattern : const_cast<<#type#>>(<#expression#>)
> +  // CHECK-CC4-NEXT: COMPLETION: Pattern : decltype(<#expression#>)
> +  // CHECK-CC4-NEXT: COMPLETION: Pattern : [#void#]delete <#expression#>
> +  // CHECK-CC4-NEXT: COMPLETION: Pattern : [#void#]delete [] <#expression#>
> +  // CHECK-CC4-NEXT: COMPLETION: double
> +  // CHECK-CC4-NEXT: COMPLETION: Pattern : dynamic_cast<<#type#>>(<#expression#>)
> +  // CHECK-CC4-NEXT: COMPLETION: enum
> +  // CHECK-CC4-NEXT: COMPLETION: Pattern : [#bool#]false
> +  // CHECK-CC4-NEXT: COMPLETION: float
> +  // CHECK-CC4-NEXT: COMPLETION: foo : [#void#]foo()
> +  // CHECK-CC4-NEXT: COMPLETION: int
> +  // CHECK-CC4-NEXT: COMPLETION: long
> +  // CHECK-CC4-NEXT: COMPLETION: Pattern : new <#type#>(<#expressions#>)
> +  // CHECK-CC4-NEXT: COMPLETION: Pattern : new <#type#>[<#size#>](<#expressions#>)
> +  // CHECK-CC4-NEXT: COMPLETION: Pattern : [#bool#]noexcept(<#expression#>)
> +  // CHECK-CC4-NEXT: COMPLETION: Pattern : [#std::nullptr_t#]nullptr
> +  // CHECK-CC4-NEXT: COMPLETION: operator
> +  // CHECK-CC4-NEXT: COMPLETION: Pattern : reinterpret_cast<<#type#>>(<#expression#>)
> +  // CHECK-CC4-NEXT: COMPLETION: short
> +  // CHECK-CC4-NEXT: COMPLETION: signed
> +  // CHECK-CC4-NEXT: COMPLETION: Pattern : [#size_t#]sizeof(<#expression-or-type#>)
> +  // CHECK-CC4-NEXT: COMPLETION: Pattern : [#size_t#]sizeof...(<#parameter-pack#>)
> +  // CHECK-CC4-NEXT: COMPLETION: Pattern : static_cast<<#type#>>(<#expression#>)
> +  // CHECK-CC4-NEXT: COMPLETION: struct
> +  // CHECK-CC4-NEXT: COMPLETION: t : t
> +  // CHECK-CC4-NEXT: COMPLETION: Pattern : [#void#]throw <#expression#>
> +  // CHECK-CC4-NEXT: COMPLETION: Pattern : [#bool#]true
> +  // CHECK-CC4-NEXT: COMPLETION: TYPEDEF : TYPEDEF
> +  // CHECK-CC4-NEXT: COMPLETION: Pattern : [#std::type_info#]typeid(<#expression-or-type#>)
> +  // CHECK-CC4-NEXT: COMPLETION: Pattern : typename <#qualifier#>::<#name#>
> +  // CHECK-CC4-NEXT: COMPLETION: Pattern : typeof <#expression#>
> +  // CHECK-CC4-NEXT: COMPLETION: Pattern : typeof(<#type#>)
> +  // CHECK-CC4-NEXT: COMPLETION: union
> +  // CHECK-CC4-NEXT: COMPLETION: unsigned
> +  // CHECK-CC4-NEXT: COMPLETION: void
> +  // CHECK-CC4-NEXT: COMPLETION: volatile
> +  // CHECK-CC4-NEXT: COMPLETION: wchar_t
> +  // CHECK-CC4-NEXT: COMPLETION: X : X
> +  // CHECK-CC4-NEXT: COMPLETION: y : [#int#]y
> +  // CHECK-CC4-NEXT: COMPLETION: z : [#void#]z(<#int#>)
> +
> +  // 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
> +  // CHECK-NO-RTTI: COMPLETION: bool
> +  // CHECK-NO-RTTI-NEXT: COMPLETION: char
> +  // CHECK-NO-RTTI-NEXT: COMPLETION: char16_t
> +  // CHECK-NO-RTTI-NEXT: COMPLETION: char32_t
> +  // CHECK-NO-RTTI-NEXT: COMPLETION: class
> +  // CHECK-NO-RTTI-NEXT: COMPLETION: const
> +  // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : const_cast<<#type#>>(<#expression#>)
> +  // CHECK-NO-RTTI: COMPLETION: Pattern : [#void#]delete <#expression#>
> +  // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : [#void#]delete [] <#expression#>
> +  // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : do{<#statements#>
> +  // CHECK-NO-RTTI: COMPLETION: double
> +  // CHECK-NO-RTTI-NOT: dynamic_cast
> +  // CHECK-NO-RTTI: COMPLETION: enum
> +  // CHECK-NO-RTTI-NEXT: COMPLETION: extern
> +  // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : [#bool#]false
> +  // CHECK-NO-RTTI-NEXT: COMPLETION: float
> +  // CHECK-NO-RTTI-NEXT: COMPLETION: foo : [#void#]foo()
> +  // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : for(<#init-statement#>;<#condition#>;<#inc-expression#>){
> +  // CHECK-NO-RTTI: COMPLETION: Pattern : goto <#label#>
> +  // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : if(<#condition#>){<#statements#>
> +  // CHECK-NO-RTTI: COMPLETION: int
> +  // CHECK-NO-RTTI-NEXT: COMPLETION: long
> +  // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : new <#type#>(<#expressions#>)
> +  // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : new <#type#>[<#size#>](<#expressions#>)
> +  // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : [#bool#]noexcept(<#expression#>)
> +  // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : [#std::nullptr_t#]nullptr
> +  // CHECK-NO-RTTI-NEXT: COMPLETION: operator
> +  // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : reinterpret_cast<<#type#>>(<#expression#>)
> +  // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : return
> +  // CHECK-NO-RTTI-NEXT: COMPLETION: short
> +  // CHECK-NO-RTTI-NEXT: COMPLETION: signed
> +  // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : [#size_t#]sizeof(<#expression-or-type#>)
> +  // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : [#size_t#]sizeof...(<#parameter-pack#>)
> +  // CHECK-NO-RTTI-NEXT: COMPLETION: static
> +  // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : static_cast<<#type#>>(<#expression#>)
> +  // CHECK-NO-RTTI-NEXT: COMPLETION: struct
> +  // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : switch(<#condition#>){
> +  // CHECK-NO-RTTI: COMPLETION: t : t
> +  // CHECK-NO-RTTI-NOT: throw
> +  // CHECK-NO-RTTI: COMPLETION: Pattern : [#bool#]true
> +  // CHECK-NO-RTTI-NOT: try
> +  // CHECK-NO-RTTI: COMPLETION: TYPEDEF : TYPEDEF
> +  // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : typedef <#type#> <#name#>
> +  // CHECK-NO-RTTI-NOT: typeid
> +  // CHECK-NO-RTTI: COMPLETION: Pattern : typename <#qualifier#>::<#name#>
> +  // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : typeof <#expression#>
> +  // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : typeof(<#type#>)
> +  // CHECK-NO-RTTI-NEXT: COMPLETION: union
> +  // CHECK-NO-RTTI-NEXT: COMPLETION: unsigned
> +  // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : using namespace <#identifier#>
> +  // CHECK-NO-RTTI-NEXT: COMPLETION: void
> +  // CHECK-NO-RTTI-NEXT: COMPLETION: volatile
> +  // CHECK-NO-RTTI-NEXT: COMPLETION: wchar_t
> +  // CHECK-NO-RTTI-NEXT: COMPLETION: Pattern : while(<#condition#>){<#statements#>
> +  // CHECK-NO-RTTI: COMPLETION: X : X
> +  // CHECK-NO-RTTI-NEXT: COMPLETION: y : [#int#]y
> +  // CHECK-NO-RTTI-NEXT: COMPLETION: z : [#void#]z(<#int#>)


More information about the cfe-commits mailing list