diff options
| author | Douglas Gregor <dgregor@apple.com> | 2011-02-11 18:13:20 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2011-02-11 18:13:20 +0000 |
| commit | 84796221521f3ae7533b7ea8888a96bb357ba6e0 (patch) | |
| tree | c5b3fc29f8fa6bffdbcb2470a18a79721811e937 /llvm | |
| parent | bce7ad6b48c8a7c9c3b1844c5aced27336d10955 (diff) | |
| download | bcm5719-llvm-84796221521f3ae7533b7ea8888a96bb357ba6e0.tar.gz bcm5719-llvm-84796221521f3ae7533b7ea8888a96bb357ba6e0.zip | |
Poison the relational operators ==, !=, <, <=, >=, > on llvm::Optional
objects, since they'll end up using the implicit conversion to "bool"
and causing some very "fun" surprises.
llvm-svn: 125380
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/include/llvm/ADT/Optional.h | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/llvm/include/llvm/ADT/Optional.h b/llvm/include/llvm/ADT/Optional.h index 34e54a07a0e..ee8b69f3d12 100644 --- a/llvm/include/llvm/ADT/Optional.h +++ b/llvm/include/llvm/ADT/Optional.h @@ -61,6 +61,60 @@ template <typename T> struct simplify_type<Optional<T> > : public simplify_type<const Optional<T> > {}; +/// \brief Poison comparison between two \c Optional objects. Clients needs to +/// explicitly compare the underlying values and account for empty \c Optional +/// objects. +/// +/// This routine will never be defined. It returns \c void to help diagnose +/// errors at compile time. +template<typename T, typename U> +void operator==(const Optional<T> &X, const Optional<U> &Y); + +/// \brief Poison comparison between two \c Optional objects. Clients needs to +/// explicitly compare the underlying values and account for empty \c Optional +/// objects. +/// +/// This routine will never be defined. It returns \c void to help diagnose +/// errors at compile time. +template<typename T, typename U> +void operator!=(const Optional<T> &X, const Optional<U> &Y); + +/// \brief Poison comparison between two \c Optional objects. Clients needs to +/// explicitly compare the underlying values and account for empty \c Optional +/// objects. +/// +/// This routine will never be defined. It returns \c void to help diagnose +/// errors at compile time. +template<typename T, typename U> +void operator<(const Optional<T> &X, const Optional<U> &Y); + +/// \brief Poison comparison between two \c Optional objects. Clients needs to +/// explicitly compare the underlying values and account for empty \c Optional +/// objects. +/// +/// This routine will never be defined. It returns \c void to help diagnose +/// errors at compile time. +template<typename T, typename U> +void operator<=(const Optional<T> &X, const Optional<U> &Y); + +/// \brief Poison comparison between two \c Optional objects. Clients needs to +/// explicitly compare the underlying values and account for empty \c Optional +/// objects. +/// +/// This routine will never be defined. It returns \c void to help diagnose +/// errors at compile time. +template<typename T, typename U> +void operator>=(const Optional<T> &X, const Optional<U> &Y); + +/// \brief Poison comparison between two \c Optional objects. Clients needs to +/// explicitly compare the underlying values and account for empty \c Optional +/// objects. +/// +/// This routine will never be defined. It returns \c void to help diagnose +/// errors at compile time. +template<typename T, typename U> +void operator>(const Optional<T> &X, const Optional<U> &Y); + } // end llvm namespace #endif |

