summaryrefslogtreecommitdiffstats
path: root/clang/test/Frontend/rewrite-includes-line-markers.c
diff options
context:
space:
mode:
authorReid Kleckner <reid@kleckner.net>2015-02-26 00:17:25 +0000
committerReid Kleckner <reid@kleckner.net>2015-02-26 00:17:25 +0000
commit1df0fea5939970f6ba4e77aa00a0d2ecadbad3ec (patch)
treefdf890a5b7d833fbef5cc6489e7f64aba4bdef4c /clang/test/Frontend/rewrite-includes-line-markers.c
parentebdfc00995264d2cd3795824c8074e03e6322d35 (diff)
downloadbcm5719-llvm-1df0fea5939970f6ba4e77aa00a0d2ecadbad3ec.tar.gz
bcm5719-llvm-1df0fea5939970f6ba4e77aa00a0d2ecadbad3ec.zip
Add -fuse-line-directive flag to control usage of #line with -E
Currently -fms-extensions controls this behavior, which doesn't make much sense. It means we can't identify what is and isn't a system header when compiling our own preprocessed output, because #line doesn't represent this information. If someone is feeding Clang's preprocessed output to another compiler, they can use this flag. Fixes PR20553. Reviewers: rsmith Differential Revision: http://reviews.llvm.org/D5217 llvm-svn: 230587
Diffstat (limited to 'clang/test/Frontend/rewrite-includes-line-markers.c')
-rw-r--r--clang/test/Frontend/rewrite-includes-line-markers.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/clang/test/Frontend/rewrite-includes-line-markers.c b/clang/test/Frontend/rewrite-includes-line-markers.c
new file mode 100644
index 00000000000..14692a19e9b
--- /dev/null
+++ b/clang/test/Frontend/rewrite-includes-line-markers.c
@@ -0,0 +1,22 @@
+// RUN: %clang_cc1 -E -frewrite-includes -I %S/Inputs %s | FileCheck %s --check-prefix=GNU
+// RUN: %clang_cc1 -E -frewrite-includes -fuse-line-directives -I %S/Inputs %s | FileCheck %s --check-prefix=LINE
+#include "test.h"
+int f() { return x; }
+
+// GNU: {{^}}# 1 "{{.*}}rewrite-includes-line-markers.c"
+// GNU: {{^}}#include "test.h"
+// GNU: {{^}}# 1 "{{.*}}test.h"
+// GNU: {{^}}#include "test2.h"
+// GNU: {{^}}# 1 "{{.*}}test2.h"
+// GNU: {{^}}int x;
+// GNU: {{^}}# 4 "{{.*}}rewrite-includes-line-markers.c" 2
+// GNU: {{^}}int f() { return x; }
+
+// LINE: {{^}}#line 1 "{{.*}}rewrite-includes-line-markers.c"
+// LINE: {{^}}#include "test.h"
+// LINE: {{^}}#line 1 "{{.*}}test.h"
+// LINE: {{^}}#include "test2.h"
+// LINE: {{^}}#line 1 "{{.*}}test2.h"
+// LINE: {{^}}int x;
+// LINE: {{^}}#line 4 "{{.*}}rewrite-includes-line-markers.c"
+// LINE: {{^}}int f() { return x; }
OpenPOWER on IntegriCloud