r205632 - Add a test where the module map is overriden in the vfs

Ben Langmuir blangmuir at apple.com
Fri Apr 4 09:42:54 PDT 2014


Author: benlangmuir
Date: Fri Apr  4 11:42:53 2014
New Revision: 205632

URL: http://llvm.org/viewvc/llvm-project?rev=205632&view=rev
Log:
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.

Added:
    cfe/trunk/test/VFS/Inputs/actual_module2.map
    cfe/trunk/test/VFS/Inputs/vfsoverlay2.yaml
Modified:
    cfe/trunk/test/VFS/module-import.m

Added: cfe/trunk/test/VFS/Inputs/actual_module2.map
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/VFS/Inputs/actual_module2.map?rev=205632&view=auto
==============================================================================
--- cfe/trunk/test/VFS/Inputs/actual_module2.map (added)
+++ cfe/trunk/test/VFS/Inputs/actual_module2.map Fri Apr  4 11:42:53 2014
@@ -0,0 +1,5 @@
+module not_real {
+  header "not_real.h"
+  export *
+  explicit module from_second_vfs { }
+}

Added: cfe/trunk/test/VFS/Inputs/vfsoverlay2.yaml
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/VFS/Inputs/vfsoverlay2.yaml?rev=205632&view=auto
==============================================================================
--- cfe/trunk/test/VFS/Inputs/vfsoverlay2.yaml (added)
+++ cfe/trunk/test/VFS/Inputs/vfsoverlay2.yaml Fri Apr  4 11:42:53 2014
@@ -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'
+        }
+      ]
+    }
+  ]
+}

Modified: cfe/trunk/test/VFS/module-import.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/VFS/module-import.m?rev=205632&r1=205631&r2=205632&view=diff
==============================================================================
--- cfe/trunk/test/VFS/module-import.m (original)
+++ cfe/trunk/test/VFS/module-import.m Fri Apr  4 11:42:53 2014
@@ -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
+ at 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





More information about the cfe-commits mailing list