diff options
author | rdivacky <rdivacky@FreeBSD.org> | 2009-10-14 17:57:32 +0000 |
---|---|---|
committer | rdivacky <rdivacky@FreeBSD.org> | 2009-10-14 17:57:32 +0000 |
commit | cd749a9c07f1de2fb8affde90537efa4bc3e7c54 (patch) | |
tree | b21f6de4e08b89bb7931806bab798fc2a5e3a686 /utils/unittest/googletest/include/gtest | |
parent | 72621d11de5b873f1695f391eb95f0b336c3d2d4 (diff) | |
download | FreeBSD-src-cd749a9c07f1de2fb8affde90537efa4bc3e7c54.zip FreeBSD-src-cd749a9c07f1de2fb8affde90537efa4bc3e7c54.tar.gz |
Update llvm to r84119.
Diffstat (limited to 'utils/unittest/googletest/include/gtest')
-rw-r--r-- | utils/unittest/googletest/include/gtest/internal/gtest-internal.h | 22 | ||||
-rw-r--r-- | utils/unittest/googletest/include/gtest/internal/gtest-port.h | 4 |
2 files changed, 24 insertions, 2 deletions
diff --git a/utils/unittest/googletest/include/gtest/internal/gtest-internal.h b/utils/unittest/googletest/include/gtest/internal/gtest-internal.h index 37faaae..242ffea 100644 --- a/utils/unittest/googletest/include/gtest/internal/gtest-internal.h +++ b/utils/unittest/googletest/include/gtest/internal/gtest-internal.h @@ -56,6 +56,8 @@ #include <gtest/internal/gtest-filepath.h> #include <gtest/internal/gtest-type-util.h> +#include "llvm/Support/raw_os_ostream.h" + // Due to C++ preprocessor weirdness, we need double indirection to // concatenate two tokens when one of them is __LINE__. Writing // @@ -92,9 +94,27 @@ // ::operator<<;" in the definition of Message's operator<<. That fix // doesn't require a helper function, but unfortunately doesn't // compile with MSVC. + +// LLVM INTERNAL CHANGE: To allow operator<< to work with both +// std::ostreams and LLVM's raw_ostreams, we define a special +// std::ostream with an implicit conversion to raw_ostream& and stream +// to that. This causes the compiler to prefer std::ostream overloads +// but still find raw_ostream& overloads. +namespace llvm { +class convertible_fwd_ostream : public std::ostream { + std::ostream& os_; + raw_os_ostream ros_; + +public: + convertible_fwd_ostream(std::ostream& os) + : std::ostream(os.rdbuf()), os_(os), ros_(*this) {} + operator raw_ostream&() { return ros_; } +}; +} template <typename T> inline void GTestStreamToHelper(std::ostream* os, const T& val) { - *os << val; + llvm::convertible_fwd_ostream cos(*os); + cos << val; } namespace testing { diff --git a/utils/unittest/googletest/include/gtest/internal/gtest-port.h b/utils/unittest/googletest/include/gtest/internal/gtest-port.h index 6a1593e..3e49993 100644 --- a/utils/unittest/googletest/include/gtest/internal/gtest-port.h +++ b/utils/unittest/googletest/include/gtest/internal/gtest-port.h @@ -185,6 +185,8 @@ #define GTEST_OS_ZOS #elif defined(__sun) && defined(__SVR4) #define GTEST_OS_SOLARIS +#elif defined(__HAIKU__) +#define GTEST_OS_HAIKU #endif // _MSC_VER // Determines whether ::std::string and ::string are available. @@ -225,7 +227,7 @@ // TODO(wan@google.com): uses autoconf to detect whether ::std::wstring // is available. -#if defined(GTEST_OS_CYGWIN) || defined(GTEST_OS_SOLARIS) +#if defined(GTEST_OS_CYGWIN) || defined(GTEST_OS_SOLARIS) || defined(GTEST_OS_HAIKU) // At least some versions of cygwin don't support ::std::wstring. // Solaris' libc++ doesn't support it either. #define GTEST_HAS_STD_WSTRING 0 |