r244025 - [Comments] Replace custom ArrayRef copying with ArrayRef::copy. NFC.
Benjamin Kramer
benny.kra at googlemail.com
Wed Aug 5 02:40:04 PDT 2015
Author: d0k
Date: Wed Aug 5 04:40:04 2015
New Revision: 244025
URL: http://llvm.org/viewvc/llvm-project?rev=244025&view=rev
Log:
[Comments] Replace custom ArrayRef copying with ArrayRef::copy. NFC.
Modified:
cfe/trunk/include/clang/AST/CommentSema.h
Modified: cfe/trunk/include/clang/AST/CommentSema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/CommentSema.h?rev=244025&r1=244024&r2=244025&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/CommentSema.h (original)
+++ cfe/trunk/include/clang/AST/CommentSema.h Wed Aug 5 04:40:04 2015
@@ -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;
}
More information about the cfe-commits
mailing list