[PATCH] D89528: [clang][test] Fix prefix operator++ signature in iterators
Endre Fülöp via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 16 00:36:59 PDT 2020
gamesh411 created this revision.
Herald added subscribers: cfe-commits, martong, Szelethus, dkrupp.
Herald added a reviewer: Szelethus.
Herald added a project: clang.
gamesh411 requested review of this revision.
Prefix operator++ should return the iterator incremented by reference.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D89528
Files:
clang/test/Analysis/Inputs/system-header-simulator-cxx.h
Index: clang/test/Analysis/Inputs/system-header-simulator-cxx.h
===================================================================
--- clang/test/Analysis/Inputs/system-header-simulator-cxx.h
+++ clang/test/Analysis/Inputs/system-header-simulator-cxx.h
@@ -46,7 +46,7 @@
__vector_iterator(const Ptr p = 0) : ptr(p) {}
__vector_iterator(const iterator &rhs): ptr(rhs.base()) {}
- __vector_iterator<T, Ptr, Ref> operator++() { ++ ptr; return *this; }
+ __vector_iterator<T, Ptr, Ref>& operator++() { ++ ptr; return *this; }
__vector_iterator<T, Ptr, Ref> operator++(int) {
auto tmp = *this;
++ ptr;
@@ -109,7 +109,7 @@
__deque_iterator(const Ptr p = 0) : ptr(p) {}
__deque_iterator(const iterator &rhs): ptr(rhs.base()) {}
- __deque_iterator<T, Ptr, Ref> operator++() { ++ ptr; return *this; }
+ __deque_iterator<T, Ptr, Ref>& operator++() { ++ ptr; return *this; }
__deque_iterator<T, Ptr, Ref> operator++(int) {
auto tmp = *this;
++ ptr;
@@ -169,7 +169,7 @@
__list_iterator(T* it = 0) : item(it) {}
__list_iterator(const iterator &rhs): item(rhs.item) {}
- __list_iterator<T, Ptr, Ref> operator++() { item = item->next; return *this; }
+ __list_iterator<T, Ptr, Ref>& operator++() { item = item->next; return *this; }
__list_iterator<T, Ptr, Ref> operator++(int) {
auto tmp = *this;
item = item->next;
@@ -212,7 +212,7 @@
__fwdl_iterator(T* it = 0) : item(it) {}
__fwdl_iterator(const iterator &rhs): item(rhs.item) {}
- __fwdl_iterator<T, Ptr, Ref> operator++() { item = item->next; return *this; }
+ __fwdl_iterator<T, Ptr, Ref>& operator++() { item = item->next; return *this; }
__fwdl_iterator<T, Ptr, Ref> operator++(int) {
auto tmp = *this;
item = item->next;
@@ -1079,7 +1079,7 @@
class iterator {
public:
iterator(Key *key): ptr(key) {}
- iterator operator++() { ++ptr; return *this; }
+ iterator& operator++() { ++ptr; return *this; }
bool operator!=(const iterator &other) const { return ptr != other.ptr; }
const Key &operator*() const { return *ptr; }
private:
@@ -1104,7 +1104,7 @@
class iterator {
public:
iterator(Key *key): ptr(key) {}
- iterator operator++() { ++ptr; return *this; }
+ iterator& operator++() { ++ptr; return *this; }
bool operator!=(const iterator &other) const { return ptr != other.ptr; }
const Key &operator*() const { return *ptr; }
private:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D89528.298560.patch
Type: text/x-patch
Size: 2465 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201016/d8baa19a/attachment-0001.bin>
More information about the cfe-commits
mailing list