summaryrefslogtreecommitdiffstats
path: root/test/Lexer
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2012-08-15 20:02:54 +0000
committerdim <dim@FreeBSD.org>2012-08-15 20:02:54 +0000
commit554bcb69c2d785a011a30e7db87a36a87fe7db10 (patch)
tree9abb1a658a297776086f4e0dfa6ca533de02104e /test/Lexer
parentbb67ca86b31f67faee50bd10c3b036d65751745a (diff)
downloadFreeBSD-src-554bcb69c2d785a011a30e7db87a36a87fe7db10.zip
FreeBSD-src-554bcb69c2d785a011a30e7db87a36a87fe7db10.tar.gz
Vendor import of clang trunk r161861:
http://llvm.org/svn/llvm-project/cfe/trunk@161861
Diffstat (limited to 'test/Lexer')
-rw-r--r--test/Lexer/bcpl-escaped-newline.c3
-rw-r--r--test/Lexer/c90.c7
-rw-r--r--test/Lexer/char-literal.cpp3
-rw-r--r--test/Lexer/hexfloat.cpp8
-rw-r--r--test/Lexer/newline-eof.c4
-rw-r--r--test/Lexer/pragma-operators.cpp1
-rw-r--r--test/Lexer/wchar-signedness.c8
7 files changed, 32 insertions, 2 deletions
diff --git a/test/Lexer/bcpl-escaped-newline.c b/test/Lexer/bcpl-escaped-newline.c
index 4d4a7b5..d87ee9b 100644
--- a/test/Lexer/bcpl-escaped-newline.c
+++ b/test/Lexer/bcpl-escaped-newline.c
@@ -5,7 +5,8 @@
#error bar
//??/
-#error qux // expected-error {{qux}}
+#error qux
+// expected-error@-1 {{qux}}
// Trailing whitespace!
//\
diff --git a/test/Lexer/c90.c b/test/Lexer/c90.c
index d910572..7142c09 100644
--- a/test/Lexer/c90.c
+++ b/test/Lexer/c90.c
@@ -32,3 +32,10 @@ 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++}}
}
+
+#define PREFIX(x) foo ## x
+int test4() {
+ int PREFIX(0p) = 0;
+ int *p = &PREFIX(0p+1);
+ return p[-1];
+}
diff --git a/test/Lexer/char-literal.cpp b/test/Lexer/char-literal.cpp
index 5dc5360..8556d46 100644
--- a/test/Lexer/char-literal.cpp
+++ b/test/Lexer/char-literal.cpp
@@ -22,3 +22,6 @@ char m = '👿'; // expected-error {{character too large for enclosing character
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}}
+
+char16_t p[2] = u"\U0000FFFF";
+char16_t q[2] = u"\U00010000"; // expected-error {{too long}}
diff --git a/test/Lexer/hexfloat.cpp b/test/Lexer/hexfloat.cpp
index 6566933..9bd8f83 100644
--- a/test/Lexer/hexfloat.cpp
+++ b/test/Lexer/hexfloat.cpp
@@ -5,3 +5,11 @@ double e = 0x.p0; //expected-error{{hexadecimal floating constants require a sig
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}}
+
+// PR12717: In order to minimally diverge from the C++ standard, we do not lex
+// 'p[+-]' as part of a pp-number unless the token starts 0x and doesn't contain
+// an underscore.
+double i = 0p+3; // expected-error{{invalid suffix 'p' on integer constant}}
+#define PREFIX(x) foo ## x
+double foo0p = 1, j = PREFIX(0p+3); // ok
+double k = 0x42_amp+3; // expected-error-re{{invalid suffix '_amp' on integer constant|no matching literal operator for call to 'operator "" _amp'}}
diff --git a/test/Lexer/newline-eof.c b/test/Lexer/newline-eof.c
index 825a266..a4a1883 100644
--- a/test/Lexer/newline-eof.c
+++ b/test/Lexer/newline-eof.c
@@ -1,5 +1,9 @@
// RUN: %clang_cc1 -fsyntax-only -Wnewline-eof -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wnewline-eof %s 2>&1 | FileCheck %s
// rdar://9133072
+// Make sure the diagnostic shows up properly at the end of the last line.
+// CHECK: newline-eof.c:9:63
+
// 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/test/Lexer/pragma-operators.cpp b/test/Lexer/pragma-operators.cpp
index d1645ad..a76e0b2 100644
--- a/test/Lexer/pragma-operators.cpp
+++ b/test/Lexer/pragma-operators.cpp
@@ -9,7 +9,6 @@
// 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; } \
diff --git a/test/Lexer/wchar-signedness.c b/test/Lexer/wchar-signedness.c
new file mode 100644
index 0000000..fea0eca
--- /dev/null
+++ b/test/Lexer/wchar-signedness.c
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -fsyntax-only -dM -E %s -triple x86_64-none-linux-gnu | FileCheck %s --check-prefix=X86
+// RUN: %clang_cc1 -fsyntax-only -dM -E %s -triple armv7-none-eabi | FileCheck %s --check-prefix=ARM
+
+// CHECK-X86-NOT: #define __WCHAR_UNSIGNED__
+// CHECK-X86: #define __WINT_UNSIGNED__ 1
+
+// CHECK-ARM: #define __WCHAR_UNSIGNED__ 1
+// CHECK-ARM-NOT: #define __WINT_UNSIGNED__ 1
OpenPOWER on IntegriCloud