[llvm] [llvm][Object] Add missing const qualifier for value_type in content_iterator (PR #124106)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 23 04:14:08 PST 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-binary-utilities

Author: Bushev Dmitry (dybv-sc)

<details>
<summary>Changes</summary>

value_type was defined as non-const for content_iterator, although it's methods returned a const pointers/references. This prevented it from using in some algorithms from STLExtras.h

---
Full diff: https://github.com/llvm/llvm-project/pull/124106.diff


1 Files Affected:

- (modified) llvm/include/llvm/Object/SymbolicFile.h (+1-1) 


``````````diff
diff --git a/llvm/include/llvm/Object/SymbolicFile.h b/llvm/include/llvm/Object/SymbolicFile.h
index b13588c147d9b2..2c857e72c3e5a6 100644
--- a/llvm/include/llvm/Object/SymbolicFile.h
+++ b/llvm/include/llvm/Object/SymbolicFile.h
@@ -71,7 +71,7 @@ template <class content_type> class content_iterator {
 
 public:
   using iterator_category = std::forward_iterator_tag;
-  using value_type = content_type;
+  using value_type = const content_type;
   using difference_type = std::ptrdiff_t;
   using pointer = value_type *;
   using reference = value_type &;

``````````

</details>


https://github.com/llvm/llvm-project/pull/124106


More information about the llvm-commits mailing list