<rdar://problem/13509689> Introduce -module-file-info option that provides information about a particular module file.

This option can be useful for end users who want to know why they
ended up with a ton of different variants of the "std" module in their
module cache. This problem should go away over time, as we reduce the
need for module variants, but it will never go away entirely.

llvm-svn: 178148
This commit is contained in:
Douglas Gregor
2013-03-27 16:47:18 +00:00
parent 0afce43be1
commit bf7fc9c542
18 changed files with 234 additions and 10 deletions

View File

@@ -29,7 +29,19 @@ using namespace serialization;
ModuleFile *ModuleManager::lookup(StringRef Name) {
const FileEntry *Entry = FileMgr.getFile(Name, /*openFile=*/false,
/*cacheFailure=*/false);
return Modules[Entry];
if (Entry)
return lookup(Entry);
return 0;
}
ModuleFile *ModuleManager::lookup(const FileEntry *File) {
llvm::DenseMap<const FileEntry *, ModuleFile *>::iterator Known
= Modules.find(File);
if (Known == Modules.end())
return 0;
return Known->second;
}
llvm::MemoryBuffer *ModuleManager::lookupBuffer(StringRef Name) {