From 9aac3a0d7fef5158aa27fee7cc9f6fdc00288c85 Mon Sep 17 00:00:00 2001 From: Ben Langmuir Date: Fri, 4 Apr 2014 16:42:53 +0000 Subject: [PATCH] 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 --- test/VFS/Inputs/actual_module2.map | 5 +++++ test/VFS/Inputs/vfsoverlay2.yaml | 12 ++++++++++++ test/VFS/module-import.m | 17 +++++++++++++++++ 3 files changed, 34 insertions(+) create mode 100644 test/VFS/Inputs/actual_module2.map create mode 100644 test/VFS/Inputs/vfsoverlay2.yaml 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 -- 2.40.0