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

Joe Loser via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 9 11:42:02 PDT 2022


jloser updated this revision to Diff 459148.
jloser added a comment.

Include "llvm/Support/Compiler.h" explicitly for using `LLVM_DEPRECATED`


Repository:
  rG LLVM Github Monorepo

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

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
@@ -18,6 +18,8 @@
 
 #include <cstddef>
 
+#include "llvm/Support/Compiler.h"
+
 namespace llvm {
 
 //===----------------------------------------------------------------------===//
@@ -26,7 +28,8 @@
 
 /// Find the length of an array.
 template <class T, std::size_t N>
-constexpr inline size_t array_lengthof(T (&)[N]) {
+constexpr inline LLVM_DEPRECATED("Use std::size instead.", "std::size") size_t
+    array_lengthof(T (&)[N]) {
   return N;
 }
 


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


More information about the llvm-commits mailing list