[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
Tue Mar 9 07:05:05 PST 2021


vinograd47 updated this revision to Diff 329327.
vinograd47 added a comment.

Rebased


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.329327.patch
Type: text/x-patch
Size: 773 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210309/d9173e20/attachment.bin>


More information about the llvm-commits mailing list