[PATCH] D133502: [ADT] Mark `llvm::array_lengthof` as deprecated

Kazu Hirata via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 8 09:04:13 PDT 2022


kazu accepted this revision.
kazu added a comment.
This revision is now accepted and ready to land.

As I commented in D133429 <https://reviews.llvm.org/D133429>, please be sure to take care of replacements in internal downstream users before checking this in.  LGTM other than that.  Thanks!



================
Comment at: llvm/include/llvm/ADT/STLArrayExtras.h:29
 template <class T, std::size_t N>
-constexpr inline size_t array_lengthof(T (&)[N]) {
+[[deprecated("Use std::size(T(&)[N) instead")]] constexpr inline size_t
+array_lengthof(T (&)[N]) {
----------------
Consider saying something like:

```
LLVM_DEPRECATED("Use std::size instead.", "std::size")
```

This way, the compiler warning 'underlines' `array_lengthof`, which I find very helpful.



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D133502/new/

https://reviews.llvm.org/D133502



More information about the llvm-commits mailing list