[PATCH] D132159: [llvm] Explicitly support CTAD in ArrayRef

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 22 16:27:59 PDT 2022


Guess this might let us remove makeArrayRef/makeMutableArrayRef at some point?

Also, looks like this was sent for review, then abandoned and
committed without review? Generally if something's sent for review it
should not be submitted until the review is completed (we don't want
to create situations where people send things for review because they
need review, but then submit them due to lack of feedback in the
review)

On Thu, Aug 18, 2022 at 11:21 AM Jeff Niu via Phabricator via
llvm-commits <llvm-commits at lists.llvm.org> wrote:
>
> Mogball created this revision.
> Herald added a project: All.
> Mogball requested review of this revision.
> Herald added a project: LLVM.
> Herald added a subscriber: llvm-commits.
>
> ArrayRef and MutableArrayRef need to explicitly declare support for CTAD,
> otherwise uses of it trigger `-Wctad-maybe-unsupported` which was recently
> enabled in LLVM in D131727 <https://reviews.llvm.org/D131727>
>
>
> Repository:
>   rG LLVM Github Monorepo
>
> https://reviews.llvm.org/D132159
>
> 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
> @@ -290,6 +290,10 @@
>      /// @}
>    };
>
> +  /// Explicitly support class template argument deduction.
> +  template <typename T>
> +  ArrayRef(const T &) -> ArrayRef<T>;
> +
>    /// MutableArrayRef - Represent a mutable reference to an array (0 or more
>    /// elements consecutively in memory), i.e. a start pointer and a length.  It
>    /// allows various APIs to take and modify consecutive elements easily and
> @@ -444,6 +448,10 @@
>      }
>    };
>
> +  /// Explicitly support class template argument deduction.
> +  template <typename T>
> +  MutableArrayRef(T &) -> MutableArrayRef<T>;
> +
>    /// This is a MutableArrayRef that owns its array.
>    template <typename T> class OwningArrayRef : public MutableArrayRef<T> {
>    public:
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits


More information about the llvm-commits mailing list