[llvm-branch-commits] [llvm-branch] r301479 - Merging r292034: (PR32315)

Hans Wennborg via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Apr 26 14:37:31 PDT 2017


Author: hans
Date: Wed Apr 26 16:37:30 2017
New Revision: 301479

URL: http://llvm.org/viewvc/llvm-project?rev=301479&view=rev
Log:
Merging r292034: (PR32315)

Tweaked to not remove the non-const variants as to not change the ABI.

------------------------------------------------------------------------
r292034 | majnemer | 2017-01-14 13:54:58 -0800 (Sat, 14 Jan 2017) | 7 lines

Adding const overloads of operator* and operator-> for DenseSet iterators

This fixes some problems when building ClangDiagnostics.cpp on Visual Studio 2017 RC. As far as I understand, there was a change in the implementation of the constructor for std::vector with two iterator parameters, which in our case causes an attempt to dereference const Iterator objects. Since there was no overload for a const Iterator, the compile would fail.

Patch by Hugo Puhlmann!

Differential Revision: https://reviews.llvm.org/D28726
------------------------------------------------------------------------

Modified:
    llvm/branches/release_40/   (props changed)
    llvm/branches/release_40/include/llvm/ADT/DenseSet.h

Propchange: llvm/branches/release_40/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Apr 26 16:37:30 2017
@@ -1,3 +1,3 @@
 /llvm/branches/Apple/Pertwee:110850,110961
 /llvm/branches/type-system-rewrite:133420-134817
-/llvm/trunk:155241,291858-291859,291863,291875,291909,291918,291966,291968,291979,292117,292133,292167,292169-292170,292242,292254-292255,292280,292323,292444,292467,292516,292583,292624-292625,292641,292651,292667,292711-292713,292758,292949,293017,293021,293025,293124,293230,293259,293273,293291,293293,293309,293345,293417,293522,293542,293629,293635,293658,293673,293727,293730,294003,294102,294129,294203,294267,294318,294348-294349,294357,294527,294551,294982,295018,295116,295213,295215,295230,295486,295490,295512,295762,295990,296003,296030,296093,296260,296642,296992,297075
+/llvm/trunk:155241,291858-291859,291863,291875,291909,291918,291966,291968,291979,292034,292117,292133,292167,292169-292170,292242,292254-292255,292280,292323,292444,292467,292516,292583,292624-292625,292641,292651,292667,292711-292713,292758,292949,293017,293021,293025,293124,293230,293259,293273,293291,293293,293309,293345,293417,293522,293542,293629,293635,293658,293673,293727,293730,294003,294102,294129,294203,294267,294318,294348-294349,294357,294527,294551,294982,295018,295116,295213,295215,295230,295486,295490,295512,295762,295990,296003,296030,296093,296260,296642,296992,297075

Modified: llvm/branches/release_40/include/llvm/ADT/DenseSet.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_40/include/llvm/ADT/DenseSet.h?rev=301479&r1=301478&r2=301479&view=diff
==============================================================================
--- llvm/branches/release_40/include/llvm/ADT/DenseSet.h (original)
+++ llvm/branches/release_40/include/llvm/ADT/DenseSet.h Wed Apr 26 16:37:30 2017
@@ -104,7 +104,9 @@ public:
     Iterator(const typename MapTy::iterator &i) : I(i) {}
 
     ValueT &operator*() { return I->getFirst(); }
+    const ValueT &operator*() const { return I->getFirst(); }
     ValueT *operator->() { return &I->getFirst(); }
+    const ValueT *operator->() const { return &I->getFirst(); }
 
     Iterator& operator++() { ++I; return *this; }
     Iterator operator++(int) { auto T = *this; ++I; return T; }
@@ -126,7 +128,9 @@ public:
     ConstIterator(const typename MapTy::const_iterator &i) : I(i) {}
 
     const ValueT &operator*() { return I->getFirst(); }
+    const ValueT &operator*() const { return I->getFirst(); }
     const ValueT *operator->() { return &I->getFirst(); }
+    const ValueT *operator->() const { return &I->getFirst(); }
 
     ConstIterator& operator++() { ++I; return *this; }
     ConstIterator operator++(int) { auto T = *this; ++I; return T; }




More information about the llvm-branch-commits mailing list