mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 10:42:39 +01:00
[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
This commit is contained in:
parent
e115cbbdd0
commit
15612d8d16
@ -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_
|
||||
|
Loading…
Reference in New Issue
Block a user