[Serialization] Use a StringMap for registered buffers instead of a std::map.

Also, erase empty entries from the map once they've been loaded, just in
case we end up registering /more/ buffers later.

No intended functionality change.

Swift SVN r25202
This commit is contained in:
Jordan Rose
2015-02-11 23:07:46 +00:00
parent 8737bdde2e
commit b6a247cf06
2 changed files with 7 additions and 9 deletions

View File

@@ -331,13 +331,11 @@ Module *SerializedModuleLoader::loadModule(SourceLoc importLoc,
// FIXME: Right now this works only with access paths of length 1.
// Once submodules are designed, this needs to support suffix
// matching and a search path.
llvm::SmallString<256> spath;
for (auto el : path)
llvm::sys::path::append(spath, el.first.str());
auto bs = MemoryBuffers.find(spath.str());
if (bs != MemoryBuffers.end())
moduleInputBuffer.reset(bs->second.release());
auto bufIter = MemoryBuffers.find(moduleID.first.str());
if (bufIter != MemoryBuffers.end()) {
moduleInputBuffer = std::move(bufIter->second);
MemoryBuffers.erase(bufIter);
}
}
// Otherwise look on disk.