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

Joe Loser via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 8 08:15:14 PDT 2022


jloser created this revision.
jloser added reviewers: MaskRay, kazu, dblaikie.
Herald added a subscriber: StephenFan.
Herald added a project: All.
jloser requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

As a follow-up of 5e96cea1db0623a833d5376c9ea2ce4528771f97 <https://reviews.llvm.org/rG5e96cea1db0623a833d5376c9ea2ce4528771f97>, mark
`llvm::array_lengthof` as deprecated in favor of using `std::size` function
directly.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D133502

Files:
  llvm/include/llvm/ADT/STLArrayExtras.h


Index: llvm/include/llvm/ADT/STLArrayExtras.h
===================================================================
--- llvm/include/llvm/ADT/STLArrayExtras.h
+++ llvm/include/llvm/ADT/STLArrayExtras.h
@@ -26,7 +26,8 @@
 
 /// Find the length of an array.
 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]) {
   return N;
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133502.458754.patch
Type: text/x-patch
Size: 460 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220908/d00092d2/attachment.bin>


More information about the llvm-commits mailing list