aboutsummaryrefslogtreecommitdiff
path: root/clang/test/Preprocessor/preprocess-pragma-cpp-output.c
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/Preprocessor/preprocess-pragma-cpp-output.c')
-rw-r--r--clang/test/Preprocessor/preprocess-pragma-cpp-output.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/clang/test/Preprocessor/preprocess-pragma-cpp-output.c b/clang/test/Preprocessor/preprocess-pragma-cpp-output.c
new file mode 100644
index 0000000..d538937
--- /dev/null
+++ b/clang/test/Preprocessor/preprocess-pragma-cpp-output.c
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 -E -x c %s | FileCheck %s
+// RUN: %clang_cc1 -x c -fsyntax-only %s -verify
+// RUN: %clang_cc1 -x cpp-output -fsyntax-only -verify %s
+// expected-no-diagnostics
+
+// The preprocessor does not expand macro-identifiers in #pragma directives.
+// When we preprocess & parse the code, clang expands the macros in directives.
+// When we parse already preprocessed code, clang still has to expand the
+// macros in the directives.
+// This means that we're not always able to parse the preprocessor's output
+// without preserving the definitions (-dD).
+
+#define FACTOR 4
+
+void foo() {
+ // CHECK: #pragma unroll FACTOR
+ #pragma unroll FACTOR
+ for(;;) {
+ }
+ return;
+}