summaryrefslogtreecommitdiffstats
path: root/clang/test/Modules/Inputs
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/Inputs
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/Inputs')
-rw-r--r--clang/test/Modules/Inputs/diamond_bottom.h3
-rw-r--r--clang/test/Modules/Inputs/diamond_left.h2
-rw-r--r--clang/test/Modules/Inputs/diamond_right.h2
-rw-r--r--clang/test/Modules/Inputs/load_failure.h1
4 files changed, 8 insertions, 0 deletions
diff --git a/clang/test/Modules/Inputs/diamond_bottom.h b/clang/test/Modules/Inputs/diamond_bottom.h
index 40afc9b1523..6351d028fbc 100644
--- a/clang/test/Modules/Inputs/diamond_bottom.h
+++ b/clang/test/Modules/Inputs/diamond_bottom.h
@@ -1 +1,4 @@
+__import__ diamond_left;
+__import__ diamond_right;
+
char bottom(char *x);
diff --git a/clang/test/Modules/Inputs/diamond_left.h b/clang/test/Modules/Inputs/diamond_left.h
index 9758b85d974..8da494cccad 100644
--- a/clang/test/Modules/Inputs/diamond_left.h
+++ b/clang/test/Modules/Inputs/diamond_left.h
@@ -1,3 +1,5 @@
+__import__ diamond_top;
+
float left(float *);
int top_left(char *c);
diff --git a/clang/test/Modules/Inputs/diamond_right.h b/clang/test/Modules/Inputs/diamond_right.h
index 9adeb6a9a89..2efa277b1a9 100644
--- a/clang/test/Modules/Inputs/diamond_right.h
+++ b/clang/test/Modules/Inputs/diamond_right.h
@@ -1,3 +1,5 @@
+__import__ diamond_top;
+
double right(double *);
struct left_and_right {
diff --git a/clang/test/Modules/Inputs/load_failure.h b/clang/test/Modules/Inputs/load_failure.h
new file mode 100644
index 00000000000..5bcb44dcb3d
--- /dev/null
+++ b/clang/test/Modules/Inputs/load_failure.h
@@ -0,0 +1 @@
+int fail(int);
OpenPOWER on IntegriCloud