Index: utils/unittest/googletest/include/gtest/internal/custom/raw-ostream.h =================================================================== --- utils/unittest/googletest/include/gtest/internal/custom/raw-ostream.h +++ utils/unittest/googletest/include/gtest/internal/custom/raw-ostream.h @@ -42,8 +42,9 @@ // If raw_ostream support is enabled, we specialize for types with operator<< // that takes a raw_ostream. #if !GTEST_NO_LLVM_RAW_OSTREAM -#include "llvm/Support/raw_ostream.h" +#include "llvm/ADT/StringRef.h" #include "llvm/Support/raw_os_ostream.h" +#include "llvm/Support/raw_ostream.h" #include namespace llvm_gtest { @@ -69,6 +70,16 @@ static const RawStreamProxy printable(const T &V) { return {V}; } }; } // namespace llvm_gtest -#endif // !GTEST_NO_LLVM_RAW_OSTREAM + +namespace llvm { +// Without this overload StringRef will be printed as a generic container. +inline void PrintTo(const llvm::StringRef &Val, std::ostream *S) { + if (!S) + return; + llvm::raw_os_ostream OS(*S); + OS << Val; +} +} // namespace llvm +#endif // !GTEST_NO_LLVM_RAW_OSTREAM #endif // GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_RAW_OSTREAM_H_