diff options
author | Ben Langmuir <blangmuir@apple.com> | 2014-04-04 16:42:53 +0000 |
---|---|---|
committer | Ben Langmuir <blangmuir@apple.com> | 2014-04-04 16:42:53 +0000 |
commit | 9aac3a0d7fef5158aa27fee7cc9f6fdc00288c85 (patch) | |
tree | c180098dd9723978fea49c4634af86cc0ac2d06c | |
parent | 117df18867d16299c5d7a1920e3112297cc66de7 (diff) | |
download | clang-9aac3a0d7fef5158aa27fee7cc9f6fdc00288c85.tar.gz clang-9aac3a0d7fef5158aa27fee7cc9f6fdc00288c85.tar.bz2 clang-9aac3a0d7fef5158aa27fee7cc9f6fdc00288c85.tar.xz |
Add a test where the module map is overriden in the vfs
Specifically, we pass two -ivfsoverlay yaml files, and the topmost one
remaps the module map file.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205632 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | test/VFS/Inputs/actual_module2.map | 5 | ||||
-rw-r--r-- | test/VFS/Inputs/vfsoverlay2.yaml | 12 | ||||
-rw-r--r-- | test/VFS/module-import.m | 17 |
3 files changed, 34 insertions, 0 deletions
diff --git a/test/VFS/Inputs/actual_module2.map b/test/VFS/Inputs/actual_module2.map new file mode 100644 index 0000000000..24f860299f --- /dev/null +++ b/test/VFS/Inputs/actual_module2.map @@ -0,0 +1,5 @@ +module not_real { + header "not_real.h" + export * + explicit module from_second_vfs { } +} diff --git a/test/VFS/Inputs/vfsoverlay2.yaml b/test/VFS/Inputs/vfsoverlay2.yaml new file mode 100644 index 0000000000..ae2a0ce4ec --- /dev/null +++ b/test/VFS/Inputs/vfsoverlay2.yaml @@ -0,0 +1,12 @@ +{ + 'version': 0, + 'roots': [ + { 'name': 'OUT_DIR', 'type': 'directory', + 'contents': [ + { 'name': 'module.map', 'type': 'file', + 'external-contents': 'INPUT_DIR/actual_module2.map' + } + ] + } + ] +} diff --git a/test/VFS/module-import.m b/test/VFS/module-import.m index 3cfd906d76..d2adcfedfa 100644 --- a/test/VFS/module-import.m +++ b/test/VFS/module-import.m @@ -8,3 +8,20 @@ void foo() { bar(); } + +// Import a submodule that is defined in actual_module2.map, which is only +// mapped in vfsoverlay2.yaml. +#ifdef IMPORT2 +@import not_real.from_second_module; +// CHECK-VFS2: error: no submodule +#endif + +// Override the module map (vfsoverlay2 on top) +// RUN: sed -e "s:INPUT_DIR:%S/Inputs:g" -e "s:OUT_DIR:%t:g" %S/Inputs/vfsoverlay2.yaml > %t2.yaml +// RUN: %clang_cc1 -Werror -fmodules -fmodules-cache-path=%t -ivfsoverlay %t.yaml -ivfsoverlay %t2.yaml -I %t -fsyntax-only %s + +// vfsoverlay2 not present +// RUN: not %clang_cc1 -Werror -fmodules -fmodules-cache-path=%t -ivfsoverlay %t.yaml -I %t -fsyntax-only %s -DIMPORT2 2>&1 | FileCheck -check-prefix=CHECK-VFS2 %s + +// vfsoverlay2 on the bottom +// RUN: not %clang_cc1 -Werror -fmodules -fmodules-cache-path=%t -ivfsoverlay %t2.yaml -ivfsoverlay %t.yaml -I %t -fsyntax-only %s -DIMPORT2 2>&1 | FileCheck -check-prefix=CHECK-VFS2 %s |