aboutsummaryrefslogtreecommitdiff
path: root/test/Lexer/pragma-operators.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-09-09 22:45:38 +0000
committerDouglas Gregor <dgregor@apple.com>2010-09-09 22:45:38 +0000
commit80c60f72848896f867f6b7e664e7060d9e78f019 (patch)
treef485a7c8e94a54a3095e9bc3be9be852db88a2ef /test/Lexer/pragma-operators.cpp
parent748de8eda222f087434d8bd703176b316a061341 (diff)
When we parse a pragma, keep track of how that pragma was originally
spelled (#pragma, _Pragma, __pragma). In -E mode, use that information to add appropriate newlines when translating _Pragma and __pragma into #pragma, like GCC does. Fixes <rdar://problem/8412013>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113553 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Lexer/pragma-operators.cpp')
-rw-r--r--test/Lexer/pragma-operators.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/Lexer/pragma-operators.cpp b/test/Lexer/pragma-operators.cpp
new file mode 100644
index 0000000000..af346e8c96
--- /dev/null
+++ b/test/Lexer/pragma-operators.cpp
@@ -0,0 +1,15 @@
+// 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: extern
+// CHECK: #line
+// CHECK: #pragma warning(push)
+// CHECK: #line
+// CHECK: ; void f0();
+// CHECK: #line
+// CHECK: #pragma warning(pop)
+// CHECK: #line
+// CHECK: ; }
+extern "C" { _Pragma("warning(push)"); void f0(); __pragma(warning(pop)); }