Author: gribozavr
Date: Thu Feb 28 06:00:26 2019
New Revision: 355091

URL: http://llvm.org/viewvc/llvm-project?rev=355091&view=rev
Log:
Use ArrayRef::copy, instead of copying data manually

Reviewers: ioeric

Subscribers: jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D58782

Modified:
    clang-tools-extra/trunk/clangd/index/Ref.cpp

Modified: clang-tools-extra/trunk/clangd/index/Ref.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/index/Ref.cpp?rev=355091&r1=355090&r2=355091&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/index/Ref.cpp (original)
+++ clang-tools-extra/trunk/clangd/index/Ref.cpp Thu Feb 28 06:00:26 2019
@@ -51,9 +51,7 @@ RefSlab RefSlab::Builder::build() && {
     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

Reply via email to