[llvm] 67790d3 - [llvm] Fix C++23 error in {Succ, Pred}Iterator (#163555)

via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 15 09:58:40 PDT 2025


Author: Victor Vianna
Date: 2025-10-15T12:58:35-04:00
New Revision: 67790d3fb06b184b7be9c4d3e36ab01f0ac4198e

URL: https://github.com/llvm/llvm-project/commit/67790d3fb06b184b7be9c4d3e36ab01f0ac4198e
DIFF: https://github.com/llvm/llvm-project/commit/67790d3fb06b184b7be9c4d3e36ab01f0ac4198e.diff

LOG: [llvm] Fix C++23 error in {Succ,Pred}Iterator (#163555)

[1] calls insert in an underlying vector and in C++23 that requires the
iterators to satisfy stricter constraints [2][3].

[1]
https://github.com/llvm/llvm-project/blob/67e6a376209c9cc9576012c1c042bee9b852d584/llvm/lib/Analysis/LazyValueInfo.cpp#L333
[2]
https://github.com/llvm/llvm-project/blob/20bcf123e2db033f208462f34f63e292efbe0946/libcxx/include/__vector/vector.h#L645-L649
[3]
https://github.com/llvm/llvm-project/blob/20bcf123e2db033f208462f34f63e292efbe0946/libcxx/include/__algorithm/ranges_copy_n.h#L61

Co-authored-by: Victor Hugo Vianna Silva <victorvianna at google.com>

Added: 
    

Modified: 
    llvm/include/llvm/IR/CFG.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/IR/CFG.h b/llvm/include/llvm/IR/CFG.h
index 7c7e988fa9e8f..96d3b2fbb5b0b 100644
--- a/llvm/include/llvm/IR/CFG.h
+++ b/llvm/include/llvm/IR/CFG.h
@@ -42,9 +42,9 @@ template <class Ptr, class USE_iterator> // Predecessor Iterator
 class PredIterator {
 public:
   using iterator_category = std::forward_iterator_tag;
-  using value_type = Ptr;
+  using value_type = Ptr *;
   using 
diff erence_type = std::ptr
diff _t;
-  using pointer = Ptr *;
+  using pointer = Ptr **;
   using reference = Ptr *;
 
 protected:
@@ -141,7 +141,8 @@ class SuccIterator
                                   std::random_access_iterator_tag, BlockT, int,
                                   BlockT *, BlockT *> {
 public:
-  using 
diff erence_type = int;
+  using value_type = BlockT *;
+  using 
diff erence_type = std::ptr
diff _t;
   using pointer = BlockT *;
   using reference = BlockT *;
 


        


More information about the llvm-commits mailing list