[libcxx-commits] [PATCH] D113868: [libcxx] Cast to the right `difference_type` in various algorithms

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Nov 16 12:04:23 PST 2021


Mordante accepted this revision.
Mordante added a comment.

LGTM after addressing @Quuxplusone's comments.

If you need somebody to land the patch after it's finished, then please provide "Your name <email at domain>".



================
Comment at: libcxx/include/__algorithm/find_end.h:101
   // Take advantage of knowing source and pattern lengths.  Stop short when source is smaller than pattern
-  typename iterator_traits<_RandomAccessIterator2>::difference_type __len2 = __last2 - __first2;
+  const _D2 __len2 = __last2 - __first2;
   if (__len2 == 0)
----------------
Mordante wrote:
> Style nit: in general we don't use `const` variables in libc++.
To make reviewing easier, can you mark comments as done when you've addressed them?


================
Comment at: libcxx/include/__algorithm/make_heap.h:34
+        for (difference_type __start = (__n - difference_type(2)) / 2; __start >= 0; --__start) {
+          _VSTD::__sift_down<_Compare>(__first, __last, __comp, __n, __first + __start);
         }
----------------
fwolff wrote:
> Quuxplusone wrote:
> > fwolff wrote:
> > > Quuxplusone wrote:
> > > > You've broken the indentation here (and various places, especially in `sort.h`). Please make sure to preserve the existing indentation style wherever you change code. (If it's 2-space, leave it 2-space; if it's 4-space, leave it 4-space; don't mix styles within the same function.)
> > > I've tried to, but Arcanist wouldn't let me update this revision without the clang-format changes. Is there a special option I can use to suppress this?
> > I do think there's some `arc` option for that, but I don't use `arc` myself. I just use `git show -U999 > foo.diff` and then "Update Diff" in the right sidebar at the top of the page.
> OK. I was unsure because the [[ https://libcxx.llvm.org/Contributing.html | "Contributing to libc++" guide ]] says that you have to use `arc` for submitting patches, but then I'll just do it via "Update Diff".
For libc++ we really prefer `arc` else the CI isn't triggered. For arc you can use `--nolint` or press `n` at all suggestions `arc` makes.


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

https://reviews.llvm.org/D113868



More information about the libcxx-commits mailing list