[Comments] Replace custom ArrayRef copying with ArrayRef::copy. NFC.
authorBenjamin Kramer <benny.kra@googlemail.com>
Wed, 5 Aug 2015 09:40:04 +0000 (09:40 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Wed, 5 Aug 2015 09:40:04 +0000 (09:40 +0000)
llvm-svn: 244025

clang/include/clang/AST/CommentSema.h

index 9b05d39..6a80383 100644 (file)
@@ -79,12 +79,8 @@ public:
   /// Returns a copy of array, owned by Sema's allocator.
   template<typename T>
   ArrayRef<T> copyArray(ArrayRef<T> Source) {
-    size_t Size = Source.size();
-    if (Size != 0) {
-      T *Mem = Allocator.Allocate<T>(Size);
-      std::uninitialized_copy(Source.begin(), Source.end(), Mem);
-      return llvm::makeArrayRef(Mem, Size);
-    }
+    if (!Source.empty())
+      return Source.copy(Allocator);
     return None;
   }