GlobalModuleIndex - Fix use-after-move clang static analyzer warning.

Shadow variable names meant we were referencing the Buffer input argument, not the GlobalModuleIndex member that its std::move()'d it.
This commit is contained in:
Simon Pilgrim 2020-01-11 16:42:41 +00:00
parent bf03944d5d
commit fce887beb7
1 changed files with 5 additions and 4 deletions

View File

@ -125,11 +125,12 @@ typedef llvm::OnDiskIterableChainedHashTable<IdentifierIndexReaderTrait>
}
GlobalModuleIndex::GlobalModuleIndex(std::unique_ptr<llvm::MemoryBuffer> Buffer,
GlobalModuleIndex::GlobalModuleIndex(
std::unique_ptr<llvm::MemoryBuffer> IndexBuffer,
llvm::BitstreamCursor Cursor)
: Buffer(std::move(Buffer)), IdentifierIndex(), NumIdentifierLookups(),
: Buffer(std::move(IndexBuffer)), IdentifierIndex(), NumIdentifierLookups(),
NumIdentifierLookupHits() {
auto Fail = [&Buffer](llvm::Error &&Err) {
auto Fail = [&](llvm::Error &&Err) {
report_fatal_error("Module index '" + Buffer->getBufferIdentifier() +
"' failed: " + toString(std::move(Err)));
};