[PATCH] PR10140 - StringPool's PooledStringPtr has non-const operator== causing bad OR-result

David Blaikie dblaikie at gmail.com
Wed Jun 18 09:14:53 PDT 2014


I suspect the primary bug here is that operator bool should be
explicit. Could you send a review for that too? (& verify that it
would've made the example given in PR10140 fail to compile, instead of
comparing booleans? (without the const patch applied))

In any case, I'll sign off on this change to add "const" - please go
ahead and commit.

On Wed, Jun 18, 2014 at 6:23 AM, Nikola Smiljanić <popizdeh at gmail.com> wrote:
> Hi chandlerc,
>
> http://reviews.llvm.org/D4194
>
> Files:
>   include/llvm/Support/StringPool.h
>
> Index: include/llvm/Support/StringPool.h
> ===================================================================
> --- include/llvm/Support/StringPool.h
> +++ include/llvm/Support/StringPool.h
> @@ -130,8 +130,12 @@
>      inline const char *operator*() const { return begin(); }
>      inline operator bool() const { return S != nullptr; }
>
> -    inline bool operator==(const PooledStringPtr &That) { return S == That.S; }
> -    inline bool operator!=(const PooledStringPtr &That) { return S != That.S; }
> +    inline bool operator==(const PooledStringPtr &That) const {
> +      return S == That.S;
> +    }
> +    inline bool operator!=(const PooledStringPtr &That) const {
> +      return S != That.S;
> +    }
>    };
>
>  } // End llvm namespace
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>




More information about the llvm-commits mailing list