diff options
author | Kartar Singh <kartarsingh@google.com> | 2023-03-24 15:39:46 +0000 |
---|---|---|
committer | Kartar Singh <kartarsingh@google.com> | 2023-03-24 15:43:37 +0000 |
commit | d6d1ee2a2cc3a890c4f7f1ce7fddd96eecfd082a (patch) | |
tree | c8d9f3b49931fb54728540b1bc7dc85046d04849 | |
parent | 368005d2e551925ecfe624fd3f5a5f4c81b3089f (diff) | |
download | unwinding-d6d1ee2a2cc3a890c4f7f1ce7fddd96eecfd082a.tar.gz |
Remove std::iterator usageandroid-u-beta-1-gpl
std::iterator was removed in cpp20. This caused build failures
in Chromium which builds with cpp20.
Test: `atest --host-unit-test-only` -> All test passed!
BUG: crbug/1377413
Change-Id: I9119906beb4df041b1b447574d12ebcf7705cf31
-rw-r--r-- | libunwindstack/ElfInterfaceArm.h | 9 | ||||
-rw-r--r-- | libunwindstack/include/unwindstack/DwarfSection.h | 9 |
2 files changed, 14 insertions, 4 deletions
diff --git a/libunwindstack/ElfInterfaceArm.h b/libunwindstack/ElfInterfaceArm.h index 6ee6dc9..d8cad48 100644 --- a/libunwindstack/ElfInterfaceArm.h +++ b/libunwindstack/ElfInterfaceArm.h @@ -19,7 +19,6 @@ #include <elf.h> #include <stdint.h> -#include <iterator> #include <unordered_map> #include <unwindstack/ElfInterface.h> @@ -32,8 +31,14 @@ class ElfInterfaceArm : public ElfInterface32 { ElfInterfaceArm(Memory* memory) : ElfInterface32(memory) {} virtual ~ElfInterfaceArm() = default; - class iterator : public std::iterator<std::bidirectional_iterator_tag, uint32_t> { + class iterator { public: + using iterator_category = std::bidirectional_iterator_tag; + using value_type = uint32_t; + using difference_type = std::ptrdiff_t; + using pointer = uint32_t*; + using reference = uint32_t&; + iterator(ElfInterfaceArm* interface, size_t index) : interface_(interface), index_(index) { } iterator& operator++() { index_++; return *this; } diff --git a/libunwindstack/include/unwindstack/DwarfSection.h b/libunwindstack/include/unwindstack/DwarfSection.h index 33435b2..2318f2f 100644 --- a/libunwindstack/include/unwindstack/DwarfSection.h +++ b/libunwindstack/include/unwindstack/DwarfSection.h @@ -18,7 +18,6 @@ #include <stdint.h> -#include <iterator> #include <map> #include <optional> #include <unordered_map> @@ -42,8 +41,14 @@ class DwarfSection { DwarfSection(Memory* memory); virtual ~DwarfSection() = default; - class iterator : public std::iterator<std::bidirectional_iterator_tag, DwarfFde*> { + class iterator { public: + using iterator_category = std::bidirectional_iterator_tag; + using value_type = DwarfFde*; + using difference_type = std::ptrdiff_t; + using pointer = DwarfFde**; + using reference = DwarfFde*&; + iterator(DwarfSection* section, size_t index) : index_(index) { section->GetFdes(&fdes_); if (index_ == static_cast<size_t>(-1)) { |