[Tests] Modified Lit Tests to be C++11 compatibile

This 2nd patch should not change the test results, but it is useful if clang's
default C++ language is ever changed from gnu++98.

llvm-svn: 246183
This commit is contained in:
Charles Li 2015-08-27 18:49:15 +00:00
parent 8d3ad6b617
commit 430db1e717
5 changed files with 317 additions and 23 deletions

View File

@ -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)]

View File

@ -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#>)

View File

@ -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

View File

@ -1,18 +1,50 @@
// RUN: %clang_cc1 -fsyntax-only -verify -triple x86_64-apple-darwin10 %s
// 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 (__cplusplus <= 199711L) // C or C++03 or earlier modes
// expected-warning@-2 {{overflow in expression; result is -2147483647 with type 'int'}}
#else
// expected-error@-4 {{case value is not a constant expression}} \
// expected-note@-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 (__cplusplus <= 199711L)
// expected-warning@-2 {{overflow in expression; result is -4 with type 'long'}}
#else
// expected-error@-4 {{case value is not a constant expression}} \
// expected-note@-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 (__cplusplus <= 199711L)
// expected-warning@-2 {{overflow in expression; result is -1375982336 with type 'int'}}
#else
// expected-error@-4 {{case value is not a constant expression}} \
// expected-note@-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 (__cplusplus <= 199711L)
// expected-warning@-2 {{overflow in expression; result is -4 with type 'int'}}
#else
// expected-error@-4 {{case value is not a constant expression}} \
// expected-note@-4 {{value 8589934588 is outside the range of representable values of type 'int'}}
#endif
case (2147483647*4)%4:
#if (__cplusplus <= 199711L)
// expected-warning@-2 {{overflow in expression; result is -4 with type 'int'}}
#else
// expected-error@-4 {{case value is not a constant expression}} \
// expected-note@-4 {{value 8589934588 is outside the range of representable values of type 'int'}}
#endif
return 4;
case 2147483647:
return 0;

View File

@ -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