summaryrefslogtreecommitdiff
path: root/include/llvm/Testing/Support/SupportHelpers.h
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-12-18 20:10:56 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-12-18 20:10:56 +0000
commit044eb2f6afba375a914ac9d8024f8f5142bb912e (patch)
tree1475247dc9f9fe5be155ebd4c9069c75aadf8c20 /include/llvm/Testing/Support/SupportHelpers.h
parenteb70dddbd77e120e5d490bd8fbe7ff3f8fa81c6b (diff)
Notes
Diffstat (limited to 'include/llvm/Testing/Support/SupportHelpers.h')
-rw-r--r--include/llvm/Testing/Support/SupportHelpers.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/include/llvm/Testing/Support/SupportHelpers.h b/include/llvm/Testing/Support/SupportHelpers.h
index c4dd414b80dbc..d7f0c7142b2ca 100644
--- a/include/llvm/Testing/Support/SupportHelpers.h
+++ b/include/llvm/Testing/Support/SupportHelpers.h
@@ -22,7 +22,10 @@ struct ErrorHolder {
};
template <typename T> struct ExpectedHolder : public ErrorHolder {
- Optional<T *> Value;
+ ExpectedHolder(ErrorHolder Err, Expected<T> &Exp)
+ : ErrorHolder(std::move(Err)), Exp(Exp) {}
+
+ Expected<T> &Exp;
};
inline void PrintTo(const ErrorHolder &Err, std::ostream *Out) {
@@ -35,8 +38,7 @@ inline void PrintTo(const ErrorHolder &Err, std::ostream *Out) {
template <typename T>
void PrintTo(const ExpectedHolder<T> &Item, std::ostream *Out) {
if (Item.Success) {
- *Out << "succeeded with value \"" << ::testing::PrintToString(**Item.Value)
- << "\"";
+ *Out << "succeeded with value " << ::testing::PrintToString(*Item.Exp);
} else {
PrintTo(static_cast<const ErrorHolder &>(Item), Out);
}