-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[llvm][Object] Add missing const qualifier for value_type in content_iterator #124106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…iterator. 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
@llvm/pr-subscribers-llvm-binary-utilities Author: Bushev Dmitry (dybv-sc) Changesvalue_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:
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 &;
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can have a test for this?
@kuhar, sure, added unit test |
✅ With the latest revision this PR passed the C/C++ code formatter. |
790e62b
to
27d2197
Compare
#include "llvm/Support/raw_ostream.h" | ||
#include "llvm/TargetParser/Host.h" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this blank line. Headers should be included as one contiguous block, otherwise clang-format won't sort them properly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
@dybv-sc I think this PR have collected enough feedback, let's resolve review comments, thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No more comments from me. Happy once others are.
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