diff options
Diffstat (limited to 'lib/Lex')
-rw-r--r-- | lib/Lex/HeaderSearch.cpp | 12 | ||||
-rw-r--r-- | lib/Lex/ModuleMap.cpp | 8 |
2 files changed, 19 insertions, 1 deletions
diff --git a/lib/Lex/HeaderSearch.cpp b/lib/Lex/HeaderSearch.cpp index 4522de5cf3..3f50285430 100644 --- a/lib/Lex/HeaderSearch.cpp +++ b/lib/Lex/HeaderSearch.cpp @@ -127,9 +127,19 @@ const FileEntry *HeaderSearch::lookupModule(StringRef ModuleName, if (!UmbrellaHeader) return 0; + // Look in the module map to determine if there is a module by this name + // that has an umbrella header. + // FIXME: Even if it doesn't have an umbrella header, we should be able to + // handle the module. However, the caller isn't ready for that yet. + if (ModuleMap::Module *Module = ModMap.findModule(ModuleName)) { + if (Module->UmbrellaHeader) { + *UmbrellaHeader = Module->UmbrellaHeader->getName(); + return 0; + } + } + // Look in each of the framework directories for an umbrella header with // the same name as the module. - // FIXME: We need a way for non-frameworks to provide umbrella headers. llvm::SmallString<128> UmbrellaHeaderName; UmbrellaHeaderName = ModuleName; UmbrellaHeaderName += '/'; diff --git a/lib/Lex/ModuleMap.cpp b/lib/Lex/ModuleMap.cpp index 7defe01a67..6695e42150 100644 --- a/lib/Lex/ModuleMap.cpp +++ b/lib/Lex/ModuleMap.cpp @@ -84,6 +84,14 @@ ModuleMap::Module *ModuleMap::findModuleForHeader(const FileEntry *File) { return 0; } +ModuleMap::Module *ModuleMap::findModule(StringRef Name) { + llvm::StringMap<Module *>::iterator Known = Modules.find(Name); + if (Known != Modules.end()) + return Known->getValue(); + + return 0; +} + static void indent(llvm::raw_ostream &OS, unsigned Spaces) { OS << std::string(' ', Spaces); } |