xref: /llvm-project/llvm/lib/Testing/Support/Error.cpp (revision cb30e705d8006b5bb7671ab2b364e8c38b6c0232)
1 //===- llvm/Testing/Support/Error.cpp -------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #include "llvm/Testing/Support/Error.h"
11 
12 #include "llvm/ADT/StringRef.h"
13 
14 using namespace llvm;
15 
16 llvm::detail::ErrorHolder llvm::detail::TakeError(llvm::Error Err) {
17   bool Succeeded = !static_cast<bool>(Err);
18   std::string Message;
19   if (!Succeeded)
20     Message = toString(std::move(Err));
21   return {Succeeded, Message};
22 }
23