summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/Modules/Inputs/ignored_macros.h8
-rw-r--r--clang/test/Modules/Inputs/module.map4
-rw-r--r--clang/test/Modules/ignored_macros.m22
3 files changed, 34 insertions, 0 deletions
diff --git a/clang/test/Modules/Inputs/ignored_macros.h b/clang/test/Modules/Inputs/ignored_macros.h
new file mode 100644
index 00000000000..250b58c2f70
--- /dev/null
+++ b/clang/test/Modules/Inputs/ignored_macros.h
@@ -0,0 +1,8 @@
+struct Point {
+ double x, y;
+};
+
+#ifdef IGNORED
+int *has_ignored(void);
+#endif
+
diff --git a/clang/test/Modules/Inputs/module.map b/clang/test/Modules/Inputs/module.map
index 55496fa35a2..234bfcc2b0f 100644
--- a/clang/test/Modules/Inputs/module.map
+++ b/clang/test/Modules/Inputs/module.map
@@ -159,3 +159,7 @@ module autolink {
module weird_objc {
header "weird_objc.h"
}
+
+module ignored_macros {
+ header "ignored_macros.h"
+}
diff --git a/clang/test/Modules/ignored_macros.m b/clang/test/Modules/ignored_macros.m
new file mode 100644
index 00000000000..1f9c27c2a36
--- /dev/null
+++ b/clang/test/Modules/ignored_macros.m
@@ -0,0 +1,22 @@
+// First trial: pass -DIGNORED=1 to both. It should be ignored in both
+// RUN: rm -rf %t.modules
+// RUN: %clang_cc1 -fmodule-cache-path %t.modules -DIGNORED=1 -fmodules -I %S/Inputs -emit-pch -o %t.pch -x objective-c-header %s -verify
+// RUN: %clang_cc1 -fmodule-cache-path %t.modules -DIGNORED=1 -fmodules -I %S/Inputs -include-pch %t.pch %s -verify
+
+// Second trial: pass -DIGNORED=1 only to the second invocation.
+// RUN: rm -rf %t.modules
+// RUN: %clang_cc1 -fmodule-cache-path %t.modules -fmodules -I %S/Inputs -emit-pch -o %t.pch -x objective-c-header %s -verify
+// RUN: not %clang_cc1 -fmodule-cache-path %t.modules -DIGNORED=1 -fmodules -I %S/Inputs -include-pch %t.pch %s > %t.err 2>&1
+// RUN: FileCheck -check-prefix=CHECK-CONFLICT %s < %t.err
+// CHECK-CONFLICT: module 'ignored_macros' found in both
+
+// expected-no-diagnostics
+
+#ifndef HEADER
+#define HEADER
+@import ignored_macros;
+#endif
+
+@import ignored_macros;
+
+struct Point p;
OpenPOWER on IntegriCloud