[PATCH] D140656: Remove workaround for libstdc++ 4.8.

Owen Anderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 24 20:48:11 PST 2022


resistor created this revision.
Herald added a project: All.
resistor requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D140656

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


Index: llvm/include/llvm/ADT/SetVector.h
===================================================================
--- llvm/include/llvm/ADT/SetVector.h
+++ llvm/include/llvm/ADT/SetVector.h
@@ -168,18 +168,11 @@
   /// \returns an iterator pointing to the next element that followed the
   /// element erased. This is the end of the SetVector if the last element is
   /// erased.
-  iterator erase(iterator I) {
+  iterator erase(const_iterator I) {
     const key_type &V = *I;
     assert(set_.count(V) && "Corrupted SetVector instances!");
     set_.erase(V);
-
-    // FIXME: No need to use the non-const iterator when built with
-    // std::vector.erase(const_iterator) as defined in C++11. This is for
-    // compatibility with non-standard libstdc++ up to 4.8 (fixed in 4.9).
-    auto NI = vector_.begin();
-    std::advance(NI, std::distance<iterator>(NI, I));
-
-    return vector_.erase(NI);
+    return vector_.erase(I);
   }
 
   /// Remove items from the set vector based on a predicate function.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D140656.485216.patch
Type: text/x-patch
Size: 1009 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221225/a23a2f7c/attachment.bin>


More information about the llvm-commits mailing list