[llvm] 50b311d - Remove workaround for libstdc++ 4.8.

Owen Anderson via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 25 18:33:16 PST 2022


Author: Owen Anderson
Date: 2022-12-25T19:33:11-07:00
New Revision: 50b311dea3bfd71acfe280e900d7d5fa24cc6eb8

URL: https://github.com/llvm/llvm-project/commit/50b311dea3bfd71acfe280e900d7d5fa24cc6eb8
DIFF: https://github.com/llvm/llvm-project/commit/50b311dea3bfd71acfe280e900d7d5fa24cc6eb8.diff

LOG: Remove workaround for libstdc++ 4.8.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D140656

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/ADT/SetVector.h b/llvm/include/llvm/ADT/SetVector.h
index 556aacd2033e4..37509e28f8910 100644
--- a/llvm/include/llvm/ADT/SetVector.h
+++ b/llvm/include/llvm/ADT/SetVector.h
@@ -168,18 +168,11 @@ class SetVector {
   /// \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.


        


More information about the llvm-commits mailing list