Index: llvm/include/llvm/ADT/ArrayRef.h =================================================================== --- llvm/include/llvm/ADT/ArrayRef.h +++ llvm/include/llvm/ADT/ArrayRef.h @@ -466,9 +466,44 @@ ~OwningArrayRef() { delete[] this->data(); } }; - /// @name ArrayRef Convenience constructors + /// @name ArrayRef Deduction guides /// @{ + /// Deduction guide to construct an ArrayRef from a single element. + template ArrayRef(const T &OneElt) -> ArrayRef; + + /// Deduction guide to construct an ArrayRef from a pointer and length + template ArrayRef(const T *data, size_t length) -> ArrayRef; + + /// Deduction guide to construct an ArrayRef from a range + template ArrayRef(const T *data, const T *end) -> ArrayRef; + + /// Deduction guide to construct an ArrayRef from a SmallVector + template ArrayRef(const SmallVectorImpl &Vec) -> ArrayRef; + + /// Deduction guide to construct an ArrayRef from a SmallVector + template + ArrayRef(const SmallVector &Vec) -> ArrayRef; + + /// Deduction guide to construct an ArrayRef from a std::vector + template ArrayRef(const std::vector &Vec) -> ArrayRef; + + /// Deduction guide to construct an ArrayRef from a std::array + template + ArrayRef(const std::array &Vec) -> ArrayRef; + + /// Deduction guide to construct an ArrayRef from an ArrayRef (no-op) (const) + template ArrayRef(const ArrayRef &Vec) -> ArrayRef; + + /// Deduction guide to construct an ArrayRef from an ArrayRef (no-op) + template ArrayRef(ArrayRef &Vec) -> ArrayRef; + + /// Deduction guide to construct an ArrayRef from a C array. + template ArrayRef(const T (&Arr)[N]) -> ArrayRef; + /// @} + + /// @name ArrayRef Convenience constructors + /// @{ /// Construct an ArrayRef from a single element. template ArrayRef makeArrayRef(const T &OneElt) {