From 65f3b5e99009f49d51eb00a859dbd2c2ee660718 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Fri, 11 Nov 2011 22:18:48 +0000 Subject: 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 --- lib/Lex/ModuleMap.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'lib/Lex/ModuleMap.cpp') 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::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); } -- cgit v1.2.3-18-g5258