[PATCH] D133598: [lld] Use std::size instead of llvm::array_lengthof

Joe Loser via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 9 12:49:55 PDT 2022


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

clang-format


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133598

Files:
  lld/COFF/Chunks.cpp


Index: lld/COFF/Chunks.cpp
===================================================================
--- lld/COFF/Chunks.cpp
+++ lld/COFF/Chunks.cpp
@@ -12,14 +12,15 @@
 #include "SymbolTable.h"
 #include "Symbols.h"
 #include "Writer.h"
-#include "llvm/ADT/Twine.h"
 #include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/Twine.h"
 #include "llvm/BinaryFormat/COFF.h"
 #include "llvm/Object/COFF.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/Endian.h"
 #include "llvm/Support/raw_ostream.h"
 #include <algorithm>
+#include <iterator>
 
 using namespace llvm;
 using namespace llvm::object;
@@ -947,7 +948,7 @@
 void MergeChunk::addSection(COFFLinkerContext &ctx, SectionChunk *c) {
   assert(isPowerOf2_32(c->getAlignment()));
   uint8_t p2Align = llvm::Log2_32(c->getAlignment());
-  assert(p2Align < array_lengthof(ctx.mergeChunkInstances));
+  assert(p2Align < std::size(ctx.mergeChunkInstances));
   auto *&mc = ctx.mergeChunkInstances[p2Align];
   if (!mc)
     mc = make<MergeChunk>(c->getAlignment());


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133598.459171.patch
Type: text/x-patch
Size: 1015 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220909/1590828d/attachment.bin>


More information about the llvm-commits mailing list