diff --git a/llvm/include/llvm/ADT/ArrayRef.h b/llvm/include/llvm/ADT/ArrayRef.h --- a/llvm/include/llvm/ADT/ArrayRef.h +++ b/llvm/include/llvm/ADT/ArrayRef.h @@ -562,6 +562,41 @@ return ArrayRef(Arr); } + /// @name MutableArrayRef Deduction guides + /// @{ + /// Deduction guide to construct a `MutableArrayRef` from a single element + template MutableArrayRef(T &OneElt) -> MutableArrayRef; + + /// Deduction guide to construct a `MutableArrayRef` from a pointer and + /// length. + template + MutableArrayRef(T *data, size_t length) -> MutableArrayRef; + + /// Deduction guide to construct a `MutableArrayRef` from a `SmallVector`. + template + MutableArrayRef(SmallVectorImpl &Vec) -> MutableArrayRef; + + template + MutableArrayRef(SmallVector &Vec) -> MutableArrayRef; + + /// Deduction guide to construct a `MutableArrayRef` from a `std::vector`. + template MutableArrayRef(std::vector &Vec) -> MutableArrayRef; + + /// Deduction guide to construct a `MutableArrayRef` from a `std::array`. + template + MutableArrayRef(std::array &Vec) -> MutableArrayRef; + + /// Deduction guide to construct a `MutableArrayRef` from a `MutableArrayRef` + /// (no-op) (const). + template + MutableArrayRef(const MutableArrayRef &Vec) -> MutableArrayRef; + + /// Deduction guide to construct a `MutableArrayRef` from a C array. + template + MutableArrayRef(T (&Arr)[N]) -> MutableArrayRef; + + /// @} + /// Construct a MutableArrayRef from a single element. template MutableArrayRef makeMutableArrayRef(T &OneElt) {