[PATCH] D97921: [ADT][NFC] Use `size_t` type for index in `indexed_accessor_range`

Vladislav Vinogradov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 10 00:42:03 PST 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rGdc8446c2a088: [ADT][NFC] Use `size_t` type for index in `indexed_accessor_range` (authored by vinograd47).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97921

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


Index: llvm/include/llvm/ADT/STLExtras.h
===================================================================
--- llvm/include/llvm/ADT/STLExtras.h
+++ llvm/include/llvm/ADT/STLExtras.h
@@ -1114,9 +1114,9 @@
 
   iterator begin() const { return iterator(base, 0); }
   iterator end() const { return iterator(base, count); }
-  ReferenceT operator[](unsigned index) const {
-    assert(index < size() && "invalid index for value range");
-    return DerivedT::dereference_iterator(base, index);
+  ReferenceT operator[](size_t Index) const {
+    assert(Index < size() && "invalid index for value range");
+    return DerivedT::dereference_iterator(base, static_cast<ptrdiff_t>(Index));
   }
   ReferenceT front() const {
     assert(!empty() && "expected non-empty range");


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97921.329563.patch
Type: text/x-patch
Size: 773 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210310/86463ca2/attachment.bin>


More information about the llvm-commits mailing list