summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2015-03-26 22:10:01 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2015-03-26 22:10:01 +0000
commit8f4d3ff1466a736d41e183c3275f634c129b9c09 (patch)
tree103a45d268aad62fc26b06275456db22694dfdb3 /clang/test
parent264899823fa15657971288b64393f4143d54197b (diff)
downloadbcm5719-llvm-8f4d3ff1466a736d41e183c3275f634c129b9c09.tar.gz
bcm5719-llvm-8f4d3ff1466a736d41e183c3275f634c129b9c09.zip
[modules] Restrict the module use-declaration to only appear in top-level
modules, and allow sub-modules of a module with a use-declaration to make use of the nominated modules. llvm-svn: 233323
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/Modules/Inputs/declare-use/module.map4
-rw-r--r--clang/test/Modules/Inputs/diagnostics-aux.modulemap1
-rw-r--r--clang/test/Modules/diagnostics.modulemap14
3 files changed, 11 insertions, 8 deletions
diff --git a/clang/test/Modules/Inputs/declare-use/module.map b/clang/test/Modules/Inputs/declare-use/module.map
index a74a7ae04a4..2dad0d061cf 100644
--- a/clang/test/Modules/Inputs/declare-use/module.map
+++ b/clang/test/Modules/Inputs/declare-use/module.map
@@ -3,7 +3,7 @@ module XA {
}
module XB {
- header "b.h"
+ module B { header "b.h" }
}
module XC {
@@ -43,7 +43,7 @@ module XG {
}
module XH {
- header "h.h"
+ module H { header "h.h" }
header "h1.h"
header "s.h"
use XC
diff --git a/clang/test/Modules/Inputs/diagnostics-aux.modulemap b/clang/test/Modules/Inputs/diagnostics-aux.modulemap
new file mode 100644
index 00000000000..d067d04d3d6
--- /dev/null
+++ b/clang/test/Modules/Inputs/diagnostics-aux.modulemap
@@ -0,0 +1 @@
+module foo {}
diff --git a/clang/test/Modules/diagnostics.modulemap b/clang/test/Modules/diagnostics.modulemap
index 14eb408aebb..aef094d3bf6 100644
--- a/clang/test/Modules/diagnostics.modulemap
+++ b/clang/test/Modules/diagnostics.modulemap
@@ -1,12 +1,14 @@
-// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fmodule-map-file=%s -fsyntax-only -x c++ /dev/null 2>&1
-//
-// RUN: cp %s %t-duplicate.modulemap
-// RUN: not %clang_cc1 -fmodules -fmodules-cache-path=%t -fmodule-map-file=%s -fmodule-map-file=%t-duplicate.modulemap -fsyntax-only -x c++ /dev/null 2>&1 | FileCheck --check-prefix=CHECK-DUPLICATE %s
+// RUN: not %clang_cc1 -fmodules -fmodules-cache-path=%t -fmodule-map-file=%S/Inputs/diagnostics-aux.modulemap -fmodule-map-file=%s -fsyntax-only -x c++ /dev/null 2>&1 | FileCheck %s
// PR22299: Ensure we can produce diagnostics for duplicate modules from -fmodule-map-file=.
//
-// CHECK-DUPLICATE: duplicate.modulemap:[[@LINE+2]]:8: error: redefinition of module 'foo'
-// CHECK-DUPLICATE: diagnostics.modulemap:[[@LINE+1]]:8: note: previously defined here
+// CHECK: diagnostics.modulemap:[[@LINE+2]]:8: error: redefinition of module 'foo'
+// CHECK: diagnostics-aux.modulemap:1:8: note: previously defined here
module foo {}
//* Check that we accept BCPL comments properly, not just as an extension. */
+
+module bad_use {
+ // CHECK: diagnostics.modulemap:[[@LINE+1]]:22: error: use declarations are only allowed in top-level modules
+ module submodule { use foo }
+}
OpenPOWER on IntegriCloud