[clang-tools-extra] r320695 - [clangd] Fix a potential use-after-move bug.

Eric Liu via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 14 04:31:04 PST 2017


Author: ioeric
Date: Thu Dec 14 04:31:04 2017
New Revision: 320695

URL: http://llvm.org/viewvc/llvm-project?rev=320695&view=rev
Log:
[clangd] Fix a potential use-after-move bug.

Modified:
    clang-tools-extra/trunk/unittests/clangd/IndexTests.cpp

Modified: clang-tools-extra/trunk/unittests/clangd/IndexTests.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clangd/IndexTests.cpp?rev=320695&r1=320694&r2=320695&view=diff
==============================================================================
--- clang-tools-extra/trunk/unittests/clangd/IndexTests.cpp (original)
+++ clang-tools-extra/trunk/unittests/clangd/IndexTests.cpp Thu Dec 14 04:31:04 2017
@@ -48,7 +48,8 @@ generateNumSymbols(int Begin, int End,
   for (const auto &Sym : Slab->Slab)
     Slab->Pointers.push_back(&Sym.second);
 
-  return {std::move(Slab), &Slab->Pointers};
+  auto *Pointers = &Slab->Pointers;
+  return {std::move(Slab), Pointers};
 }
 
 std::vector<std::string> match(const SymbolIndex &I,




More information about the cfe-commits mailing list