Commit 4069dd14 authored by Volodymyr Sapsai's avatar Volodymyr Sapsai
Browse files

[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
parent 7d973307
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -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;
}

+1 −0
Original line number Diff line number Diff line
void a(void);
+4 −0
Original line number Diff line number Diff line
framework module DeprecatedModuleMapLocation_Private {
  header "A.h"
  export *
}
+4 −0
Original line number Diff line number Diff line
framework module Foo_Private {
  header "Foo_Priv.h"
  export *
}
+1 −0
Original line number Diff line number Diff line
void foo_private(void);
Loading