diff options
author | Manman Ren <manman.ren@gmail.com> | 2016-08-26 17:16:46 +0000 |
---|---|---|
committer | Manman Ren <manman.ren@gmail.com> | 2016-08-26 17:16:46 +0000 |
commit | 5423d8c4fc3b8ba5756f2e16479552191d59e992 (patch) | |
tree | d63d1c4d4ea7b00b33a8776b3f5d815b79135975 /test/VFS | |
parent | 216f66475925c7338f67bb87ba613d87884a18e0 (diff) |
Don't diagnose non-modular includes when we are not compiling a module.
This is triggered when we are compiling an implementation of a module,
it has relative includes to a VFS-mapped module with umbrella headers.
Currently we will find the real path to headers under the umbrella directory,
but the umbrella directories are using virtual path.
rdar://27951255
Thanks Ben and Richard for reviewing the patch!
Differential Revision: http://reviews.llvm.org/D23858
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@279838 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/VFS')
-rw-r--r-- | test/VFS/Inputs/Nonmodular/A.h | 1 | ||||
-rw-r--r-- | test/VFS/Inputs/Nonmodular/Nonmodular.modulemap | 5 | ||||
-rw-r--r-- | test/VFS/Inputs/Nonmodular/nonmodular-headers.yaml | 34 | ||||
-rw-r--r-- | test/VFS/Inputs/Nonmodular/test.c | 3 | ||||
-rw-r--r-- | test/VFS/Inputs/Nonmodular/umbrella.h | 5 | ||||
-rw-r--r-- | test/VFS/test_nonmodular.c | 11 |
6 files changed, 59 insertions, 0 deletions
diff --git a/test/VFS/Inputs/Nonmodular/A.h b/test/VFS/Inputs/Nonmodular/A.h new file mode 100644 index 0000000000..975f1f0437 --- /dev/null +++ b/test/VFS/Inputs/Nonmodular/A.h @@ -0,0 +1 @@ +// A.h diff --git a/test/VFS/Inputs/Nonmodular/Nonmodular.modulemap b/test/VFS/Inputs/Nonmodular/Nonmodular.modulemap new file mode 100644 index 0000000000..91f16902d5 --- /dev/null +++ b/test/VFS/Inputs/Nonmodular/Nonmodular.modulemap @@ -0,0 +1,5 @@ +framework module Nonmodular [extern_c] { + umbrella header "umbrella.h" + export * + module * { export * } +} diff --git a/test/VFS/Inputs/Nonmodular/nonmodular-headers.yaml b/test/VFS/Inputs/Nonmodular/nonmodular-headers.yaml new file mode 100644 index 0000000000..a041728752 --- /dev/null +++ b/test/VFS/Inputs/Nonmodular/nonmodular-headers.yaml @@ -0,0 +1,34 @@ +{ + 'version': 0, + 'case-sensitive': 'false', + 'ignore-non-existent-contents': 'true', + 'roots': [ + { + 'type': 'directory', + 'name': "VDIR/Nonmodular.framework/Headers", + 'contents': [ + { + 'type': 'file', + 'name': "umbrella.h", + 'external-contents': "IN_DIR/Inputs/Nonmodular/umbrella.h" + }, + { + 'type': 'file', + 'name': "A.h", + 'external-contents': "IN_DIR/Inputs/Nonmodular/A.h" + } + ] + }, + { + 'type': 'directory', + 'name': "VDIR/Nonmodular.framework/Modules", + 'contents': [ + { + 'type': 'file', + 'name': "module.modulemap", + 'external-contents': "OUT_DIR/module.modulemap" + } + ] + } + ] +} diff --git a/test/VFS/Inputs/Nonmodular/test.c b/test/VFS/Inputs/Nonmodular/test.c new file mode 100644 index 0000000000..62807d0264 --- /dev/null +++ b/test/VFS/Inputs/Nonmodular/test.c @@ -0,0 +1,3 @@ +// expected-no-diagnostics + +#include "umbrella.h" diff --git a/test/VFS/Inputs/Nonmodular/umbrella.h b/test/VFS/Inputs/Nonmodular/umbrella.h new file mode 100644 index 0000000000..bb79a62ec0 --- /dev/null +++ b/test/VFS/Inputs/Nonmodular/umbrella.h @@ -0,0 +1,5 @@ +#ifndef __umbrella_h__ +#define __umbrella_h__ + +#include <Nonmodular/A.h> +#endif diff --git a/test/VFS/test_nonmodular.c b/test/VFS/test_nonmodular.c new file mode 100644 index 0000000000..cff4de7518 --- /dev/null +++ b/test/VFS/test_nonmodular.c @@ -0,0 +1,11 @@ +// REQUIRES: shell + +// RUN: rm -rf %t +// RUN: mkdir -p %t/vdir %t/cache %t/outdir +// We can't have module.map inside Inputs/Nonmodular. +// RUN: cp %S/Inputs/Nonmodular/Nonmodular.modulemap %t/outdir/module.modulemap +// +// RUN: sed -e "s:VDIR:%t/vdir:g" -e "s:IN_DIR:%S:g" -e "s:OUT_DIR:%t/outdir:g" %S/Inputs/Nonmodular/nonmodular-headers.yaml > %t/vdir/nonmodular-headers.yaml +// RUN: %clang_cc1 -fmodule-name=Nonmodular -fmodules -Wnon-modular-include-in-framework-module -verify -fimplicit-module-maps -fmodules-cache-path=%t/cache -ivfsoverlay %t/vdir/nonmodular-headers.yaml -I %S/Inputs -F %t/vdir -fsyntax-only %S/Inputs/Nonmodular/test.c + +// expected-no-diagnostics |