[PATCH] D58782: Use ArrayRef::copy, instead of copying data manually

Dmitri Gribenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 28 05:59:42 PST 2019


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);
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58782.188730.patch
Type: text/x-patch
Size: 636 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190228/3c824748/attachment.bin>


More information about the cfe-commits mailing list