[llvm-branch-commits] [clang-tools-extra] 6553600 - [clangd] Fix use-after-free in ProjectAwareIndex tests

Kadir Cetinkaya via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sun Nov 22 12:35:03 PST 2020


Author: Kadir Cetinkaya
Date: 2020-11-22T21:29:45+01:00
New Revision: 655360096f27f25a0e2f71729c1c879f1fd8d8a2

URL: https://github.com/llvm/llvm-project/commit/655360096f27f25a0e2f71729c1c879f1fd8d8a2
DIFF: https://github.com/llvm/llvm-project/commit/655360096f27f25a0e2f71729c1c879f1fd8d8a2.diff

LOG: [clangd] Fix use-after-free in ProjectAwareIndex tests

Added: 
    

Modified: 
    clang-tools-extra/clangd/unittests/ProjectAwareIndexTests.cpp

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clangd/unittests/ProjectAwareIndexTests.cpp b/clang-tools-extra/clangd/unittests/ProjectAwareIndexTests.cpp
index 8adac296ee60..0d14d2ed5d54 100644
--- a/clang-tools-extra/clangd/unittests/ProjectAwareIndexTests.cpp
+++ b/clang-tools-extra/clangd/unittests/ProjectAwareIndexTests.cpp
@@ -27,9 +27,9 @@ using testing::ElementsAre;
 using testing::IsEmpty;
 
 std::unique_ptr<SymbolIndex> createIndex() {
-  std::vector<Symbol> Symbols = {symbol("1")};
-  return std::make_unique<MemIndex>(std::move(Symbols), RefSlab(),
-                                    RelationSlab());
+  SymbolSlab::Builder Builder;
+  Builder.insert(symbol("1"));
+  return MemIndex::build(std::move(Builder).build(), RefSlab(), RelationSlab());
 }
 
 TEST(ProjectAware, Test) {


        


More information about the llvm-branch-commits mailing list