aboutsummaryrefslogtreecommitdiff
path: root/lib/Lex/HeaderSearch.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-11-11 23:20:24 +0000
committerDouglas Gregor <dgregor@apple.com>2011-11-11 23:20:24 +0000
commit484535e45b4d301847a157e943c7823da5d40884 (patch)
tree9111b7b94c787c78c038ce5010cc70bd494cb58b /lib/Lex/HeaderSearch.cpp
parent9793e8f72a2d1f420bbbd97d41f7aaf727c26ca6 (diff)
Teach the search for modules to consider modules described by a module
map, so long as they have an umbrella header. This makes it possible to introduce a module map + umbrella header for a given set of headers, to turn it into a module. There are two major deficiencies here: first, we don't go hunting for module map files when we just see a module import (so we won't know about the modules described therein). Second, we don't yet have a way to build modules that don't have umbrella headers, or have incomplete umbrella headers. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144424 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/HeaderSearch.cpp')
-rw-r--r--lib/Lex/HeaderSearch.cpp12
1 files changed, 11 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 += '/';