llvm.org GIT mirror llvm / d76cd98
[gtest] Add PrintTo overload for StringRef. Summary: It was printed using code for generic containers before, resulting in unreadable output. Reviewers: sammccall, labath Reviewed By: sammccall, labath Subscribers: labath, zturner, llvm-commits Differential Revision: https://reviews.llvm.org/D43330 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@326092 91177308-0d34-0410-b5e6-96231b3b80d8 Ilya Biryukov 2 years ago
1 changed file(s) with 13 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
3838 #ifndef GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_
3939 #define GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_
4040
41 #include "llvm/ADT/StringRef.h"
42 #include "llvm/Support/raw_os_ostream.h"
43 #include
44
45 namespace llvm {
46 // Without this overload StringRef will be printed as a generic container.
47 inline void PrintTo(const llvm::StringRef &Val, std::ostream *S) {
48 assert(S);
49 llvm::raw_os_ostream OS(*S);
50 OS << Val;
51 }
52 } // namespace llvm
53
4154 #endif // GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_