summaryrefslogtreecommitdiffstats
path: root/clang/test/Preprocessor
diff options
context:
space:
mode:
authorBruno Cardoso Lopes <bruno.cardoso@gmail.com>2016-10-28 16:32:10 +0000
committerBruno Cardoso Lopes <bruno.cardoso@gmail.com>2016-10-28 16:32:10 +0000
commitc9af134dda5a941c1addadf765e9360efe0e7766 (patch)
treed8837b06c6e93059272cf0c8134288e3f6a0dd53 /clang/test/Preprocessor
parent2b42ccc78b38e5b11305f7316e108882986f5aa9 (diff)
downloadbcm5719-llvm-c9af134dda5a941c1addadf765e9360efe0e7766.tar.gz
bcm5719-llvm-c9af134dda5a941c1addadf765e9360efe0e7766.zip
[Preprocessor] Support for '-dI' flag
Implement the -dI as supported by GCC: Output ‘#include’ directives in addition to the result of preprocessing. This change aims to add this option, pass it through to the preprocessor via the options class, and when inclusions occur we output some information (+ test cases). Patch by Steve O'Brien! Differential Revision: https://reviews.llvm.org/D25153 llvm-svn: 285411
Diffstat (limited to 'clang/test/Preprocessor')
-rw-r--r--clang/test/Preprocessor/dump_import.h1
-rw-r--r--clang/test/Preprocessor/dump_import.m6
-rw-r--r--clang/test/Preprocessor/dump_include.c11
-rw-r--r--clang/test/Preprocessor/dump_include.h2
4 files changed, 20 insertions, 0 deletions
diff --git a/clang/test/Preprocessor/dump_import.h b/clang/test/Preprocessor/dump_import.h
new file mode 100644
index 00000000000..fded1e52cbb
--- /dev/null
+++ b/clang/test/Preprocessor/dump_import.h
@@ -0,0 +1 @@
+#define DUMP_IMPORT_TESTVAL 1
diff --git a/clang/test/Preprocessor/dump_import.m b/clang/test/Preprocessor/dump_import.m
new file mode 100644
index 00000000000..20424ad507b
--- /dev/null
+++ b/clang/test/Preprocessor/dump_import.m
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -E -dI %s -o - | FileCheck %s
+// CHECK: {{^}}#import "dump_
+
+// See also `dump_include.c` which tests other inclusion cases with `-dI`.
+
+#import "dump_import.h"
diff --git a/clang/test/Preprocessor/dump_include.c b/clang/test/Preprocessor/dump_include.c
new file mode 100644
index 00000000000..b98b5df7b77
--- /dev/null
+++ b/clang/test/Preprocessor/dump_include.c
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -w -E -dI -isystem %S -imacros %S/dump_include.h %s -o - | FileCheck %s
+// CHECK: {{^}}#__include_macros "/{{([^/]+/)+}}dump_
+// CHECK: {{^}}#include <dump_
+// CHECK: {{^}}#include "dump_
+// CHECK: {{^}}#include_next "dump_
+
+// See also `dump_import.m` which tests the `#import` directive with `-dI`.
+
+#include <dump_include.h>
+#include "dump_include.h"
+#include_next "dump_include.h"
diff --git a/clang/test/Preprocessor/dump_include.h b/clang/test/Preprocessor/dump_include.h
new file mode 100644
index 00000000000..9dafaa50b5c
--- /dev/null
+++ b/clang/test/Preprocessor/dump_include.h
@@ -0,0 +1,2 @@
+#pragma once
+#define DUMP_INCLUDE_TESTVAL 1
OpenPOWER on IntegriCloud