forked from OSchip/llvm-project
[modules] Allow frameworks to have only a private module without a public one.
Support only preferred spelling 'Modules/module.private.modulemap' and not the deprecated 'module_private.map'. rdar://problem/57715533 Reviewed By: bruno Differential Revision: https://reviews.llvm.org/D75311
This commit is contained in:
parent
7d973307d5
commit
4069dd1412
|
@ -1568,6 +1568,16 @@ HeaderSearch::lookupModuleMapFile(const DirectoryEntry *Dir, bool IsFramework) {
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
void a(void);
|
|
@ -0,0 +1,4 @@
|
|||
framework module DeprecatedModuleMapLocation_Private {
|
||||
header "A.h"
|
||||
export *
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
framework module Foo_Private {
|
||||
header "Foo_Priv.h"
|
||||
export *
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
void foo_private(void);
|
|
@ -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
|
||||
|
||||
@import Foo_Private;
|
||||
|
||||
// Private module map without a public one isn't supported for deprecated module map locations.
|
||||
@import DeprecatedModuleMapLocation_Private;
|
||||
// expected-error@-1{{module 'DeprecatedModuleMapLocation_Private' not found}}
|
Loading…
Reference in New Issue