summaryrefslogtreecommitdiffstats
path: root/clang/test/Modules/declare-use2.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2013-09-24 09:14:14 +0000
committerDaniel Jasper <djasper@google.com>2013-09-24 09:14:14 +0000
commitba7f2f7110c201e3564e89bd306e058aa9c6b881 (patch)
tree8f90b26f22d7dccaa4a21ed9d63f101ea2f090dc /clang/test/Modules/declare-use2.cpp
parent22127cee34f0d2cf816fed14875e8e1ac12eee3c (diff)
downloadbcm5719-llvm-ba7f2f7110c201e3564e89bd306e058aa9c6b881.tar.gz
bcm5719-llvm-ba7f2f7110c201e3564e89bd306e058aa9c6b881.zip
Module use declarations (II)
Review: http://llvm-reviews.chandlerc.com/D1546. I have picked up this patch form Lawrence (http://llvm-reviews.chandlerc.com/D1063) and did a few changes. From the original change description (updated as appropriate): This patch adds a check that ensures that modules only use modules they have so declared. To this end, it adds a statement on intended module use to the module.map grammar: use module-id A module can then only use headers from other modules if it 'uses' them. This enforcement is off by default, but may be turned on with the new option -fmodules-decluse. When enforcing the module semantics, we also need to consider a source file part of a module. This is achieved with a compiler option -fmodule-name=<module-id>. The compiler at present only applies restrictions to the module directly being built. llvm-svn: 191283
Diffstat (limited to 'clang/test/Modules/declare-use2.cpp')
-rw-r--r--clang/test/Modules/declare-use2.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/test/Modules/declare-use2.cpp b/clang/test/Modules/declare-use2.cpp
new file mode 100644
index 00000000000..807962cbdb4
--- /dev/null
+++ b/clang/test/Modules/declare-use2.cpp
@@ -0,0 +1,7 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -x objective-c++ -fmodules-cache-path=%t -fmodules -fmodules-decluse -fmodule-name=H -I %S/Inputs/declare-use %s -verify
+
+#include "h.h"
+#include "e.h"
+#include "f.h" // expected-error {{use of a module not declared used}}
+const int h2 = h1+e+f;
OpenPOWER on IntegriCloud