[llvm] r302257 - Allow operator-> to work from a FixedStreamArrayIterator.

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Mon May 8 11:43:12 PDT 2017


Test coverage?

On Fri, May 5, 2017 at 10:27 AM Adrian McCarthy via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: amccarth
> Date: Fri May  5 12:14:00 2017
> New Revision: 302257
>
> URL: http://llvm.org/viewvc/llvm-project?rev=302257&view=rev
> Log:
> Allow operator-> to work from a FixedStreamArrayIterator.
>
> This is similar to my recent fix for VarStreamArrayIterator, but the cause
> (and thus the fix) is subtley different.  The FixedStreamArrayIterator
> iterates over a const Array, so the iterator's value type must be const.
>
> Modified:
>     llvm/trunk/include/llvm/Support/BinaryStreamArray.h
>
> Modified: llvm/trunk/include/llvm/Support/BinaryStreamArray.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/BinaryStreamArray.h?rev=302257&r1=302256&r2=302257&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/Support/BinaryStreamArray.h (original)
> +++ llvm/trunk/include/llvm/Support/BinaryStreamArray.h Fri May  5
> 12:14:00 2017
> @@ -342,7 +342,7 @@ private:
>  template <typename T>
>  class FixedStreamArrayIterator
>      : public iterator_facade_base<FixedStreamArrayIterator<T>,
> -                                  std::random_access_iterator_tag, T> {
> +                                  std::random_access_iterator_tag, const
> T> {
>
>  public:
>    FixedStreamArrayIterator(const FixedStreamArray<T> &Array, uint32_t
> Index)
> @@ -356,6 +356,7 @@ public:
>    }
>
>    const T &operator*() const { return Array[Index]; }
> +  const T &operator*() { return Array[Index]; }
>
>    bool operator==(const FixedStreamArrayIterator<T> &R) const {
>      assert(Array == R.Array);
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170508/94c32335/attachment.html>


More information about the llvm-commits mailing list