diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-11-11 22:18:48 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-11-11 22:18:48 +0000 |
commit | 65f3b5e99009f49d51eb00a859dbd2c2ee660718 (patch) | |
tree | bfe0e47aa7bbb690bd96e44adb23a058e196fd07 /lib/Lex/ModuleMap.cpp | |
parent | 8b6d3deb5af464e1afbbeccdec369c5d4252b1a0 (diff) |
Wire up the mapping from header files mentioned in module maps over to
the corresponding (top-level) modules. This isn't actually useful yet,
because we don't yet have a way to build modules out of module maps.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144410 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/ModuleMap.cpp')
-rw-r--r-- | lib/Lex/ModuleMap.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/Lex/ModuleMap.cpp b/lib/Lex/ModuleMap.cpp index 8adb22014b..7defe01a67 100644 --- a/lib/Lex/ModuleMap.cpp +++ b/lib/Lex/ModuleMap.cpp @@ -51,6 +51,14 @@ std::string ModuleMap::Module::getFullModuleName() const { return Result; } +StringRef ModuleMap::Module::getTopLevelModuleName() const { + const Module *Top = this; + while (Top->Parent) + Top = Top->Parent; + + return Top->Name; +} + //----------------------------------------------------------------------------// // Module map //----------------------------------------------------------------------------// @@ -67,6 +75,15 @@ ModuleMap::~ModuleMap() { delete SourceMgr; } +ModuleMap::Module *ModuleMap::findModuleForHeader(const FileEntry *File) { + llvm::DenseMap<const FileEntry *, Module *>::iterator Known + = Headers.find(File); + if (Known != Headers.end()) + return Known->second; + + return 0; +} + static void indent(llvm::raw_ostream &OS, unsigned Spaces) { OS << std::string(' ', Spaces); } |