From c7d6576d542d5d65ea978c11c66dd7769d5753a0 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Thu, 9 Sep 2010 22:45:38 +0000 Subject: 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 . llvm-svn: 113553 --- clang/test/Lexer/pragma-operators.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 clang/test/Lexer/pragma-operators.cpp (limited to 'clang/test/Lexer/pragma-operators.cpp') diff --git a/clang/test/Lexer/pragma-operators.cpp b/clang/test/Lexer/pragma-operators.cpp new file mode 100644 index 00000000000..af346e8c968 --- /dev/null +++ b/clang/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. + +// 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)); } -- cgit v1.2.3