aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Lex/ModuleMap.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-11-11 22:18:48 +0000
committerDouglas Gregor <dgregor@apple.com>2011-11-11 22:18:48 +0000
commitab0c8a849a82bd5378d08320fb470f4d188acbe6 (patch)
treeea4b490a11120121e98086cb0026da17a1b2d2d0 /clang/lib/Lex/ModuleMap.cpp
parent28c1d1843471622daa408be21a86b52d90fae046 (diff)
downloadllvm-ab0c8a849a82bd5378d08320fb470f4d188acbe6.zip
llvm-ab0c8a849a82bd5378d08320fb470f4d188acbe6.tar.gz
llvm-ab0c8a849a82bd5378d08320fb470f4d188acbe6.tar.bz2
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. llvm-svn: 144410
Diffstat (limited to 'clang/lib/Lex/ModuleMap.cpp')
-rw-r--r--clang/lib/Lex/ModuleMap.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/clang/lib/Lex/ModuleMap.cpp b/clang/lib/Lex/ModuleMap.cpp
index 8adb220..7defe01 100644
--- a/clang/lib/Lex/ModuleMap.cpp
+++ b/clang/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);
}