summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization/ModuleManager.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2013-03-27 16:47:18 +0000
committerDouglas Gregor <dgregor@apple.com>2013-03-27 16:47:18 +0000
commitbf7fc9c542f2d7b47aaa5a387bbac5a25005c00e (patch)
tree420f4fc92dbde3650028a8bc112afc455891bb68 /clang/lib/Serialization/ModuleManager.cpp
parent0afce43be124b77e5efa7907cc150f1d80ac3f1d (diff)
downloadbcm5719-llvm-bf7fc9c542f2d7b47aaa5a387bbac5a25005c00e.tar.gz
bcm5719-llvm-bf7fc9c542f2d7b47aaa5a387bbac5a25005c00e.zip
<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
Diffstat (limited to 'clang/lib/Serialization/ModuleManager.cpp')
-rw-r--r--clang/lib/Serialization/ModuleManager.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/clang/lib/Serialization/ModuleManager.cpp b/clang/lib/Serialization/ModuleManager.cpp
index 193a38b9738..f3d53adafa5 100644
--- a/clang/lib/Serialization/ModuleManager.cpp
+++ b/clang/lib/Serialization/ModuleManager.cpp
@@ -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) {
OpenPOWER on IntegriCloud