summaryrefslogtreecommitdiffstats
path: root/clang/test/Modules/diamond.c
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-08-26 23:56:07 +0000
committerDouglas Gregor <dgregor@apple.com>2011-08-26 23:56:07 +0000
commit081425343b18b6e057a89ab92d89984257fda370 (patch)
tree6ae7a52d845ed55452708f03c683cac75e028a26 /clang/test/Modules/diamond.c
parent24281181bd847f79b6224572b6e9053d39b72dd3 (diff)
downloadbcm5719-llvm-081425343b18b6e057a89ab92d89984257fda370.tar.gz
bcm5719-llvm-081425343b18b6e057a89ab92d89984257fda370.zip
Introduce support for a simple module import declaration, which
loads the named module. The syntax itself is intentionally hideous and will be replaced at some later point with something more palatable. For now, we're focusing on the semantics: - Module imports are handled first by the preprocessor (to get macro definitions) and then the same tokens are also handled by the parser (to get declarations). If both happen (as in normal compilation), the second one is redundant, because we currently have no way to hide macros or declarations when loading a module. Chris gets credit for this mad-but-workable scheme. - The Preprocessor now holds on to a reference to a module loader, which is responsible for loading named modules. CompilerInstance is the only important module loader: it now knows how to create and wire up an AST reader on demand to actually perform the module load. - We search for modules in the include path, using the module name with the suffix ".pcm" (precompiled module) for the file name. This is a temporary hack; we hope to improve the situation in the future. llvm-svn: 138679
Diffstat (limited to 'clang/test/Modules/diamond.c')
-rw-r--r--clang/test/Modules/diamond.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/clang/test/Modules/diamond.c b/clang/test/Modules/diamond.c
index f9b283a9d24..94381f2033a 100644
--- a/clang/test/Modules/diamond.c
+++ b/clang/test/Modules/diamond.c
@@ -1,4 +1,10 @@
+
+
+
// in diamond-bottom.h: expected-note{{passing argument to parameter 'x' here}}
+
+__import__ diamond_bottom;
+
void test_diamond(int i, float f, double d, char c) {
top(&i);
left(&f);
@@ -14,8 +20,8 @@ void test_diamond(int i, float f, double d, char c) {
lr.left = 17;
}
-// RUN: %clang_cc1 -emit-pch -o %t_top.h.pch %S/Inputs/diamond_top.h
-// RUN: %clang_cc1 -import-module %t_top.h.pch -emit-pch -o %t_left.h.pch %S/Inputs/diamond_left.h
-// RUN: %clang_cc1 -import-module %t_top.h.pch -emit-pch -o %t_right.h.pch %S/Inputs/diamond_right.h
-// RUN: %clang_cc1 -import-module %t_left.h.pch -import-module %t_right.h.pch -emit-pch -o %t_bottom.h.pch %S/Inputs/diamond_bottom.h
-// RUN: %clang_cc1 -import-module %t_bottom.h.pch -verify %s
+// RUN: %clang_cc1 -emit-module -o %T/diamond_top.pcm %S/Inputs/diamond_top.h
+// RUN: %clang_cc1 -I %T -emit-module -o %T/diamond_left.pcm %S/Inputs/diamond_left.h
+// RUN: %clang_cc1 -I %T -emit-module -o %T/diamond_right.pcm %S/Inputs/diamond_right.h
+// RUN: %clang_cc1 -I %T -emit-module -o %T/diamond_bottom.pcm %S/Inputs/diamond_bottom.h
+// RUN: %clang_cc1 -I %T %s -verify
OpenPOWER on IntegriCloud