summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVolodymyr Sapsai <vsapsai@apple.com>2018-11-16 01:18:04 +0000
committerVolodymyr Sapsai <vsapsai@apple.com>2018-11-16 01:18:04 +0000
commit7c5c3b1e0ececabc87c70c78495e9ee944d5c439 (patch)
treeb46f0cfaeaeda1d181c95d33ee20d346ac5ceaf0
parent5802b82b408dbe784ca4d09817a78924fa7ab4c3 (diff)
downloadbcm5719-llvm-7c5c3b1e0ececabc87c70c78495e9ee944d5c439.tar.gz
bcm5719-llvm-7c5c3b1e0ececabc87c70c78495e9ee944d5c439.zip
[VFS] Implement `RedirectingFileSystem::getRealPath`.
It fixes the case when Objective-C framework is added as a subframework through a symlink. When parent framework infers a module map and fails to detect a symlink, it would add a subframework as a submodule. And when we parse module map for the subframework, we would encounter an error like > error: umbrella for module 'WithSubframework.Foo' already covers this directory By implementing `getRealPath` "an egregious but useful hack" in `ModuleMap::inferFrameworkModule` works as expected. LLVM commit is r347009. rdar://problem/45821279 Reviewers: bruno, benlangmuir, erik.pilkington Reviewed By: bruno Subscribers: hiraditya, dexonsmith, JDevlieghere, cfe-commits, llvm-commits Differential Revision: https://reviews.llvm.org/D54245 llvm-svn: 347012
-rw-r--r--clang/test/VFS/subframework-symlink.m23
1 files changed, 23 insertions, 0 deletions
diff --git a/clang/test/VFS/subframework-symlink.m b/clang/test/VFS/subframework-symlink.m
new file mode 100644
index 00000000000..1c6fd064093
--- /dev/null
+++ b/clang/test/VFS/subframework-symlink.m
@@ -0,0 +1,23 @@
+// REQUIRES: shell
+
+// Test that when a subframework is a symlink to another framework, we don't
+// add it as a submodule to the enclosing framework. We also need to make clang
+// to infer module for the enclosing framework. For this we don't have
+// a module map for the framework itself but have it in a parent directory.
+//
+// RUN: rm -rf %t
+// RUN: mkdir %t
+// RUN: echo 'framework module * {}' > %t/module.modulemap
+// RUN: mkdir -p %t/WithSubframework.framework/Headers
+// RUN: echo '#include <Foo/Foo.h>' > %t/WithSubframework.framework/Headers/WithSubframework.h
+// RUN: cp -R %S/Inputs/Foo.framework %t
+// RUN: mkdir -p %t/WithSubframework.framework/Frameworks
+// RUN: ln -s %t/Foo.framework %t/WithSubframework.framework/Frameworks
+// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/cache1 -F %t -fsyntax-only %s
+
+// Adding VFS overlay shouldn't change this behavior.
+//
+// RUN: sed -e "s:INPUT_DIR:/InvalidPath:g" -e "s:OUT_DIR:/InvalidPath:g" %S/Inputs/vfsoverlay.yaml > %t/overlay.yaml
+// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/cache2 -F %t -fsyntax-only %s -ivfsoverlay %t/overlay.yaml
+
+#import <WithSubframework/WithSubframework.h>
OpenPOWER on IntegriCloud