From c98bb4ed99364b0816925d642caa1f07b8a27c18 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Sat, 9 Mar 2013 23:30:15 +0000 Subject: 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 --- clang/test/Lexer/pragma-operators.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'clang/test/Lexer/pragma-operators.cpp') 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. @@ -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; -- cgit v1.2.3