From: Benjamin Kramer Date: Wed, 5 Aug 2015 09:40:04 +0000 (+0000) Subject: [Comments] Replace custom ArrayRef copying with ArrayRef::copy. NFC. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1fabc90be9d158d3ac4f4192206aaf770a4ca15f;p=clang [Comments] Replace custom ArrayRef copying with ArrayRef::copy. NFC. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@244025 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/AST/CommentSema.h b/include/clang/AST/CommentSema.h index 9b05d397ba..6a803836e8 100644 --- a/include/clang/AST/CommentSema.h +++ b/include/clang/AST/CommentSema.h @@ -79,12 +79,8 @@ public: /// Returns a copy of array, owned by Sema's allocator. template ArrayRef copyArray(ArrayRef Source) { - size_t Size = Source.size(); - if (Size != 0) { - T *Mem = Allocator.Allocate(Size); - std::uninitialized_copy(Source.begin(), Source.end(), Mem); - return llvm::makeArrayRef(Mem, Size); - } + if (!Source.empty()) + return Source.copy(Allocator); return None; }