summaryrefslogtreecommitdiffstats
path: root/clang/test/Modules/macro-reexport.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2015-01-22 23:07:47 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2015-01-22 23:07:47 +0000
commit999500a26dfb1285bb9ea4dc489f49f7809d09d9 (patch)
tree0f3a34d577a2e23ee65f777b23baea9b9305bb5b /clang/test/Modules/macro-reexport.cpp
parente8b5e49ffd3f21f80bceab0f9baeb35331106d55 (diff)
downloadbcm5719-llvm-999500a26dfb1285bb9ea4dc489f49f7809d09d9.tar.gz
bcm5719-llvm-999500a26dfb1285bb9ea4dc489f49f7809d09d9.zip
Reorganize test/Modules:
* Put all input files under Inputs/, move corresponding tests into test/Modules. * Rename a modulemap test file to [...].modulemap, and teach lit that such files are tests. llvm-svn: 226875
Diffstat (limited to 'clang/test/Modules/macro-reexport.cpp')
-rw-r--r--clang/test/Modules/macro-reexport.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/clang/test/Modules/macro-reexport.cpp b/clang/test/Modules/macro-reexport.cpp
new file mode 100644
index 00000000000..1df49b948d3
--- /dev/null
+++ b/clang/test/Modules/macro-reexport.cpp
@@ -0,0 +1,30 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fsyntax-only -DC1 -I%S/Inputs/macro-reexport %s -fmodules-cache-path=%t -verify
+// RUN: %clang_cc1 -fsyntax-only -DC1 -I%S/Inputs/macro-reexport -fmodules %s -fmodules-cache-path=%t -verify
+// RUN: %clang_cc1 -fsyntax-only -DD1 -I%S/Inputs/macro-reexport %s -fmodules-cache-path=%t -verify
+// RUN: %clang_cc1 -fsyntax-only -DD1 -I%S/Inputs/macro-reexport -fmodules %s -fmodules-cache-path=%t -verify
+// RUN: %clang_cc1 -fsyntax-only -DD2 -I%S/Inputs/macro-reexport %s -fmodules-cache-path=%t -verify
+// RUN: %clang_cc1 -fsyntax-only -DD2 -I%S/Inputs/macro-reexport -fmodules %s -fmodules-cache-path=%t -verify
+// RUN: %clang_cc1 -fsyntax-only -DF1 -I%S/Inputs/macro-reexport %s -fmodules-cache-path=%t -verify
+// RUN: %clang_cc1 -fsyntax-only -DF1 -I%S/Inputs/macro-reexport -fmodules %s -fmodules-cache-path=%t -verify
+
+#if defined(F1)
+#include "f1.h"
+void f() { return assert(true); } // expected-error {{undeclared identifier 'd'}}
+#include "e2.h" // undefines d1's macro
+void g() { return assert(true); } // expected-error {{undeclared identifier 'assert'}}
+#elif defined(D1)
+#include "e1.h" // undefines c1's macro but not d1's macro
+#include "d1.h"
+void f() { return assert(true); } // expected-error {{undeclared identifier 'd'}}
+#include "e2.h" // undefines d1's macro
+void g() { return assert(true); } // expected-error {{undeclared identifier 'assert'}}
+#elif defined(D2)
+#include "d2.h"
+void f() { return assert(true); } // expected-error {{undeclared identifier 'b'}}
+#else
+// e2 undefines d1's macro, which overrides c1's macro.
+#include "e2.h"
+#include "c1.h"
+void f() { return assert(true); } // expected-error {{undeclared identifier 'assert'}}
+#endif
OpenPOWER on IntegriCloud