[PATCH] D120144: [ADT] Have ArrayRef::copy() return a MutableArrayRef
Jez Ng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 18 11:56:26 PST 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG0712c575b90a: [ADT] Have ArrayRef::copy() return a MutableArrayRef (authored by int3).
Changed prior to commit:
https://reviews.llvm.org/D120144?vs=409967&id=409991#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D120144/new/
https://reviews.llvm.org/D120144
Files:
llvm/include/llvm/ADT/ArrayRef.h
Index: llvm/include/llvm/ADT/ArrayRef.h
===================================================================
--- llvm/include/llvm/ADT/ArrayRef.h
+++ llvm/include/llvm/ADT/ArrayRef.h
@@ -25,6 +25,7 @@
#include <vector>
namespace llvm {
+ template<typename T> class LLVM_NODISCARD MutableArrayRef;
/// ArrayRef - Represent a constant reference to an array (0 or more elements
/// consecutively in memory), i.e. a start pointer and a length. It allows
@@ -175,10 +176,10 @@
}
// copy - Allocate copy in Allocator and return ArrayRef<T> to it.
- template <typename Allocator> ArrayRef<T> copy(Allocator &A) {
+ template <typename Allocator> MutableArrayRef<T> copy(Allocator &A) {
T *Buff = A.template Allocate<T>(Length);
std::uninitialized_copy(begin(), end(), Buff);
- return ArrayRef<T>(Buff, Length);
+ return MutableArrayRef<T>(Buff, Length);
}
/// equals - Check for element-wise equality.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120144.409991.patch
Type: text/x-patch
Size: 961 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220218/26473de8/attachment.bin>
More information about the llvm-commits
mailing list