[llvm] r285603 - SingleLinkedListIterator::operator++(int) shouldn't return a reference

David Majnemer via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 31 10:20:43 PDT 2016


Author: majnemer
Date: Mon Oct 31 12:20:43 2016
New Revision: 285603

URL: http://llvm.org/viewvc/llvm-project?rev=285603&view=rev
Log:
SingleLinkedListIterator::operator++(int) shouldn't return a reference

The returned reference is to a local object.  Instead, make a copy.

Found by PVS-Studio.

Modified:
    llvm/trunk/include/llvm/CodeGen/LiveInterval.h

Modified: llvm/trunk/include/llvm/CodeGen/LiveInterval.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveInterval.h?rev=285603&r1=285602&r2=285603&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/LiveInterval.h (original)
+++ llvm/trunk/include/llvm/CodeGen/LiveInterval.h Mon Oct 31 12:20:43 2016
@@ -672,7 +672,7 @@ namespace llvm {
         P = P->Next;
         return *this;
       }
-      SingleLinkedListIterator<T> &operator++(int) {
+      SingleLinkedListIterator<T> operator++(int) {
         SingleLinkedListIterator res = *this;
         ++*this;
         return res;




More information about the llvm-commits mailing list