From fce887beb79780d0e0b19e8ab6176978a3dce9b8 Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Sat, 11 Jan 2020 16:42:41 +0000 Subject: [PATCH] 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. --- clang/lib/Serialization/GlobalModuleIndex.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/clang/lib/Serialization/GlobalModuleIndex.cpp b/clang/lib/Serialization/GlobalModuleIndex.cpp index 89a1c6c..462d29c 100644 --- a/clang/lib/Serialization/GlobalModuleIndex.cpp +++ b/clang/lib/Serialization/GlobalModuleIndex.cpp @@ -125,11 +125,12 @@ typedef llvm::OnDiskIterableChainedHashTable } -GlobalModuleIndex::GlobalModuleIndex(std::unique_ptr Buffer, - llvm::BitstreamCursor Cursor) - : Buffer(std::move(Buffer)), IdentifierIndex(), NumIdentifierLookups(), +GlobalModuleIndex::GlobalModuleIndex( + std::unique_ptr IndexBuffer, + llvm::BitstreamCursor Cursor) + : 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))); }; -- 2.7.4