This revision was automatically updated to reflect the committed changes. Closed by commit rCTE355091: Use ArrayRef::copy, instead of copying data manually (authored by gribozavr, committed by ).
Changed prior to commit: https://reviews.llvm.org/D58782?vs=188729&id=188730#toc Repository: rCTE Clang Tools Extra CHANGES SINCE LAST ACTION https://reviews.llvm.org/D58782/new/ https://reviews.llvm.org/D58782 Files: clangd/index/Ref.cpp Index: clangd/index/Ref.cpp =================================================================== --- clangd/index/Ref.cpp +++ clangd/index/Ref.cpp @@ -51,9 +51,7 @@ SymRefs.erase(std::unique(SymRefs.begin(), SymRefs.end()), SymRefs.end()); NumRefs += SymRefs.size(); - auto *Array = Arena.Allocate<Ref>(SymRefs.size()); - std::uninitialized_copy(SymRefs.begin(), SymRefs.end(), Array); - Result.emplace_back(Sym.first, llvm::ArrayRef<Ref>(Array, SymRefs.size())); + Result.emplace_back(Sym.first, llvm::ArrayRef<Ref>(SymRefs).copy(Arena)); } return RefSlab(std::move(Result), std::move(Arena), NumRefs); }
Index: clangd/index/Ref.cpp =================================================================== --- clangd/index/Ref.cpp +++ clangd/index/Ref.cpp @@ -51,9 +51,7 @@ SymRefs.erase(std::unique(SymRefs.begin(), SymRefs.end()), SymRefs.end()); NumRefs += SymRefs.size(); - auto *Array = Arena.Allocate<Ref>(SymRefs.size()); - std::uninitialized_copy(SymRefs.begin(), SymRefs.end(), Array); - Result.emplace_back(Sym.first, llvm::ArrayRef<Ref>(Array, SymRefs.size())); + Result.emplace_back(Sym.first, llvm::ArrayRef<Ref>(SymRefs).copy(Arena)); } return RefSlab(std::move(Result), std::move(Arena), NumRefs); }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits