summaryrefslogtreecommitdiffstats
path: root/llvm/utils/unittest/googletest/include/gtest/internal
diff options
context:
space:
mode:
authorIlya Biryukov <ibiryukov@google.com>2018-02-26 15:19:26 +0000
committerIlya Biryukov <ibiryukov@google.com>2018-02-26 15:19:26 +0000
commitab6554fefbf9189a60291e4709781c669ac0099f (patch)
tree3253f069fc5db95eefae48eb9817f71cafff1ef4 /llvm/utils/unittest/googletest/include/gtest/internal
parent560ce2c70fb1fe8e4b9b5e39c54e494a50373ba8 (diff)
downloadbcm5719-llvm-ab6554fefbf9189a60291e4709781c669ac0099f.tar.gz
bcm5719-llvm-ab6554fefbf9189a60291e4709781c669ac0099f.zip
[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 llvm-svn: 326092
Diffstat (limited to 'llvm/utils/unittest/googletest/include/gtest/internal')
-rw-r--r--llvm/utils/unittest/googletest/include/gtest/internal/custom/gtest-printers.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/utils/unittest/googletest/include/gtest/internal/custom/gtest-printers.h b/llvm/utils/unittest/googletest/include/gtest/internal/custom/gtest-printers.h
index 60c1ea050b6..80e7d91220c 100644
--- a/llvm/utils/unittest/googletest/include/gtest/internal/custom/gtest-printers.h
+++ b/llvm/utils/unittest/googletest/include/gtest/internal/custom/gtest-printers.h
@@ -39,4 +39,17 @@
#ifndef GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_
#define GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/raw_os_ostream.h"
+#include <cassert>
+
+namespace llvm {
+// Without this overload StringRef will be printed as a generic container.
+inline void PrintTo(const llvm::StringRef &Val, std::ostream *S) {
+ assert(S);
+ llvm::raw_os_ostream OS(*S);
+ OS << Val;
+}
+} // namespace llvm
+
#endif // GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_
OpenPOWER on IntegriCloud