mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[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:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user