diff options
Diffstat (limited to 'lib/Lex/ModuleMap.cpp')
| -rw-r--r-- | lib/Lex/ModuleMap.cpp | 31 | 
1 files changed, 19 insertions, 12 deletions
| diff --git a/lib/Lex/ModuleMap.cpp b/lib/Lex/ModuleMap.cpp index 1488f624da64..4f3db8dd6436 100644 --- a/lib/Lex/ModuleMap.cpp +++ b/lib/Lex/ModuleMap.cpp @@ -554,16 +554,17 @@ Module *ModuleMap::lookupModuleQualified(StringRef Name, Module *Context) const{    return Context->findSubmodule(Name);  } -std::pair<Module *, bool>  -ModuleMap::findOrCreateModule(StringRef Name, Module *Parent, bool IsFramework, -                              bool IsExplicit) { +std::pair<Module *, bool> ModuleMap::findOrCreateModule(StringRef Name, +                                                        Module *Parent, +                                                        bool IsFramework, +                                                        bool IsExplicit) {    // Try to find an existing module with this name.    if (Module *Sub = lookupModuleQualified(Name, Parent))      return std::make_pair(Sub, false);    // Create a new module with this name. -  Module *Result = new Module(Name, SourceLocation(), Parent, -                              IsFramework, IsExplicit, NumCreatedModules++); +  Module *Result = new Module(Name, SourceLocation(), Parent, IsFramework, +                              IsExplicit, NumCreatedModules++);    if (!Parent) {      if (LangOpts.CurrentModule == Name)        SourceModule = Result; @@ -1839,7 +1840,7 @@ void ModuleMapParser::parseHeaderDecl(MMToken::TokenKind LeadingToken,    Module::UnresolvedHeaderDirective Header;    Header.FileName = Tok.getString();    Header.FileNameLoc = consumeToken(); -   +    // Check whether we already have an umbrella.    if (LeadingToken == MMToken::UmbrellaKeyword && ActiveModule->Umbrella) {      Diags.Report(Header.FileNameLoc, diag::err_mmap_umbrella_clash) @@ -1859,19 +1860,25 @@ void ModuleMapParser::parseHeaderDecl(MMToken::TokenKind LeadingToken,      // Search for the header file within the search directory.      SmallString<128> FullPathName(Directory->getName());      unsigned FullPathLength = FullPathName.size(); -     +      if (ActiveModule->isPartOfFramework()) {        appendSubframeworkPaths(ActiveModule, RelativePathName); -       +      unsigned RelativePathLength = RelativePathName.size(); +        // Check whether this file is in the public headers.        llvm::sys::path::append(RelativePathName, "Headers", Header.FileName);        llvm::sys::path::append(FullPathName, RelativePathName);        File = SourceMgr.getFileManager().getFile(FullPathName); -       + +      // Check whether this file is in the private headers.        if (!File) { -        // Check whether this file is in the private headers. -        // FIXME: Should we retain the subframework paths here? -        RelativePathName.clear(); +        // Ideally, private modules in the form 'FrameworkName.Private' should +        // be defined as 'module FrameworkName.Private', and not as +        // 'framework module FrameworkName.Private', since a 'Private.Framework' +        // does not usually exist. However, since both are currently widely used +        // for private modules, make sure we find the right path in both cases. +        RelativePathName.resize(ActiveModule->IsFramework ? 0 +                                                          : RelativePathLength);          FullPathName.resize(FullPathLength);          llvm::sys::path::append(RelativePathName, "PrivateHeaders",                                  Header.FileName); | 
