[llvm] 5758c82 - [ADT] Mark `llvm::array_lengthof` as deprecated

Joe Loser via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 9 14:31:59 PDT 2022


Author: Joe Loser
Date: 2022-09-09T15:31:00-06:00
New Revision: 5758c824dab4851fd061201483987b338c051417

URL: https://github.com/llvm/llvm-project/commit/5758c824dab4851fd061201483987b338c051417
DIFF: https://github.com/llvm/llvm-project/commit/5758c824dab4851fd061201483987b338c051417.diff

LOG: [ADT] Mark `llvm::array_lengthof` as deprecated

As a follow-up of 5e96cea1db0623a833d5376c9ea2ce4528771f97, mark
`llvm::array_lengthof` as deprecated in favor of using `std::size` function
directly.

Differential Revision: https://reviews.llvm.org/D133502

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/ADT/STLArrayExtras.h b/llvm/include/llvm/ADT/STLArrayExtras.h
index 5b666641580e2..25f741e75381e 100644
--- a/llvm/include/llvm/ADT/STLArrayExtras.h
+++ b/llvm/include/llvm/ADT/STLArrayExtras.h
@@ -18,6 +18,8 @@
 
 #include <cstddef>
 
+#include "llvm/Support/Compiler.h"
+
 namespace llvm {
 
 //===----------------------------------------------------------------------===//
@@ -26,7 +28,8 @@ namespace llvm {
 
 /// 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;
 }
 


        


More information about the llvm-commits mailing list