[PATCH] D75311: [modules] Allow frameworks to have only a private module without a public one.
Volodymyr Sapsai via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 28 15:48:53 PST 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG4069dd14124e: [modules] Allow frameworks to have only a private module without a public one. (authored by vsapsai).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D75311/new/
https://reviews.llvm.org/D75311
Files:
clang/lib/Lex/HeaderSearch.cpp
clang/test/Modules/Inputs/implicit-private-without-public/DeprecatedModuleMapLocation.framework/PrivateHeaders/A.h
clang/test/Modules/Inputs/implicit-private-without-public/DeprecatedModuleMapLocation.framework/module_private.map
clang/test/Modules/Inputs/implicit-private-without-public/Foo.framework/Modules/module.private.modulemap
clang/test/Modules/Inputs/implicit-private-without-public/Foo.framework/PrivateHeaders/Foo_Priv.h
clang/test/Modules/implicit-private-without-public.m
Index: clang/test/Modules/implicit-private-without-public.m
===================================================================
--- /dev/null
+++ clang/test/Modules/implicit-private-without-public.m
@@ -0,0 +1,11 @@
+// REQUIRES: shell
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t \
+// RUN: -F%S/Inputs/implicit-private-without-public \
+// RUN: -fsyntax-only %s -verify
+
+ at import Foo_Private;
+
+// Private module map without a public one isn't supported for deprecated module map locations.
+ at import DeprecatedModuleMapLocation_Private;
+// expected-error at -1{{module 'DeprecatedModuleMapLocation_Private' not found}}
Index: clang/test/Modules/Inputs/implicit-private-without-public/Foo.framework/PrivateHeaders/Foo_Priv.h
===================================================================
--- /dev/null
+++ clang/test/Modules/Inputs/implicit-private-without-public/Foo.framework/PrivateHeaders/Foo_Priv.h
@@ -0,0 +1 @@
+void foo_private(void);
Index: clang/test/Modules/Inputs/implicit-private-without-public/Foo.framework/Modules/module.private.modulemap
===================================================================
--- /dev/null
+++ clang/test/Modules/Inputs/implicit-private-without-public/Foo.framework/Modules/module.private.modulemap
@@ -0,0 +1,4 @@
+framework module Foo_Private {
+ header "Foo_Priv.h"
+ export *
+}
Index: clang/test/Modules/Inputs/implicit-private-without-public/DeprecatedModuleMapLocation.framework/module_private.map
===================================================================
--- /dev/null
+++ clang/test/Modules/Inputs/implicit-private-without-public/DeprecatedModuleMapLocation.framework/module_private.map
@@ -0,0 +1,4 @@
+framework module DeprecatedModuleMapLocation_Private {
+ header "A.h"
+ export *
+}
Index: clang/test/Modules/Inputs/implicit-private-without-public/DeprecatedModuleMapLocation.framework/PrivateHeaders/A.h
===================================================================
--- /dev/null
+++ clang/test/Modules/Inputs/implicit-private-without-public/DeprecatedModuleMapLocation.framework/PrivateHeaders/A.h
@@ -0,0 +1 @@
+void a(void);
Index: clang/lib/Lex/HeaderSearch.cpp
===================================================================
--- clang/lib/Lex/HeaderSearch.cpp
+++ clang/lib/Lex/HeaderSearch.cpp
@@ -1568,6 +1568,16 @@
llvm::sys::path::append(ModuleMapFileName, "module.map");
if (auto F = FileMgr.getFile(ModuleMapFileName))
return *F;
+
+ // For frameworks, allow to have a private module map with a preferred
+ // spelling when a public module map is absent.
+ if (IsFramework) {
+ ModuleMapFileName = Dir->getName();
+ llvm::sys::path::append(ModuleMapFileName, "Modules",
+ "module.private.modulemap");
+ if (auto F = FileMgr.getFile(ModuleMapFileName))
+ return *F;
+ }
return nullptr;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75311.247383.patch
Type: text/x-patch
Size: 2907 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200228/bad5d4e6/attachment.bin>
More information about the cfe-commits
mailing list