summaryrefslogtreecommitdiffstats
path: root/test/Lexer
diff options
context:
space:
mode:
Diffstat (limited to 'test/Lexer')
-rw-r--r--test/Lexer/bcpl-escaped-newline.c2
-rw-r--r--test/Lexer/block_cmt_end.c10
-rw-r--r--test/Lexer/constants.c6
-rw-r--r--test/Lexer/cxx-features.cpp36
-rw-r--r--test/Lexer/cxx1z-trigraphs.cpp2
-rw-r--r--test/Lexer/escape_newline.c8
-rw-r--r--test/Lexer/has_extension.c12
-rw-r--r--test/Lexer/has_feature_c1x.c22
-rw-r--r--test/Lexer/has_feature_cxx0x.cpp10
-rw-r--r--test/Lexer/ms-compatibility.c11
-rw-r--r--test/Lexer/string-literal-errors.cpp2
-rw-r--r--test/Lexer/utf8-char-literal.cpp9
-rw-r--r--test/Lexer/wchar-signedness.c1
13 files changed, 109 insertions, 22 deletions
diff --git a/test/Lexer/bcpl-escaped-newline.c b/test/Lexer/bcpl-escaped-newline.c
index 05d4773..0883173 100644
--- a/test/Lexer/bcpl-escaped-newline.c
+++ b/test/Lexer/bcpl-escaped-newline.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -Eonly -trigraphs %s
+// RUN: %clang_cc1 -Eonly -ftrigraphs %s
// RUN: %clang_cc1 -Eonly -verify %s
//\
diff --git a/test/Lexer/block_cmt_end.c b/test/Lexer/block_cmt_end.c
index f54b6a4..1d00137 100644
--- a/test/Lexer/block_cmt_end.c
+++ b/test/Lexer/block_cmt_end.c
@@ -1,9 +1,9 @@
/*
- RUN: %clang_cc1 -E -trigraphs %s | grep bar
- RUN: %clang_cc1 -E -trigraphs %s | grep foo
- RUN: %clang_cc1 -E -trigraphs %s | not grep qux
- RUN: %clang_cc1 -E -trigraphs %s | not grep xyz
- RUN: %clang_cc1 -fsyntax-only -trigraphs -verify %s
+ RUN: %clang_cc1 -E -ftrigraphs %s | grep bar
+ RUN: %clang_cc1 -E -ftrigraphs %s | grep foo
+ RUN: %clang_cc1 -E -ftrigraphs %s | not grep qux
+ RUN: %clang_cc1 -E -ftrigraphs %s | not grep xyz
+ RUN: %clang_cc1 -fsyntax-only -ftrigraphs -verify %s
*/
// This is a simple comment, /*/ does not end a comment, the trailing */ does.
diff --git a/test/Lexer/constants.c b/test/Lexer/constants.c
index f0cd4d7..9c84ddc 100644
--- a/test/Lexer/constants.c
+++ b/test/Lexer/constants.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -pedantic -trigraphs %s
+// RUN: %clang_cc1 -fsyntax-only -verify -pedantic -ftrigraphs %s
int x = 000000080; // expected-error {{invalid digit}}
@@ -15,9 +15,9 @@ float Y = 08.123456;
#endif
#if -01000000000000000000000 // should not warn.
#endif
-#if 9223372036854775808 // expected-warning {{integer constant is larger than the largest signed integer type}}
+#if 9223372036854775808 // expected-warning {{integer literal is too large to be represented in a signed integer type, interpreting as unsigned}}
#endif
-#if 0x10000000000000000 // expected-error {{integer constant is larger than the largest unsigned integer type}}
+#if 0x10000000000000000 // expected-error {{integer literal is too large to be represented in any integer type}}
#endif
int c[] = {
diff --git a/test/Lexer/cxx-features.cpp b/test/Lexer/cxx-features.cpp
index 1202ecb..670a105 100644
--- a/test/Lexer/cxx-features.cpp
+++ b/test/Lexer/cxx-features.cpp
@@ -16,6 +16,10 @@
#error "wrong value for __cpp_binary_literals"
#endif
+#if check(digit_separators, 0, 0, 201309)
+#error "wrong value for __cpp_digit_separators"
+#endif
+
#if check(init_captures, 0, 0, 201304)
#error "wrong value for __cpp_init_captures"
#endif
@@ -24,6 +28,10 @@
#error "wrong value for __cpp_generic_lambdas"
#endif
+#if check(sized_deallocation, 0, 0, 201309)
+#error "wrong value for __cpp_sized_deallocation"
+#endif
+
#if check(constexpr, 0, 200704, 201304)
#error "wrong value for __cpp_constexpr"
#endif
@@ -68,6 +76,10 @@
#error "wrong value for __cpp_lambdas"
#endif
+#if check(range_based_for, 0, 200907, 200907)
+#error "wrong value for __cpp_range_based_for"
+#endif
+
#if check(static_assert, 0, 200410, 200410)
#error "wrong value for __cpp_static_assert"
#endif
@@ -87,3 +99,27 @@
#if check(variadic_templates, 0, 200704, 200704)
#error "wrong value for __cpp_variadic_templates"
#endif
+
+#if check(initializer_lists, 0, 200806, 200806)
+#error "wrong value for __cpp_initializer_lists"
+#endif
+
+#if check(delegating_constructors, 0, 200604, 200604)
+#error "wrong value for __cpp_delegating_constructors"
+#endif
+
+#if check(nsdmi, 0, 200809, 200809)
+#error "wrong value for __cpp_nsdmi"
+#endif
+
+#if check(inheriting_constructors, 0, 200802, 200802)
+#error "wrong value for __cpp_inheriting_constructors"
+#endif
+
+#if check(ref_qualifiers, 0, 200710, 200710)
+#error "wrong value for __cpp_ref_qualifiers"
+#endif
+
+#if check(alias_templates, 0, 200704, 200704)
+#error "wrong value for __cpp_alias_templates"
+#endif
diff --git a/test/Lexer/cxx1z-trigraphs.cpp b/test/Lexer/cxx1z-trigraphs.cpp
index 410626f..0ea2adb 100644
--- a/test/Lexer/cxx1z-trigraphs.cpp
+++ b/test/Lexer/cxx1z-trigraphs.cpp
@@ -1,5 +1,5 @@
// RUN: %clang_cc1 -std=c++1z %s -verify
-// RUN: %clang_cc1 -std=c++1z %s -trigraphs -fsyntax-only
+// RUN: %clang_cc1 -std=c++1z %s -ftrigraphs -fsyntax-only
??= define foo ; // expected-error {{}} expected-warning {{trigraph ignored}}
diff --git a/test/Lexer/escape_newline.c b/test/Lexer/escape_newline.c
index d0f27df..9fc73dc 100644
--- a/test/Lexer/escape_newline.c
+++ b/test/Lexer/escape_newline.c
@@ -1,7 +1,7 @@
-// RUN: %clang_cc1 -E -trigraphs %s | grep -- ' ->'
-// RUN: %clang_cc1 -E -trigraphs %s 2>&1 | grep 'backslash and newline separated by space'
-// RUN: %clang_cc1 -E -trigraphs %s 2>&1 | grep 'trigraph converted'
-// RUN: %clang_cc1 -E -CC -trigraphs %s
+// RUN: %clang_cc1 -E -ftrigraphs %s | grep -- ' ->'
+// RUN: %clang_cc1 -E -ftrigraphs %s 2>&1 | grep 'backslash and newline separated by space'
+// RUN: %clang_cc1 -E -ftrigraphs %s 2>&1 | grep 'trigraph converted'
+// RUN: %clang_cc1 -E -CC -ftrigraphs %s
// This is an ugly way to spell a -> token.
-??/
diff --git a/test/Lexer/has_extension.c b/test/Lexer/has_extension.c
index 3b08510..b7efece 100644
--- a/test/Lexer/has_extension.c
+++ b/test/Lexer/has_extension.c
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -E %s -o - | FileCheck --check-prefix=CHECK-PED-NONE %s
-// RUN: %clang_cc1 -pedantic-errors -E %s -o - | FileCheck --check-prefix=CHECK-PED-ERR %s
+// RUN: %clang_cc1 -std=c99 -E %s -o - | FileCheck --check-prefix=CHECK-PED-NONE %s
+// RUN: %clang_cc1 -std=c99 -pedantic-errors -E %s -o - | FileCheck --check-prefix=CHECK-PED-ERR %s
// CHECK-PED-NONE: no_dummy_extension
#if !__has_extension(dummy_extension)
@@ -36,6 +36,14 @@ int has_c_alignas();
int no_c_alignas();
#endif
+// CHECK-PED-NONE: has_c_alignof
+// CHECK-PED-ERR: no_c_alignof
+#if __has_extension(c_alignof)
+int has_c_alignof();
+#else
+int no_c_alignof();
+#endif
+
// Arbitrary feature to test that the extension name can be surrounded with
// double underscores.
// CHECK-PED-NONE: has_double_underscores
diff --git a/test/Lexer/has_feature_c1x.c b/test/Lexer/has_feature_c1x.c
index e26e309..ff17780 100644
--- a/test/Lexer/has_feature_c1x.c
+++ b/test/Lexer/has_feature_c1x.c
@@ -1,12 +1,17 @@
-// RUN: %clang_cc1 -E -triple x86_64-linux-gnu -std=c1x %s -o - | FileCheck --check-prefix=CHECK-1X %s
-// RUN: %clang_cc1 -E %s -o - | FileCheck --check-prefix=CHECK-NO-1X %s
+// RUN: %clang_cc1 -E -triple x86_64-linux-gnu -std=c89 %s -o - | FileCheck --check-prefix=CHECK-NO-1X %s
+// RUN: %clang_cc1 -E -triple x86_64-linux-gnu -std=iso9899:199409 %s -o - | FileCheck --check-prefix=CHECK-NO-1X %s
+// RUN: %clang_cc1 -E -triple x86_64-linux-gnu -std=c99 %s -o - | FileCheck --check-prefix=CHECK-NO-1X %s
+// RUN: %clang_cc1 -E -triple x86_64-linux-gnu -std=c11 %s -o - | FileCheck --check-prefix=CHECK-1X %s
+//
+// RUN: %clang_cc1 -E -triple x86_64-linux-gnu -std=gnu89 %s -o - | FileCheck --check-prefix=CHECK-NO-1X %s
+// RUN: %clang_cc1 -E -triple x86_64-linux-gnu -std=gnu99 %s -o - | FileCheck --check-prefix=CHECK-NO-1X %s
+// RUN: %clang_cc1 -E -triple x86_64-linux-gnu -std=gnu11 %s -o - | FileCheck --check-prefix=CHECK-1X %s
#if __has_feature(c_atomic)
int has_atomic();
#else
int no_atomic();
#endif
-
// CHECK-1X: has_atomic
// CHECK-NO-1X: no_atomic
@@ -15,7 +20,6 @@ int has_static_assert();
#else
int no_static_assert();
#endif
-
// CHECK-1X: has_static_assert
// CHECK-NO-1X: no_static_assert
@@ -24,7 +28,6 @@ int has_generic_selections();
#else
int no_generic_selections();
#endif
-
// CHECK-1X: has_generic_selections
// CHECK-NO-1X: no_generic_selections
@@ -33,10 +36,17 @@ int has_alignas();
#else
int no_alignas();
#endif
-
// CHECK-1X: has_alignas
// CHECK-NO-1X: no_alignas
+#if __has_feature(c_alignof)
+int has_alignof();
+#else
+int no_alignof();
+#endif
+// CHECK-1X: has_alignof
+// CHECK-NO-1X: no_alignof
+
#if __has_feature(c_thread_local)
int has_thread_local();
#else
diff --git a/test/Lexer/has_feature_cxx0x.cpp b/test/Lexer/has_feature_cxx0x.cpp
index e558f88..9fb05de 100644
--- a/test/Lexer/has_feature_cxx0x.cpp
+++ b/test/Lexer/has_feature_cxx0x.cpp
@@ -234,6 +234,16 @@ int no_alignas();
// CHECK-11: has_alignas
// CHECK-NO-11: no_alignas
+#if __has_feature(cxx_alignof)
+int has_alignof();
+#else
+int no_alignof();
+#endif
+
+// CHECK-1Y: has_alignof
+// CHECK-11: has_alignof
+// CHECK-NO-11: no_alignof
+
#if __has_feature(cxx_raw_string_literals)
int has_raw_string_literals();
#else
diff --git a/test/Lexer/ms-compatibility.c b/test/Lexer/ms-compatibility.c
new file mode 100644
index 0000000..d159ad1
--- /dev/null
+++ b/test/Lexer/ms-compatibility.c
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -fsyntax-only -E -fms-compatibility %s | FileCheck --check-prefix=CHECK-MS-COMPAT %s
+// RUN: %clang_cc1 -fsyntax-only -E %s | FileCheck --check-prefix=CHECK-NO-MS-COMPAT %s
+
+#define FN(x) L#x
+#define F L "aaa"
+void *v1 = FN(aaa);
+void *v2 = F;
+// CHECK-MS-COMPAT: void *v1 = L"aaa";
+// CHECK-MS-COMPAT: void *v2 = L "aaa";
+// CHECK-NO-MS-COMPAT: void *v1 = L "aaa";
+// CHECK-NO-MS-COMPAT: void *v2 = L "aaa";
diff --git a/test/Lexer/string-literal-errors.cpp b/test/Lexer/string-literal-errors.cpp
index d8e2993..223dca4 100644
--- a/test/Lexer/string-literal-errors.cpp
+++ b/test/Lexer/string-literal-errors.cpp
@@ -23,3 +23,5 @@ void foo() {
// CHECK: {{^ \^~$}}
// CHECK: {{^ \^~$}}
}
+
+#define foo() lots and lots of tokens, need at least 8 to fill up the smallvector buffer #BadThingsHappenNow
diff --git a/test/Lexer/utf8-char-literal.cpp b/test/Lexer/utf8-char-literal.cpp
index 7a4d126..0ddaabc 100644
--- a/test/Lexer/utf8-char-literal.cpp
+++ b/test/Lexer/utf8-char-literal.cpp
@@ -1,6 +1,15 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -fsyntax-only -verify %s
// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c11 -x c -fsyntax-only -verify %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++1z -fsyntax-only -verify %s
int array0[u'ñ' == u'\xf1'? 1 : -1];
int array1['\xF1' != u'\xf1'? 1 : -1];
int array1['ñ' != u'\xf1'? 1 : -1]; // expected-error {{character too large for enclosing character literal type}}
+#if __cplusplus > 201402L
+char a = u8'ñ'; // expected-error {{character too large for enclosing character literal type}}
+char b = u8'\x80'; // ok
+char c = u8'\u0080'; // expected-error {{character too large for enclosing character literal type}}
+char d = u8'\u1234'; // expected-error {{character too large for enclosing character literal type}}
+char e = u8'ሴ'; // expected-error {{character too large for enclosing character literal type}}
+char f = u8'ab'; // expected-error {{Unicode character literals may not contain multiple characters}}
+#endif
diff --git a/test/Lexer/wchar-signedness.c b/test/Lexer/wchar-signedness.c
index b5d4ac8..1d8bc4d 100644
--- a/test/Lexer/wchar-signedness.c
+++ b/test/Lexer/wchar-signedness.c
@@ -1,5 +1,6 @@
// RUN: %clang_cc1 -fsyntax-only -dM -E %s -triple x86_64-none-linux-gnu | FileCheck %s --check-prefix=CHECK-X86
// RUN: %clang_cc1 -fsyntax-only -dM -E %s -triple armv7-none-eabi | FileCheck %s --check-prefix=CHECK-ARM
+// RUN: %clang_cc1 -fsyntax-only -dM -E %s -triple thumbv7-none-eabi | FileCheck %s --check-prefix=CHECK-ARM
// CHECK-X86-NOT: #define __WCHAR_UNSIGNED__
// CHECK-X86: #define __WINT_UNSIGNED__ 1
OpenPOWER on IntegriCloud