summaryrefslogtreecommitdiffstats
path: root/clang/test/Lexer/pragma-operators.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2013-03-09 23:30:15 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2013-03-09 23:30:15 +0000
commitc98bb4ed99364b0816925d642caa1f07b8a27c18 (patch)
treea01a3a9b681cb55320990be90f13f4e930a737ea /clang/test/Lexer/pragma-operators.cpp
parentfa9888fce7fae6d271166ddbeea6ae6e5167cf16 (diff)
downloadbcm5719-llvm-c98bb4ed99364b0816925d642caa1f07b8a27c18.tar.gz
bcm5719-llvm-c98bb4ed99364b0816925d642caa1f07b8a27c18.zip
Handle _Pragma on a u8, u, or U string literal per the C11 specification. Also
handle raw string literals here. C++11 doesn't yet specify how they will behave, but discussion on core suggests that we should just strip off everything but the r-char-sequence. llvm-svn: 176779
Diffstat (limited to 'clang/test/Lexer/pragma-operators.cpp')
-rw-r--r--clang/test/Lexer/pragma-operators.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/clang/test/Lexer/pragma-operators.cpp b/clang/test/Lexer/pragma-operators.cpp
index a76e0b2f97e..6a5a498a151 100644
--- a/clang/test/Lexer/pragma-operators.cpp
+++ b/clang/test/Lexer/pragma-operators.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fms-extensions -E %s | FileCheck %s
+// RUN: %clang_cc1 -fms-extensions -std=c++11 -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>
@@ -17,3 +17,21 @@
#pragma warning(push)
B(foo)
#pragma warning(pop)
+
+#define pragma_L _Pragma(L"GCC diagnostic push")
+#define pragma_u8 _Pragma(u8"system_header")
+#define pragma_u _Pragma(u"GCC diagnostic pop")
+#define pragma_U _Pragma(U"comment(lib, \"libfoo\")")
+#define pragma_R _Pragma(R"(clang diagnostic ignored "-Wunused")")
+#define pragma_UR _Pragma(UR"(clang diagnostic error "-Wunused")")
+#define pragma_hello _Pragma(u8R"x(message R"y("Hello", world!)y")x")
+// CHECK: int n =
+// CHECK: #pragma GCC diagnostic push
+// CHECK: #pragma system_header
+// CHECK: #pragma GCC diagnostic pop
+// CHECK: #pragma comment(lib, "libfoo")
+// CHECK: #pragma clang diagnostic ignored "-Wunused"
+// CHECK: #pragma clang diagnostic error "-Wunused"
+// CHECK: #pragma message("\042Hello\042, world!")
+// CHECK: 0;
+int n = pragma_L pragma_u8 pragma_u pragma_U pragma_R pragma_UR pragma_hello 0;
OpenPOWER on IntegriCloud