summaryrefslogtreecommitdiff
path: root/clang/test/Lexer
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/Lexer')
-rw-r--r--clang/test/Lexer/11-27-2007-FloatLiterals.c13
-rw-r--r--clang/test/Lexer/badstring_in_if0.c8
-rw-r--r--clang/test/Lexer/bcpl-escaped-newline.c12
-rw-r--r--clang/test/Lexer/block_cmt_end.c34
-rw-r--r--clang/test/Lexer/c90.c34
-rw-r--r--clang/test/Lexer/char-escapes.c22
-rw-r--r--clang/test/Lexer/char-literal-encoding-error.c15
-rw-r--r--clang/test/Lexer/char-literal.cpp24
-rw-r--r--clang/test/Lexer/clang-keywords.cpp3
-rw-r--r--clang/test/Lexer/comment-escape.c6
-rw-r--r--clang/test/Lexer/conflict-marker.c38
-rw-r--r--clang/test/Lexer/constants.c69
-rw-r--r--clang/test/Lexer/counter.c16
-rw-r--r--clang/test/Lexer/cxx0x_keyword.cpp2
-rw-r--r--clang/test/Lexer/cxx0x_keyword_as_cxx98.cpp36
-rw-r--r--clang/test/Lexer/cxx0x_raw_string_delim_length.cpp7
-rw-r--r--clang/test/Lexer/cxx0x_raw_string_unterminated.cpp4
-rw-r--r--clang/test/Lexer/digraph.c15
-rw-r--r--clang/test/Lexer/dollar-idents.c7
-rw-r--r--clang/test/Lexer/escape_newline.c11
-rw-r--r--clang/test/Lexer/gnu_keywords.c12
-rw-r--r--clang/test/Lexer/has_extension.c44
-rw-r--r--clang/test/Lexer/has_extension_cxx.cpp49
-rw-r--r--clang/test/Lexer/has_feature_address_sanitizer.cpp11
-rw-r--r--clang/test/Lexer/has_feature_c1x.c47
-rw-r--r--clang/test/Lexer/has_feature_cxx0x.cpp274
-rw-r--r--clang/test/Lexer/has_feature_exceptions.cpp11
-rw-r--r--clang/test/Lexer/has_feature_modules.m25
-rw-r--r--clang/test/Lexer/has_feature_objc_arc.m20
-rw-r--r--clang/test/Lexer/has_feature_rtti.cpp11
-rw-r--r--clang/test/Lexer/has_feature_type_traits.cpp111
-rw-r--r--clang/test/Lexer/hexfloat.cpp7
-rw-r--r--clang/test/Lexer/ms-extensions.c43
-rw-r--r--clang/test/Lexer/ms-extensions.cpp6
-rw-r--r--clang/test/Lexer/msdos-cpm-eof.c7
-rw-r--r--clang/test/Lexer/multiple-include.c27
-rw-r--r--clang/test/Lexer/newline-eof-c++11.cpp4
-rw-r--r--clang/test/Lexer/newline-eof-c++98-compat.cpp4
-rw-r--r--clang/test/Lexer/newline-eof.c5
-rw-r--r--clang/test/Lexer/numeric-literal-trash.c13
-rw-r--r--clang/test/Lexer/pragma-mark.c11
-rw-r--r--clang/test/Lexer/pragma-message.c14
-rw-r--r--clang/test/Lexer/pragma-operators.cpp20
-rw-r--r--clang/test/Lexer/preamble.c36
-rw-r--r--clang/test/Lexer/rdar-8914293.c7
-rw-r--r--clang/test/Lexer/rdr-6096838-2.c5
-rw-r--r--clang/test/Lexer/rdr-6096838.c6
-rw-r--r--clang/test/Lexer/string-literal-encoding.c33
-rw-r--r--clang/test/Lexer/string_concat.cpp33
-rw-r--r--clang/test/Lexer/token-concat-2.c4
-rw-r--r--clang/test/Lexer/token-concat.c4
-rw-r--r--clang/test/Lexer/token-concat.cpp19
-rw-r--r--clang/test/Lexer/unknown-char.c2
-rw-r--r--clang/test/Lexer/utf-16.c6
-rw-r--r--clang/test/Lexer/utf-16.c.txtbin0 -> 48 bytes
-rw-r--r--clang/test/Lexer/utf8-char-literal.cpp5
-rw-r--r--clang/test/Lexer/wchar.c12
57 files changed, 1324 insertions, 0 deletions
diff --git a/clang/test/Lexer/11-27-2007-FloatLiterals.c b/clang/test/Lexer/11-27-2007-FloatLiterals.c
new file mode 100644
index 0000000..f3d978b
--- /dev/null
+++ b/clang/test/Lexer/11-27-2007-FloatLiterals.c
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
+
+// CHECK: 0x3BFD83C940000000
+// CHECK: 2.000000e+{{[0]*}}32
+// CHECK: 0x3BFD83C940000000
+// CHECK: 2.000000e+{{[0]*}}32
+// CHECK: 0x7FF0000000000000
+
+float F = 1e-19f;
+double D = 2e32;
+float F2 = 01e-19f;
+double D2 = 02e32;
+float F3 = 0xFp100000000000000000000F;
diff --git a/clang/test/Lexer/badstring_in_if0.c b/clang/test/Lexer/badstring_in_if0.c
new file mode 100644
index 0000000..486dcf2
--- /dev/null
+++ b/clang/test/Lexer/badstring_in_if0.c
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -E %s 2>&1 | not grep error
+#if 0
+
+ "
+
+ '
+
+#endif
diff --git a/clang/test/Lexer/bcpl-escaped-newline.c b/clang/test/Lexer/bcpl-escaped-newline.c
new file mode 100644
index 0000000..4d4a7b5
--- /dev/null
+++ b/clang/test/Lexer/bcpl-escaped-newline.c
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -Eonly -trigraphs %s
+// RUN: %clang_cc1 -Eonly -verify %s
+
+//\
+#error bar
+
+//??/
+#error qux // expected-error {{qux}}
+
+// Trailing whitespace!
+//\
+#error quux
diff --git a/clang/test/Lexer/block_cmt_end.c b/clang/test/Lexer/block_cmt_end.c
new file mode 100644
index 0000000..f54b6a4
--- /dev/null
+++ b/clang/test/Lexer/block_cmt_end.c
@@ -0,0 +1,34 @@
+/*
+ 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
+*/
+
+// This is a simple comment, /*/ does not end a comment, the trailing */ does.
+int i = /*/ */ 1;
+
+/* qux
+
+next comment ends with normal escaped newline:
+*/
+
+/* expected-warning {{escaped newline}} expected-warning {{backslash and newline}} *\
+/
+
+int bar /* expected-error {{expected ';' after top level declarator}} */
+
+/* xyz
+
+next comment ends with a trigraph escaped newline: */
+
+/* expected-warning {{escaped newline between}} expected-warning {{backslash and newline separated by space}} expected-warning {{trigraph ends block comment}} *??/
+/
+
+foo
+
+
+// rdar://6060752 - We should not get warnings about trigraphs in comments:
+// '????'
+/* ???? */
diff --git a/clang/test/Lexer/c90.c b/clang/test/Lexer/c90.c
new file mode 100644
index 0000000..d910572
--- /dev/null
+++ b/clang/test/Lexer/c90.c
@@ -0,0 +1,34 @@
+/* RUN: %clang_cc1 -std=c90 -fsyntax-only %s -verify -pedantic-errors
+ */
+
+enum { cast_hex = (long) (
+ 0x0p-1 /* expected-error {{hexadecimal floating constants are a C99 feature}} */
+ ) };
+
+/* PR2477 */
+int test1(int a,int b) {return a//* This is a divide followed by block comment in c89 mode */
+b;}
+
+// comment accepted as extension /* expected-error {{// comments are not allowed in this language}}
+
+void test2() {
+ const char * str =
+ "sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds" // expected-error{{string literal of length 845 exceeds maximum length 509 that C90 compilers are required to support}}
+ "sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds"
+ "sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds"
+ "sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds"
+ "sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds"
+ "sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds"
+ "sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds"
+ "sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds"
+ "sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds"
+ "sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds"
+ "sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds"
+ "sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds"
+ "sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds";
+}
+
+void test3() {
+ (void)L"\u1234"; // expected-error {{unicode escape sequences are only valid in C99 or C++}}
+ (void)L'\u1234'; // expected-error {{unicode escape sequences are only valid in C99 or C++}}
+}
diff --git a/clang/test/Lexer/char-escapes.c b/clang/test/Lexer/char-escapes.c
new file mode 100644
index 0000000..32a1c61
--- /dev/null
+++ b/clang/test/Lexer/char-escapes.c
@@ -0,0 +1,22 @@
+// RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s
+
+int test['\\' == 92 ? 1 : -1];
+int test['\"' == 34 ? 1 : -1];
+int test['\'' == 39 ? 1 : -1];
+int test['\?' == 63 ? 1 : -1];
+int test['\a' == 7 ? 1 : -1];
+int test['\b' == 8 ? 1 : -1];
+int test['\e' == 27 ? 1 : -1]; // expected-warning {{non-standard escape}}
+int test['\E' == 27 ? 1 : -1]; // expected-warning {{non-standard escape}}
+int test['\f' == 12 ? 1 : -1];
+int test['\n' == 10 ? 1 : -1];
+int test['\r' == 13 ? 1 : -1];
+int test['\t' == 9 ? 1 : -1];
+int test['\v' == 11 ? 1 : -1];
+int test['\xa' == 10 ? 1 : -1];
+int test['\1' == 1 ? 1 : -1];
+int test['\(' == 40 ? 1 : -1]; // expected-warning {{non-standard escape}}
+int test['\{' == 123 ? 1 : -1]; // expected-warning {{non-standard escape}}
+int test['\[' == 91 ? 1 : -1]; // expected-warning {{non-standard escape}}
+int test['\%' == 37 ? 1 : -1]; // expected-warning {{non-standard escape}}
+const char *format = "abc \m def"; // expected-warning{{unknown escape sequence '\m'}}
diff --git a/clang/test/Lexer/char-literal-encoding-error.c b/clang/test/Lexer/char-literal-encoding-error.c
new file mode 100644
index 0000000..e752de2
--- /dev/null
+++ b/clang/test/Lexer/char-literal-encoding-error.c
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify -x c++ %s
+
+// This file is encoded using ISO-8859-1
+
+int main() {
+ (void)'é'; // expected-warning {{illegal character encoding in character literal}}
+ (void)u'é'; // expected-error {{illegal character encoding in character literal}}
+ (void)U'é'; // expected-error {{illegal character encoding in character literal}}
+ (void)L'é'; // expected-error {{illegal character encoding in character literal}}
+
+ // For narrow character literals, since there is no error, make sure the
+ // encoding is correct
+ static_assert((unsigned char)'é' == 0xE9, ""); // expected-warning {{illegal character encoding in character literal}}
+ static_assert('éé' == 0xE9E9, ""); // expected-warning {{illegal character encoding in character literal}} expected-warning {{multi-character character constant}}
+}
diff --git a/clang/test/Lexer/char-literal.cpp b/clang/test/Lexer/char-literal.cpp
new file mode 100644
index 0000000..5dc5360
--- /dev/null
+++ b/clang/test/Lexer/char-literal.cpp
@@ -0,0 +1,24 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -Wfour-char-constants -fsyntax-only -verify %s
+
+int a = 'ab'; // expected-warning {{multi-character character constant}}
+int b = '\xFF\xFF'; // expected-warning {{multi-character character constant}}
+int c = 'APPS'; // expected-warning {{multi-character character constant}}
+
+char d = '⌘'; // expected-error {{character too large for enclosing character literal type}}
+char e = '\u2318'; // expected-error {{character too large for enclosing character literal type}}
+
+auto f = '\xE2\x8C\x98'; // expected-warning {{multi-character character constant}}
+
+char16_t g = u'ab'; // expected-error {{Unicode character literals may not contain multiple characters}}
+char16_t h = u'\U0010FFFD'; // expected-error {{character too large for enclosing character literal type}}
+
+wchar_t i = L'ab'; // expected-warning {{extraneous characters in character constant ignored}}
+wchar_t j = L'\U0010FFFD';
+
+char32_t k = U'\U0010FFFD';
+
+char l = 'Ø'; // expected-error {{character too large for enclosing character literal type}}
+char m = '👿'; // expected-error {{character too large for enclosing character literal type}}
+
+char32_t n = U'ab'; // expected-error {{Unicode character literals may not contain multiple characters}}
+char16_t o = '👽'; // expected-error {{character too large for enclosing character literal type}}
diff --git a/clang/test/Lexer/clang-keywords.cpp b/clang/test/Lexer/clang-keywords.cpp
new file mode 100644
index 0000000..a349b44
--- /dev/null
+++ b/clang/test/Lexer/clang-keywords.cpp
@@ -0,0 +1,3 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+__char16_t c16;
+void f(__char32_t) { }
diff --git a/clang/test/Lexer/comment-escape.c b/clang/test/Lexer/comment-escape.c
new file mode 100644
index 0000000..191e654
--- /dev/null
+++ b/clang/test/Lexer/comment-escape.c
@@ -0,0 +1,6 @@
+// RUN: %clang -fsyntax-only %s
+// rdar://6757323
+// foo \
+
+#define blork 32
+
diff --git a/clang/test/Lexer/conflict-marker.c b/clang/test/Lexer/conflict-marker.c
new file mode 100644
index 0000000..2a8e43b
--- /dev/null
+++ b/clang/test/Lexer/conflict-marker.c
@@ -0,0 +1,38 @@
+// RUN: %clang_cc1 %s -verify -fsyntax-only
+
+// Test that we recover gracefully from conflict markers left in input files.
+// PR5238
+
+// diff3 style
+<<<<<<< .mine // expected-error {{version control conflict marker in file}}
+int x = 4;
+|||||||
+int x = 123;
+=======
+float x = 17;
+>>>>>>> .r91107
+
+// normal style.
+<<<<<<< .mine // expected-error {{version control conflict marker in file}}
+typedef int y;
+=======
+typedef struct foo *y;
+>>>>>>> .r91107
+
+// Perforce style.
+>>>> ORIGINAL conflict-marker.c#6 // expected-error {{version control conflict marker in file}}
+int z = 1;
+==== THEIRS conflict-marker.c#7
+int z = 0;
+==== YOURS conflict-marker.c
+int z = 2;
+<<<<
+
+;
+y b;
+
+
+int foo() {
+ y a = x;
+ return x + a - z;
+}
diff --git a/clang/test/Lexer/constants.c b/clang/test/Lexer/constants.c
new file mode 100644
index 0000000..2903885
--- /dev/null
+++ b/clang/test/Lexer/constants.c
@@ -0,0 +1,69 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -pedantic -trigraphs %s
+
+int x = 000000080; // expected-error {{invalid digit}}
+
+int y = 0000\
+00080; // expected-error {{invalid digit}}
+
+
+
+float X = 1.17549435e-38F;
+float Y = 08.123456;
+
+// PR2252
+#if -0x8000000000000000 // should not warn.
+#endif
+
+
+int c[] = {
+ 'df', // expected-warning {{multi-character character constant}}
+ '\t',
+ '\\
+t',
+ '??!', // expected-warning {{trigraph converted to '|' character}}
+ 'abcd' // expected-warning {{multi-character character constant}}
+};
+
+// PR4499
+int m0 = '0';
+int m1 = '\\\''; // expected-warning {{multi-character character constant}}
+int m2 = '\\\\'; // expected-warning {{multi-character character constant}}
+int m3 = '\\\
+';
+
+
+#pragma clang diagnostic ignored "-Wmultichar"
+
+int d = 'df'; // no warning.
+int e = 'abcd'; // still warn: expected-warning {{multi-character character constant}}
+
+#pragma clang diagnostic ignored "-Wfour-char-constants"
+
+int f = 'abcd'; // ignored.
+
+// rdar://problem/6974641
+float t0[] = {
+ 1.9e20f,
+ 1.9e-20f,
+ 1.9e50f, // expected-warning {{too large}}
+ 1.9e-50f, // expected-warning {{too small}}
+ -1.9e20f,
+ -1.9e-20f,
+ -1.9e50f, // expected-warning {{too large}}
+ -1.9e-50f // expected-warning {{too small}}
+};
+double t1[] = {
+ 1.9e50,
+ 1.9e-50,
+ 1.9e500, // expected-warning {{too large}}
+ 1.9e-500, // expected-warning {{too small}}
+ -1.9e50,
+ -1.9e-50,
+ -1.9e500, // expected-warning {{too large}}
+ -1.9e-500 // expected-warning {{too small}}
+};
+
+// PR7888
+double g = 1e100000000; // expected-warning {{too large}}
+
+char h = '\u1234'; // expected-error {{character too large for enclosing character literal type}}
diff --git a/clang/test/Lexer/counter.c b/clang/test/Lexer/counter.c
new file mode 100644
index 0000000..2173730
--- /dev/null
+++ b/clang/test/Lexer/counter.c
@@ -0,0 +1,16 @@
+// __COUNTER__ support: rdar://4329310
+// RUN: %clang -E %s > %t
+
+#define PASTE2(x,y) x##y
+#define PASTE1(x,y) PASTE2(x,y)
+#define UNIQUE(x) PASTE1(x,__COUNTER__)
+
+// RUN: grep "A: 0" %t
+A: __COUNTER__
+
+// RUN: grep "B: foo1" %t
+B: UNIQUE(foo);
+// RUN: grep "C: foo2" %t
+C: UNIQUE(foo);
+// RUN: grep "D: 3" %t
+D: __COUNTER__
diff --git a/clang/test/Lexer/cxx0x_keyword.cpp b/clang/test/Lexer/cxx0x_keyword.cpp
new file mode 100644
index 0000000..e6841ef
--- /dev/null
+++ b/clang/test/Lexer/cxx0x_keyword.cpp
@@ -0,0 +1,2 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s 2>&1
+int static_assert; /* expected-error {{expected unqualified-id}} */
diff --git a/clang/test/Lexer/cxx0x_keyword_as_cxx98.cpp b/clang/test/Lexer/cxx0x_keyword_as_cxx98.cpp
new file mode 100644
index 0000000..5d16810
--- /dev/null
+++ b/clang/test/Lexer/cxx0x_keyword_as_cxx98.cpp
@@ -0,0 +1,36 @@
+// RUN: %clang_cc1 %s -verify -fsyntax-only -Wc++11-compat
+
+#define constexpr const
+constexpr int x = 0;
+#undef constexpr
+
+namespace lib {
+ struct nullptr_t;
+ typedef nullptr_t nullptr; // expected-warning {{'nullptr' is a keyword in C++11}}
+}
+
+#define CONCAT(X,Y) CONCAT2(X,Y)
+#define CONCAT2(X,Y) X ## Y
+int CONCAT(constexpr,ession);
+
+#define ID(X) X
+extern int ID(decltype); // expected-warning {{'decltype' is a keyword in C++11}}
+
+extern int CONCAT(align,of); // expected-warning {{'alignof' is a keyword in C++11}}
+
+#define static_assert(b, s) int CONCAT(check, __LINE__)[(b) ? 1 : 0];
+static_assert(1 > 0, "hello"); // ok
+
+#define IF_CXX11(CXX11, CXX03) CXX03
+typedef IF_CXX11(char16_t, wchar_t) my_wide_char_t; // ok
+
+int alignas; // expected-warning {{'alignas' is a keyword in C++11}}
+int alignof; // already diagnosed in this TU
+int char16_t; // expected-warning {{'char16_t' is a keyword in C++11}}
+int char32_t; // expected-warning {{'char32_t' is a keyword in C++11}}
+int constexpr; // expected-warning {{'constexpr' is a keyword in C++11}}
+int decltype; // already diagnosed in this TU
+int noexcept; // expected-warning {{'noexcept' is a keyword in C++11}}
+int nullptr; // already diagnosed in this TU
+int static_assert; // expected-warning {{'static_assert' is a keyword in C++11}}
+int thread_local; // expected-warning {{'thread_local' is a keyword in C++11}}
diff --git a/clang/test/Lexer/cxx0x_raw_string_delim_length.cpp b/clang/test/Lexer/cxx0x_raw_string_delim_length.cpp
new file mode 100644
index 0000000..b9f6d13
--- /dev/null
+++ b/clang/test/Lexer/cxx0x_raw_string_delim_length.cpp
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -std=c++11 -verify %s
+
+const char *str1 = R"(abcdef)"; // ok
+const char *str2 = R"foo()foo"; // ok
+const char *str3 = R"()"; // ok
+// FIXME: recover better than this.
+const char *str4 = R"abcdefghijkmnopqrstuvwxyz(abcdef)abcdefghijkmnopqrstuvwxyz"; // expected-error {{raw string delimiter longer than 16 characters}} expected-error {{expected expression}}
diff --git a/clang/test/Lexer/cxx0x_raw_string_unterminated.cpp b/clang/test/Lexer/cxx0x_raw_string_unterminated.cpp
new file mode 100644
index 0000000..dfbaaee
--- /dev/null
+++ b/clang/test/Lexer/cxx0x_raw_string_unterminated.cpp
@@ -0,0 +1,4 @@
+// RUN: %clang_cc1 -std=c++11 -E %s 2>&1 | grep 'error: raw string missing terminating delimiter )foo"'
+
+const char *str = R"foo(abc
+def)bar";
diff --git a/clang/test/Lexer/digraph.c b/clang/test/Lexer/digraph.c
new file mode 100644
index 0000000..cf6e478
--- /dev/null
+++ b/clang/test/Lexer/digraph.c
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -ffreestanding %s
+
+%:include <stdint.h>
+
+ %:ifndef BUFSIZE
+ %:define BUFSIZE 512
+ %:endif
+
+ void copy(char d<::>, const char s<::>, int len)
+ <%
+ while (len-- >= 0)
+ <%
+ d<:len:> = s<:len:>;
+ %>
+ %>
diff --git a/clang/test/Lexer/dollar-idents.c b/clang/test/Lexer/dollar-idents.c
new file mode 100644
index 0000000..cbf25b0
--- /dev/null
+++ b/clang/test/Lexer/dollar-idents.c
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -dump-tokens %s 2> %t
+// RUN: grep "identifier '\$A'" %t
+// RUN: %clang_cc1 -dump-tokens -x assembler-with-cpp %s 2> %t
+// RUN: grep "identifier 'A'" %t
+// PR3808
+
+$A
diff --git a/clang/test/Lexer/escape_newline.c b/clang/test/Lexer/escape_newline.c
new file mode 100644
index 0000000..d0f27df
--- /dev/null
+++ b/clang/test/Lexer/escape_newline.c
@@ -0,0 +1,11 @@
+// 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
+
+// This is an ugly way to spell a -> token.
+ -??/
+>
+
+// \
+
diff --git a/clang/test/Lexer/gnu_keywords.c b/clang/test/Lexer/gnu_keywords.c
new file mode 100644
index 0000000..c4bd9b3
--- /dev/null
+++ b/clang/test/Lexer/gnu_keywords.c
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -DGNU_KEYWORDS -std=gnu89 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -DGNU_KEYWORDS -std=c99 -fgnu-keywords -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c99 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=gnu89 -fno-gnu-keywords -fsyntax-only -verify %s
+
+void f() {
+#ifdef GNU_KEYWORDS
+ asm ("ret" : :);
+#else
+ int asm;
+#endif
+}
diff --git a/clang/test/Lexer/has_extension.c b/clang/test/Lexer/has_extension.c
new file mode 100644
index 0000000..3b08510
--- /dev/null
+++ b/clang/test/Lexer/has_extension.c
@@ -0,0 +1,44 @@
+// 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
+
+// CHECK-PED-NONE: no_dummy_extension
+#if !__has_extension(dummy_extension)
+int no_dummy_extension();
+#endif
+
+// Arbitrary feature to test that has_extension is a superset of has_feature
+// CHECK-PED-NONE: attribute_overloadable
+#if __has_extension(attribute_overloadable)
+int attribute_overloadable();
+#endif
+
+// CHECK-PED-NONE: has_c_static_assert
+// CHECK-PED-ERR: no_c_static_assert
+#if __has_extension(c_static_assert)
+int has_c_static_assert();
+#else
+int no_c_static_assert();
+#endif
+
+// CHECK-PED-NONE: has_c_generic_selections
+// CHECK-PED-ERR: no_c_generic_selections
+#if __has_extension(c_generic_selections)
+int has_c_generic_selections();
+#else
+int no_c_generic_selections();
+#endif
+
+// CHECK-PED-NONE: has_c_alignas
+// CHECK-PED-ERR: no_c_alignas
+#if __has_extension(c_alignas)
+int has_c_alignas();
+#else
+int no_c_alignas();
+#endif
+
+// Arbitrary feature to test that the extension name can be surrounded with
+// double underscores.
+// CHECK-PED-NONE: has_double_underscores
+#if __has_extension(__c_alignas__)
+int has_double_underscores();
+#endif
diff --git a/clang/test/Lexer/has_extension_cxx.cpp b/clang/test/Lexer/has_extension_cxx.cpp
new file mode 100644
index 0000000..6ffeebd
--- /dev/null
+++ b/clang/test/Lexer/has_extension_cxx.cpp
@@ -0,0 +1,49 @@
+// RUN: %clang_cc1 -E %s -o - | FileCheck %s
+
+// CHECK: c_static_assert
+#if __has_extension(c_static_assert)
+int c_static_assert();
+#endif
+
+// CHECK: c_generic_selections
+#if __has_extension(c_generic_selections)
+int c_generic_selections();
+#endif
+
+// CHECK: has_deleted_functions
+#if __has_extension(cxx_deleted_functions)
+int has_deleted_functions();
+#endif
+
+// CHECK: has_inline_namespaces
+#if __has_extension(cxx_inline_namespaces)
+int has_inline_namespaces();
+#endif
+
+// CHECK: has_override_control
+#if __has_extension(cxx_override_control)
+int has_override_control();
+#endif
+
+// CHECK: has_range_for
+#if __has_extension(cxx_range_for)
+int has_range_for();
+#endif
+
+// CHECK: has_reference_qualified_functions
+#if __has_extension(cxx_reference_qualified_functions)
+int has_reference_qualified_functions();
+#endif
+
+// CHECK: has_rvalue_references
+#if __has_extension(cxx_rvalue_references)
+int has_rvalue_references();
+#endif
+
+#if __has_extension(cxx_local_type_template_args)
+int has_local_type_template_args();
+#else
+int no_local_type_template_args();
+#endif
+
+// CHECK: has_local_type_template_args
diff --git a/clang/test/Lexer/has_feature_address_sanitizer.cpp b/clang/test/Lexer/has_feature_address_sanitizer.cpp
new file mode 100644
index 0000000..69acc39
--- /dev/null
+++ b/clang/test/Lexer/has_feature_address_sanitizer.cpp
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -E -faddress-sanitizer %s -o - | FileCheck --check-prefix=CHECK-ASAN %s
+// RUN: %clang_cc1 -E %s -o - | FileCheck --check-prefix=CHECK-NO-ASAN %s
+
+#if __has_feature(address_sanitizer)
+int AddressSanitizerEnabled();
+#else
+int AddressSanitizerDisabled();
+#endif
+
+// CHECK-ASAN: AddressSanitizerEnabled
+// CHECK-NO-ASAN: AddressSanitizerDisabled
diff --git a/clang/test/Lexer/has_feature_c1x.c b/clang/test/Lexer/has_feature_c1x.c
new file mode 100644
index 0000000..c9a5f56
--- /dev/null
+++ b/clang/test/Lexer/has_feature_c1x.c
@@ -0,0 +1,47 @@
+// RUN: %clang_cc1 -E -std=c1x %s -o - | FileCheck --check-prefix=CHECK-1X %s
+// RUN: %clang_cc1 -E %s -o - | FileCheck --check-prefix=CHECK-NO-1X %s
+
+#if __has_feature(c_atomic)
+int has_atomic();
+#else
+int no_atomic();
+#endif
+
+// CHECK-1X: has_atomic
+// CHECK-NO-1X: no_atomic
+
+#if __has_feature(c_static_assert)
+int has_static_assert();
+#else
+int no_static_assert();
+#endif
+
+// CHECK-1X: has_static_assert
+// CHECK-NO-1X: no_static_assert
+
+#if __has_feature(c_generic_selections)
+int has_generic_selections();
+#else
+int no_generic_selections();
+#endif
+
+// CHECK-1X: has_generic_selections
+// CHECK-NO-1X: no_generic_selections
+
+#if __has_feature(c_alignas)
+int has_alignas();
+#else
+int no_alignas();
+#endif
+
+// CHECK-1X: has_alignas
+// CHECK-NO-1X: no_alignas
+
+#if __STDC_VERSION__ > 199901L
+int is_c1x();
+#else
+int is_not_c1x();
+#endif
+
+// CHECK-1X: is_c1x
+// CHECK-NO-1X: is_not_c1x
diff --git a/clang/test/Lexer/has_feature_cxx0x.cpp b/clang/test/Lexer/has_feature_cxx0x.cpp
new file mode 100644
index 0000000..8e0222d
--- /dev/null
+++ b/clang/test/Lexer/has_feature_cxx0x.cpp
@@ -0,0 +1,274 @@
+// RUN: %clang_cc1 -E -std=c++11 %s -o - | FileCheck --check-prefix=CHECK-0X %s
+// RUN: %clang_cc1 -E %s -o - | FileCheck --check-prefix=CHECK-NO-0X %s
+
+#if __has_feature(cxx_atomic)
+int has_atomic();
+#else
+int no_atomic();
+#endif
+
+// CHECK-0X: has_atomic
+// CHECK-NO-0X: no_atomic
+
+#if __has_feature(cxx_lambdas)
+int has_lambdas();
+#else
+int no_lambdas();
+#endif
+
+// CHECK-0X: has_lambdas
+// CHECK-NO-0X: no_lambdas
+
+
+#if __has_feature(cxx_nullptr)
+int has_nullptr();
+#else
+int no_nullptr();
+#endif
+
+// CHECK-0X: has_nullptr
+// CHECK-NO-0X: no_nullptr
+
+
+#if __has_feature(cxx_decltype)
+int has_decltype();
+#else
+int no_decltype();
+#endif
+
+// CHECK-0X: has_decltype
+// CHECK-NO-0X: no_decltype
+
+
+#if __has_feature(cxx_decltype_incomplete_return_types)
+int has_decltype_incomplete_return_types();
+#else
+int no_decltype_incomplete_return_types();
+#endif
+
+// CHECK-0X: has_decltype_incomplete_return_types
+// CHECK-NO-0X: no_decltype_incomplete_return_types
+
+
+#if __has_feature(cxx_auto_type)
+int has_auto_type();
+#else
+int no_auto_type();
+#endif
+
+// CHECK-0X: has_auto_type
+// CHECK-NO-0X: no_auto_type
+
+
+#if __has_feature(cxx_trailing_return)
+int has_trailing_return();
+#else
+int no_trailing_return();
+#endif
+
+// CHECK-0X: has_trailing_return
+// CHECK-NO-0X: no_trailing_return
+
+
+#if __has_feature(cxx_attributes)
+int has_attributes();
+#else
+int no_attributes();
+#endif
+
+// CHECK-0X: has_attributes
+// CHECK-NO-0X: no_attributes
+
+
+#if __has_feature(cxx_static_assert)
+int has_static_assert();
+#else
+int no_static_assert();
+#endif
+
+// CHECK-0X: has_static_assert
+// CHECK-NO-0X: no_static_assert
+
+#if __has_feature(cxx_deleted_functions)
+int has_deleted_functions();
+#else
+int no_deleted_functions();
+#endif
+
+// CHECK-0X: has_deleted_functions
+// CHECK-NO-0X: no_deleted_functions
+
+#if __has_feature(cxx_defaulted_functions)
+int has_defaulted_functions();
+#else
+int no_defaulted_functions();
+#endif
+
+// CHECK-0X: has_defaulted_functions
+// CHECK-NO-0X: no_defaulted_functions
+
+#if __has_feature(cxx_rvalue_references)
+int has_rvalue_references();
+#else
+int no_rvalue_references();
+#endif
+
+// CHECK-0X: has_rvalue_references
+// CHECK-NO-0X: no_rvalue_references
+
+
+#if __has_feature(cxx_variadic_templates)
+int has_variadic_templates();
+#else
+int no_variadic_templates();
+#endif
+
+// CHECK-0X: has_variadic_templates
+// CHECK-NO-0X: no_variadic_templates
+
+
+#if __has_feature(cxx_inline_namespaces)
+int has_inline_namespaces();
+#else
+int no_inline_namespaces();
+#endif
+
+// CHECK-0X: has_inline_namespaces
+// CHECK-NO-0X: no_inline_namespaces
+
+
+#if __has_feature(cxx_range_for)
+int has_range_for();
+#else
+int no_range_for();
+#endif
+
+// CHECK-0X: has_range_for
+// CHECK-NO-0X: no_range_for
+
+
+#if __has_feature(cxx_reference_qualified_functions)
+int has_reference_qualified_functions();
+#else
+int no_reference_qualified_functions();
+#endif
+
+// CHECK-0X: has_reference_qualified_functions
+// CHECK-NO-0X: no_reference_qualified_functions
+
+#if __has_feature(cxx_default_function_template_args)
+int has_default_function_template_args();
+#else
+int no_default_function_template_args();
+#endif
+
+// CHECK-0X: has_default_function_template_args
+// CHECK-NO-0X: no_default_function_template_args
+
+#if __has_feature(cxx_noexcept)
+int has_noexcept();
+#else
+int no_noexcept();
+#endif
+
+// CHECK-0X: has_noexcept
+// CHECK-NO-0X: no_noexcept
+
+#if __has_feature(cxx_override_control)
+int has_override_control();
+#else
+int no_override_control();
+#endif
+
+// CHECK-0X: has_override_control
+// CHECK-NO-0X: no_override_control
+
+#if __has_feature(cxx_alias_templates)
+int has_alias_templates();
+#else
+int no_alias_templates();
+#endif
+
+// CHECK-0X: has_alias_templates
+// CHECK-NO-0X: no_alias_templates
+
+#if __has_feature(cxx_implicit_moves)
+int has_implicit_moves();
+#else
+int no_implicit_moves();
+#endif
+
+// CHECK-0X: has_implicit_moves
+// CHECK-NO-0X: no_implicit_moves
+
+#if __has_feature(cxx_alignas)
+int has_alignas();
+#else
+int no_alignas();
+#endif
+
+// CHECK-0X: has_alignas
+// CHECK-NO-0X: no_alignas
+
+#if __has_feature(cxx_raw_string_literals)
+int has_raw_string_literals();
+#else
+int no_raw_string_literals();
+#endif
+
+// CHECK-0X: has_raw_string_literals
+// CHECK-NO-0X: no_raw_string_literals
+
+#if __has_feature(cxx_unicode_literals)
+int has_unicode_literals();
+#else
+int no_unicode_literals();
+#endif
+
+// CHECK-0X: has_unicode_literals
+// CHECK-NO-0X: no_unicode_literals
+
+#if __has_feature(cxx_constexpr)
+int has_constexpr();
+#else
+int no_constexpr();
+#endif
+
+// CHECK-0X: has_constexpr
+// CHECK-NO-0X: no_constexpr
+
+#if __has_feature(cxx_generalized_initializers)
+int has_generalized_initializers();
+#else
+int no_generalized_initializers();
+#endif
+
+// CHECK-0X: has_generalized_initializers
+// CHECK-NO-0X: no_generalized_initializers
+
+#if __has_feature(cxx_unrestricted_unions)
+int has_unrestricted_unions();
+#else
+int no_unrestricted_unions();
+#endif
+
+// CHECK-0X: has_unrestricted_unions
+// CHECK-NO-0X: no_unrestricted_unions
+
+#if __has_feature(cxx_user_literals)
+int has_user_literals();
+#else
+int no_user_literals();
+#endif
+
+// CHECK-0X: has_user_literals
+// CHECK-NO-0X: no_user_literals
+
+#if __has_feature(cxx_local_type_template_args)
+int has_local_type_template_args();
+#else
+int no_local_type_template_args();
+#endif
+
+// CHECK-0X: has_local_type_template_args
+// CHECK-NO-0X: no_local_type_template_args
diff --git a/clang/test/Lexer/has_feature_exceptions.cpp b/clang/test/Lexer/has_feature_exceptions.cpp
new file mode 100644
index 0000000..bb5dc0c
--- /dev/null
+++ b/clang/test/Lexer/has_feature_exceptions.cpp
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -E -fexceptions %s -o - | FileCheck --check-prefix=CHECK-EXCEPTIONS %s
+// RUN: %clang_cc1 -E %s -o - | FileCheck --check-prefix=CHECK-NO-EXCEPTIONS %s
+
+#if __has_feature(cxx_exceptions)
+int foo();
+#else
+int bar();
+#endif
+
+// CHECK-EXCEPTIONS: foo
+// CHECK-NO-EXCEPTIONS: bar
diff --git a/clang/test/Lexer/has_feature_modules.m b/clang/test/Lexer/has_feature_modules.m
new file mode 100644
index 0000000..6cea324
--- /dev/null
+++ b/clang/test/Lexer/has_feature_modules.m
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 -E -fmodules %s -o - | FileCheck --check-prefix=CHECK-HAS-OBJC-MODULES %s
+// RUN: %clang_cc1 -E %s -o - | FileCheck --check-prefix=CHECK-NO-OBJC-MODULES %s
+// RUN: %clang_cc1 -E -x c -fmodules %s -o - | FileCheck --check-prefix=CHECK-NO-OBJC-MODULES %s
+
+// RUN: %clang_cc1 -E -fmodules %s -o - | FileCheck --check-prefix=CHECK-HAS-MODULES %s
+// RUN: %clang_cc1 -E %s -o - | FileCheck --check-prefix=CHECK-NO-MODULES %s
+// RUN: %clang_cc1 -E -x c -fmodules %s -o - | FileCheck --check-prefix=CHECK-HAS-MODULES %s
+
+#if __has_feature(modules)
+int has_modules();
+#else
+int no_modules();
+#endif
+
+// CHECK-HAS-MODULES: has_modules
+// CHECK-NO-MODULES: no_modules
+
+#if __has_feature(objc_modules)
+int has_objc_modules();
+#else
+int no_objc_modules();
+#endif
+
+// CHECK-HAS-OBJC-MODULES: has_objc_modules
+// CHECK-NO-OBJC-MODULES: no_objc_modules
diff --git a/clang/test/Lexer/has_feature_objc_arc.m b/clang/test/Lexer/has_feature_objc_arc.m
new file mode 100644
index 0000000..279b91a
--- /dev/null
+++ b/clang/test/Lexer/has_feature_objc_arc.m
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -E %s -fobjc-arc "-triple" "x86_64-apple-macosx10.7.0" -fobjc-runtime-has-weak | FileCheck --check-prefix=CHECK-ARC %s
+// RUN: %clang_cc1 -E %s -fobjc-arc "-triple" "x86_64-apple-macosx10.6.0" | FileCheck --check-prefix=CHECK-ARCLITE %s
+
+#if __has_feature(objc_arc)
+void has_objc_arc_feature();
+#else
+void no_objc_arc_feature();
+#endif
+
+#if __has_feature(objc_arc_weak)
+void has_objc_arc_weak_feature();
+#else
+void no_objc_arc_weak_feature();
+#endif
+
+// CHECK-ARC: void has_objc_arc_feature();
+// CHECK-ARC: void has_objc_arc_weak_feature();
+
+// CHECK-ARCLITE: void has_objc_arc_feature();
+// CHECK-ARCLITE: void no_objc_arc_weak_feature();
diff --git a/clang/test/Lexer/has_feature_rtti.cpp b/clang/test/Lexer/has_feature_rtti.cpp
new file mode 100644
index 0000000..4bfeead
--- /dev/null
+++ b/clang/test/Lexer/has_feature_rtti.cpp
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -E %s -o - | FileCheck --check-prefix=CHECK-RTTI %s
+// RUN: %clang_cc1 -E -fno-rtti %s -o - | FileCheck --check-prefix=CHECK-NO-RTTI %s
+
+#if __has_feature(cxx_rtti)
+int foo();
+#else
+int bar();
+#endif
+
+// CHECK-RTTI: foo
+// CHECK-NO-RTTI: bar
diff --git a/clang/test/Lexer/has_feature_type_traits.cpp b/clang/test/Lexer/has_feature_type_traits.cpp
new file mode 100644
index 0000000..0c2cfa5
--- /dev/null
+++ b/clang/test/Lexer/has_feature_type_traits.cpp
@@ -0,0 +1,111 @@
+// RUN: %clang_cc1 -E %s -o - | FileCheck %s
+
+#if __has_feature(has_nothrow_assign)
+int has_nothrow_assign();
+#endif
+// CHECK: int has_nothrow_assign();
+
+#if __has_feature(has_nothrow_copy)
+int has_nothrow_copy();
+#endif
+// CHECK: int has_nothrow_copy();
+
+#if __has_feature(has_nothrow_constructor)
+int has_nothrow_constructor();
+#endif
+// CHECK: int has_nothrow_constructor();
+
+#if __has_feature(has_trivial_assign)
+int has_trivial_assign();
+#endif
+// CHECK: int has_trivial_assign();
+
+#if __has_feature(has_trivial_copy)
+int has_trivial_copy();
+#endif
+// CHECK: int has_trivial_copy();
+
+#if __has_feature(has_trivial_constructor)
+int has_trivial_constructor();
+#endif
+// CHECK: int has_trivial_constructor();
+
+#if __has_feature(has_trivial_destructor)
+int has_trivial_destructor();
+#endif
+// CHECK: int has_trivial_destructor();
+
+#if __has_feature(has_virtual_destructor)
+int has_virtual_destructor();
+#endif
+// CHECK: int has_virtual_destructor();
+
+#if __has_feature(is_abstract)
+int is_abstract();
+#endif
+// CHECK: int is_abstract();
+
+#if __has_feature(is_base_of)
+int is_base_of();
+#endif
+// CHECK: int is_base_of();
+
+#if __has_feature(is_class)
+int is_class();
+#endif
+// CHECK: int is_class();
+
+#if __has_feature(is_convertible_to)
+int is_convertible_to();
+#endif
+// CHECK: int is_convertible_to();
+
+#if __has_feature(is_empty)
+int is_empty();
+#endif
+// CHECK: int is_empty();
+
+#if __has_feature(is_enum)
+int is_enum();
+#endif
+// CHECK: int is_enum();
+
+#if __has_feature(is_final)
+int is_final();
+#endif
+// CHECK: int is_final();
+
+#if __has_feature(is_pod)
+int is_pod();
+#endif
+// CHECK: int is_pod();
+
+#if __has_feature(is_polymorphic)
+int is_polymorphic();
+#endif
+// CHECK: int is_polymorphic();
+
+#if __has_feature(is_union)
+int is_union();
+#endif
+// CHECK: int is_union();
+
+#if __has_feature(is_literal)
+int is_literal();
+#endif
+// CHECK: int is_literal();
+
+#if __has_feature(is_standard_layout)
+int is_standard_layout();
+#endif
+// CHECK: int is_standard_layout();
+
+#if __has_feature(is_trivially_copyable)
+int is_trivially_copyable();
+#endif
+// CHECK: int is_trivially_copyable();
+
+#if __has_feature(underlying_type)
+int underlying_type();
+#endif
+// CHECK: int underlying_type();
diff --git a/clang/test/Lexer/hexfloat.cpp b/clang/test/Lexer/hexfloat.cpp
new file mode 100644
index 0000000..6566933
--- /dev/null
+++ b/clang/test/Lexer/hexfloat.cpp
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify -pedantic %s
+float f = 0x1p+1; // expected-warning{{hexadecimal floating constants are a C99 feature}}
+double e = 0x.p0; //expected-error{{hexadecimal floating constants require a significand}}
+double d = 0x.2p2; // expected-warning{{hexadecimal floating constants are a C99 feature}}
+float g = 0x1.2p2; // expected-warning{{hexadecimal floating constants are a C99 feature}}
+double h = 0x1.p2; // expected-warning{{hexadecimal floating constants are a C99 feature}}
diff --git a/clang/test/Lexer/ms-extensions.c b/clang/test/Lexer/ms-extensions.c
new file mode 100644
index 0000000..377d2d5
--- /dev/null
+++ b/clang/test/Lexer/ms-extensions.c
@@ -0,0 +1,43 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -fms-extensions %s
+// RUN: %clang_cc1 -fsyntax-only -verify -fms-compatibility %s
+
+__int8 x1 = 3i8;
+__int16 x2 = 4i16;
+__int32 x3 = 5i32;
+__int64 x5 = 0x42i64;
+__int64 x6 = 0x42I64;
+__int64 x4 = 70000000i128;
+
+__int64 y = 0x42i64u; // expected-error {{invalid suffix}}
+__int64 w = 0x43ui64;
+__int64 z = 9Li64; // expected-error {{invalid suffix}}
+__int64 q = 10lli64; // expected-error {{invalid suffix}}
+
+// radar 7562363
+#define ULLONG_MAX 0xffffffffffffffffui64
+#define UINT 0xffffffffui32
+#define USHORT 0xffffui16
+#define UCHAR 0xffui8
+
+void a() {
+ unsigned long long m = ULLONG_MAX;
+ unsigned int n = UINT;
+ unsigned short s = USHORT;
+ unsigned char c = UCHAR;
+}
+
+void pr_7968()
+{
+ int var1 = 0x1111111e+1;
+ int var2 = 0X1111111e+1;
+ int var3 = 0xe+1;
+ int var4 = 0XE+1;
+
+ int var5= 0\
+x1234e+1;
+
+ int var6=
+ /*expected-warning {{backslash and newline separated by space}} */ 0\
+x1234e+1;
+}
+
diff --git a/clang/test/Lexer/ms-extensions.cpp b/clang/test/Lexer/ms-extensions.cpp
new file mode 100644
index 0000000..7e18a6c
--- /dev/null
+++ b/clang/test/Lexer/ms-extensions.cpp
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -Wreserved-user-defined-literal -fms-extensions -fms-compatibility %s
+
+#define bar(x) #x
+const char * f() {
+ return "foo"bar("bar")"baz"; /*expected-warning {{identifier after literal will be treated as a reserved user-defined literal suffix in C++11}} */
+}
diff --git a/clang/test/Lexer/msdos-cpm-eof.c b/clang/test/Lexer/msdos-cpm-eof.c
new file mode 100644
index 0000000..9ef6e32
--- /dev/null
+++ b/clang/test/Lexer/msdos-cpm-eof.c
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -fms-extensions %s
+
+int x;
+
+
+
+I am random garbage after ^Z
diff --git a/clang/test/Lexer/multiple-include.c b/clang/test/Lexer/multiple-include.c
new file mode 100644
index 0000000..d737f95
--- /dev/null
+++ b/clang/test/Lexer/multiple-include.c
@@ -0,0 +1,27 @@
+// RUN: %clang_cc1 %s -fsyntax-only
+
+#ifndef XVID_AUTO_INCLUDE
+
+#define XVID_AUTO_INCLUDE
+#define FUNC_H H_Pass_16_C
+#include "multiple-include.c"
+
+#define FUNC_H H_Pass_8_C
+
+#include "multiple-include.c"
+#undef XVID_AUTO_INCLUDE
+
+typedef void ff();
+typedef struct { ff *a;} S;
+
+S s = { H_Pass_8_C };
+
+#endif
+
+#if defined(XVID_AUTO_INCLUDE) && defined(REFERENCE_CODE)
+#elif defined(XVID_AUTO_INCLUDE) && !defined(REFERENCE_CODE)
+
+static void FUNC_H(){};
+#undef FUNC_H
+
+#endif
diff --git a/clang/test/Lexer/newline-eof-c++11.cpp b/clang/test/Lexer/newline-eof-c++11.cpp
new file mode 100644
index 0000000..3c45f28
--- /dev/null
+++ b/clang/test/Lexer/newline-eof-c++11.cpp
@@ -0,0 +1,4 @@
+// RUN: %clang_cc1 -fsyntax-only -std=c++11 -Wnewline-eof -verify %s
+
+// The following line isn't terminated, don't fix it.
+void foo() {} \ No newline at end of file
diff --git a/clang/test/Lexer/newline-eof-c++98-compat.cpp b/clang/test/Lexer/newline-eof-c++98-compat.cpp
new file mode 100644
index 0000000..3e5c8e2
--- /dev/null
+++ b/clang/test/Lexer/newline-eof-c++98-compat.cpp
@@ -0,0 +1,4 @@
+// RUN: %clang_cc1 -fsyntax-only -Wc++98-compat-pedantic -std=c++11 -verify %s
+
+// The following line isn't terminated, don't fix it.
+void foo() {} // expected-warning{{C++98 requires newline at end of file}} \ No newline at end of file
diff --git a/clang/test/Lexer/newline-eof.c b/clang/test/Lexer/newline-eof.c
new file mode 100644
index 0000000..825a266
--- /dev/null
+++ b/clang/test/Lexer/newline-eof.c
@@ -0,0 +1,5 @@
+// RUN: %clang_cc1 -fsyntax-only -Wnewline-eof -verify %s
+// rdar://9133072
+
+// The following line isn't terminated, don't fix it.
+void foo() {} // expected-warning{{no newline at end of file}} \ No newline at end of file
diff --git a/clang/test/Lexer/numeric-literal-trash.c b/clang/test/Lexer/numeric-literal-trash.c
new file mode 100644
index 0000000..5407ba9
--- /dev/null
+++ b/clang/test/Lexer/numeric-literal-trash.c
@@ -0,0 +1,13 @@
+/* RUN: %clang_cc1 -fsyntax-only -verify %s
+ */
+# define XRECORD(x, c_name) e##c (x, __LINE__)
+
+
+
+int ec(int, int);
+
+
+ void x() {
+
+XRECORD (XRECORD (1, 1), 1);
+ }
diff --git a/clang/test/Lexer/pragma-mark.c b/clang/test/Lexer/pragma-mark.c
new file mode 100644
index 0000000..96e8485
--- /dev/null
+++ b/clang/test/Lexer/pragma-mark.c
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 %s -fsyntax-only -verify
+
+// Lexer diagnostics shouldn't be included in #pragma mark.
+#pragma mark Mike's world
+_Pragma("mark foo ' bar")
+
+#define X(S) _Pragma(S)
+X("mark foo ' bar")
+
+int i;
+
diff --git a/clang/test/Lexer/pragma-message.c b/clang/test/Lexer/pragma-message.c
new file mode 100644
index 0000000..807edda
--- /dev/null
+++ b/clang/test/Lexer/pragma-message.c
@@ -0,0 +1,14 @@
+/* Test pragma message directive from
+ http://msdn.microsoft.com/en-us/library/x7dkzch2.aspx */
+
+// message: Sends a string literal to the standard output without terminating
+// the compilation.
+// #pragma message(messagestring)
+// OR
+// #pragma message messagestring
+//
+// RUN: %clang_cc1 -fsyntax-only -verify -Werror %s
+#define STRING2(x) #x
+#define STRING(x) STRING2(x)
+#pragma message(":O I'm a message! " STRING(__LINE__)) // expected-warning {{:O I'm a message! 13}}
+#pragma message ":O gcc accepts this! " STRING(__LINE__) // expected-warning {{:O gcc accepts this! 14}}
diff --git a/clang/test/Lexer/pragma-operators.cpp b/clang/test/Lexer/pragma-operators.cpp
new file mode 100644
index 0000000..d1645ad
--- /dev/null
+++ b/clang/test/Lexer/pragma-operators.cpp
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -fms-extensions -E %s | FileCheck %s
+
+// Test that we properly expand the C99 _Pragma and Microsoft __pragma
+// into #pragma directives, with newlines where needed. <rdar://problem/8412013>
+
+// CHECK: #line
+// CHECK: #pragma warning(push)
+// CHECK: extern "C" {
+// CHECK: #line
+// CHECK: #pragma warning(push)
+// CHECK: int foo() { return 0; } }
+// CHECK: #line
+// CHECK: #pragma warning(pop)
+#define A(X) extern "C" { __pragma(warning(push)) \
+ int X() { return 0; } \
+}
+#define B(X) A(X)
+#pragma warning(push)
+B(foo)
+#pragma warning(pop)
diff --git a/clang/test/Lexer/preamble.c b/clang/test/Lexer/preamble.c
new file mode 100644
index 0000000..5b2739a
--- /dev/null
+++ b/clang/test/Lexer/preamble.c
@@ -0,0 +1,36 @@
+// Preamble detection test: see below for comments and test commands.
+//* A BCPL comment that includes '/*'
+#include <blah>
+#ifndef FOO
+#else
+#ifdef BAR
+#elif WIBBLE
+#endif
+#pragma unknown
+#endif
+#ifdef WIBBLE
+#include "honk"
+#else
+int foo();
+#endif
+
+// This test checks for detection of the preamble of a file, which
+// includes all of the starting comments and #includes. Note that any
+// changes to the preamble part of this file must be mirrored in
+// Inputs/preamble.txt, since we diff against it.
+
+// RUN: %clang_cc1 -print-preamble %s > %t
+// RUN: echo END. >> %t
+// RUN: FileCheck < %t %s
+
+// CHECK: // Preamble detection test: see below for comments and test commands.
+// CHECK-NEXT: //* A BCPL comment that includes '/*'
+// CHECK-NEXT: #include <blah>
+// CHECK-NEXT: #ifndef FOO
+// CHECK-NEXT: #else
+// CHECK-NEXT: #ifdef BAR
+// CHECK-NEXT: #elif WIBBLE
+// CHECK-NEXT: #endif
+// CHECK-NEXT: #pragma unknown
+// CHECK-NEXT: #endif
+// CHECK-NEXT: END.
diff --git a/clang/test/Lexer/rdar-8914293.c b/clang/test/Lexer/rdar-8914293.c
new file mode 100644
index 0000000..e39e4f1
--- /dev/null
+++ b/clang/test/Lexer/rdar-8914293.c
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// rdar://8914293
+// We want be compatible with gcc and warn, not error.
+
+/* expected-warning {{missing terminating}} */ #define FOO "foo
+/* expected-warning {{missing terminating}} */ #define KOO 'k
diff --git a/clang/test/Lexer/rdr-6096838-2.c b/clang/test/Lexer/rdr-6096838-2.c
new file mode 100644
index 0000000..e64acc9
--- /dev/null
+++ b/clang/test/Lexer/rdr-6096838-2.c
@@ -0,0 +1,5 @@
+/* RUN: %clang_cc1 -triple x86_64-unknown-unknown -pedantic -std=gnu89 -fsyntax-only -verify %s
+ rdar://6096838
+ */
+
+long double d = 0x0.0000003ffffffff00000p-16357L; /* expected-warning {{hexadecimal floating constants are a C99 feature}} */
diff --git a/clang/test/Lexer/rdr-6096838.c b/clang/test/Lexer/rdr-6096838.c
new file mode 100644
index 0000000..d1426cc
--- /dev/null
+++ b/clang/test/Lexer/rdr-6096838.c
@@ -0,0 +1,6 @@
+/* RUN: %clang_cc1 -triple i386-unknown-unknown -fsyntax-only -verify %s
+ * RUN: %clang_cc1 -triple x86_64-unknown-unknown -std=gnu89 -fsyntax-only -verify %s
+ rdar://6096838
+ */
+
+long double d = 0x0.0000003ffffffff00000p-16357L;
diff --git a/clang/test/Lexer/string-literal-encoding.c b/clang/test/Lexer/string-literal-encoding.c
new file mode 100644
index 0000000..57097dc
--- /dev/null
+++ b/clang/test/Lexer/string-literal-encoding.c
@@ -0,0 +1,33 @@
+// RUN: %clang_cc1 -x c++ -std=c++0x -fsyntax-only -verify %s
+
+// This file should be encoded using ISO-8859-1, the string literals should
+// contain the ISO-8859-1 encoding for the code points U+00C0 U+00E9 U+00EE
+// U+00F5 U+00FC
+
+void f() {
+ wchar_t const *a = L"Àéîõü"; // expected-error {{illegal character encoding in string literal}}
+
+ char16_t const *b = u"Àéîõü"; // expected-error {{illegal character encoding in string literal}}
+ char32_t const *c = U"Àéîõü"; // expected-error {{illegal character encoding in string literal}}
+ wchar_t const *d = LR"(Àéîõü)"; // expected-error {{illegal character encoding in string literal}}
+ char16_t const *e = uR"(Àéîõü)"; // expected-error {{illegal character encoding in string literal}}
+ char32_t const *f = UR"(Àéîõü)"; // expected-error {{illegal character encoding in string literal}}
+
+ char const *g = "Àéîõü"; // expected-warning {{illegal character encoding in string literal}}
+ char const *h = u8"Àéîõü"; // expected-error {{illegal character encoding in string literal}}
+ char const *i = R"(Àéîõü)"; // expected-warning {{illegal character encoding in string literal}}
+}
+
+void g() {
+ wchar_t const *a = L"foo Àéîõü"; // expected-error {{illegal character encoding in string literal}}
+
+ char16_t const *b = u"foo Àéîõü"; // expected-error {{illegal character encoding in string literal}}
+ char32_t const *c = U"foo Àéîõü"; // expected-error {{illegal character encoding in string literal}}
+ wchar_t const *d = LR"(foo Àéîõü)"; // expected-error {{illegal character encoding in string literal}}
+ char16_t const *e = uR"(foo Àéîõü)"; // expected-error {{illegal character encoding in string literal}}
+ char32_t const *f = UR"(foo Àéîõü)"; // expected-error {{illegal character encoding in string literal}}
+
+ char const *g = "foo Àéîõü"; // expected-warning {{illegal character encoding in string literal}}
+ char const *h = u8"foo Àéîõü"; // expected-error {{illegal character encoding in string literal}}
+ char const *i = R"(foo Àéîõü)"; // expected-warning {{illegal character encoding in string literal}}
+}
diff --git a/clang/test/Lexer/string_concat.cpp b/clang/test/Lexer/string_concat.cpp
new file mode 100644
index 0000000..7e78a63
--- /dev/null
+++ b/clang/test/Lexer/string_concat.cpp
@@ -0,0 +1,33 @@
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
+
+void f() {
+
+ const char* a = u8"abc" u"abc"; // expected-error {{unsupported non-standard concatenation of string literals}}
+ const char* b = u8"abc" U"abc"; // expected-error {{unsupported non-standard concatenation of string literals}}
+ const char* c = u8"abc" L"abc"; // expected-error {{unsupported non-standard concatenation of string literals}}
+ const char* d = u8"abc" uR"(abc)"; // expected-error {{unsupported non-standard concatenation of string literals}}
+ const char* e = u8"abc" UR"(abc)"; // expected-error {{unsupported non-standard concatenation of string literals}}
+ const char* f = u8"abc" LR"(abc)"; // expected-error {{unsupported non-standard concatenation of string literals}}
+
+ const char16_t* g = u"abc" u8"abc"; // expected-error {{unsupported non-standard concatenation of string literals}}
+ const char16_t* h = u"abc" U"abc"; // expected-error {{unsupported non-standard concatenation of string literals}}
+ const char16_t* i = u"abc" L"abc"; // expected-error {{unsupported non-standard concatenation of string literals}}
+ const char16_t* j = u"abc" u8R"(abc)"; // expected-error {{unsupported non-standard concatenation of string literals}}
+ const char16_t* k = u"abc" UR"(abc)"; // expected-error {{unsupported non-standard concatenation of string literals}}
+ const char16_t* l = u"abc" LR"(abc)"; // expected-error {{unsupported non-standard concatenation of string literals}}
+
+ const char32_t* m = U"abc" u8"abc"; // expected-error {{unsupported non-standard concatenation of string literals}}
+ const char32_t* n = U"abc" u"abc"; // expected-error {{unsupported non-standard concatenation of string literals}}
+ const char32_t* o = U"abc" L"abc"; // expected-error {{unsupported non-standard concatenation of string literals}}
+ const char32_t* p = U"abc" u8R"(abc)"; // expected-error {{unsupported non-standard concatenation of string literals}}
+ const char32_t* q = U"abc" uR"(abc)"; // expected-error {{unsupported non-standard concatenation of string literals}}
+ const char32_t* r = U"abc" LR"(abc)"; // expected-error {{unsupported non-standard concatenation of string literals}}
+
+ const wchar_t* s = L"abc" u8"abc"; // expected-error {{unsupported non-standard concatenation of string literals}}
+ const wchar_t* t = L"abc" u"abc"; // expected-error {{unsupported non-standard concatenation of string literals}}
+ const wchar_t* u = L"abc" U"abc"; // expected-error {{unsupported non-standard concatenation of string literals}}
+ const wchar_t* v = L"abc" u8R"(abc)"; // expected-error {{unsupported non-standard concatenation of string literals}}
+ const wchar_t* w = L"abc" uR"(abc)"; // expected-error {{unsupported non-standard concatenation of string literals}}
+ const wchar_t* x = L"abc" UR"(abc)"; // expected-error {{unsupported non-standard concatenation of string literals}}
+}
+
diff --git a/clang/test/Lexer/token-concat-2.c b/clang/test/Lexer/token-concat-2.c
new file mode 100644
index 0000000..7d3cd64
--- /dev/null
+++ b/clang/test/Lexer/token-concat-2.c
@@ -0,0 +1,4 @@
+// RUN: %clang_cc1 -E -x c -o - %s | grep '[.][*]'
+// PR4395
+#define X .*
+X
diff --git a/clang/test/Lexer/token-concat.c b/clang/test/Lexer/token-concat.c
new file mode 100644
index 0000000..551af95
--- /dev/null
+++ b/clang/test/Lexer/token-concat.c
@@ -0,0 +1,4 @@
+// RUN: %clang_cc1 -E -x c -o %t %s
+// RUN: grep 'IDENT.2' %t
+
+IDENT.2
diff --git a/clang/test/Lexer/token-concat.cpp b/clang/test/Lexer/token-concat.cpp
new file mode 100644
index 0000000..57dbae0
--- /dev/null
+++ b/clang/test/Lexer/token-concat.cpp
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -E -std=c++11 -o - %s | FileCheck %s
+
+#define id(x) x
+id("s")_x // CHECK: "s" _x
+id(L"s")_x // CHECK: L"s" _x
+id(u8"s")_x // CHECK: u8"s" _x
+id(u"s")_x // CHECK: u"s" _x
+id(U"s")_x // CHECK: U"s" _x
+id('s')_x // CHECK: 's' _x
+id(L's')_x // CHECK: L's' _x
+id(u's')_x // CHECK: u's' _x
+id(U's')_x // CHECK: U's' _x
+id("s"_x)_y // CHECK: "s"_x _y
+id(1.0_)f // CHECK: 1.0_ f
+id(1.0)_f // CHECK: 1.0 _f
+id(0xface+)b_count // CHECK: 0xface+ b_count
+id("s")1 // CHECK: "s"1
+id("s"_x)1 // CHECK: "s"_x 1
+id(1)_2_x // CHECK: 1 _2_x
diff --git a/clang/test/Lexer/unknown-char.c b/clang/test/Lexer/unknown-char.c
new file mode 100644
index 0000000..334df37
--- /dev/null
+++ b/clang/test/Lexer/unknown-char.c
@@ -0,0 +1,2 @@
+// RUN: %clang_cc1 -E %s 2>&1 | not grep error
+ ` ` ` `
diff --git a/clang/test/Lexer/utf-16.c b/clang/test/Lexer/utf-16.c
new file mode 100644
index 0000000..169ee43
--- /dev/null
+++ b/clang/test/Lexer/utf-16.c
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 %s -fsyntax-only -verify
+// rdar://7876588
+
+// This test verifies that clang gives a decent error for UTF-16 source files.
+
+#include "utf-16.c.txt" // expected-error {{UTF-16 (LE) byte order mark detected}}
diff --git a/clang/test/Lexer/utf-16.c.txt b/clang/test/Lexer/utf-16.c.txt
new file mode 100644
index 0000000..4f3d169
--- /dev/null
+++ b/clang/test/Lexer/utf-16.c.txt
Binary files differ
diff --git a/clang/test/Lexer/utf8-char-literal.cpp b/clang/test/Lexer/utf8-char-literal.cpp
new file mode 100644
index 0000000..12b001e
--- /dev/null
+++ b/clang/test/Lexer/utf8-char-literal.cpp
@@ -0,0 +1,5 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -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}}
diff --git a/clang/test/Lexer/wchar.c b/clang/test/Lexer/wchar.c
new file mode 100644
index 0000000..de00c02
--- /dev/null
+++ b/clang/test/Lexer/wchar.c
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -fsyntax-only -fshort-wchar -verify %s
+
+void f() {
+ (void)L"\U00010000"; // unicode escape produces UTF-16 sequence, so no warning
+
+ (void)L'\U00010000'; // expected-error {{character too large for enclosing character literal type}}
+
+ (void)L'ab'; // expected-warning {{extraneous characters in character constant ignored}}
+
+ (void)L'a\u1000'; // expected-warning {{extraneous characters in character constant ignored}}
+}
+