[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 00:14:02 PST 2021


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

Fixed clang-tidy issues


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


More information about the llvm-commits mailing list