[PATCH] D106320: Remove (void) in loop as it is unnecessary and confusing

Alf via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 20 13:44:00 PDT 2021


gAlfonso-bit updated this revision to Diff 360257.
gAlfonso-bit added a comment.

Found a better solution


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106320

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
@@ -1363,7 +1363,7 @@
   // but that would be stdlib dependent.
   typedef
       typename std::iterator_traits<Iterator>::difference_type difference_type;
-  for (auto size = last - first; size > 1; ++first, (void)--size) {
+  for (auto size = last - first; size > 1; --size, ++first) {
     difference_type offset = g() % size;
     // Avoid self-assignment due to incorrect assertions in libstdc++
     // containers (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85828).


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106320.360257.patch
Type: text/x-patch
Size: 659 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210720/b403e26d/attachment.bin>


More information about the llvm-commits mailing list