xref: /freebsd/contrib/llvm-project/llvm/lib/Testing/Support/Error.cpp (revision 5f757f3ff9144b609b3c433dfd370cc6bdc191ad)
1*0b57cec5SDimitry Andric //===- llvm/Testing/Support/Error.cpp -------------------------------------===//
2*0b57cec5SDimitry Andric //
3*0b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*0b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
5*0b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*0b57cec5SDimitry Andric //
7*0b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
8*0b57cec5SDimitry Andric 
9*0b57cec5SDimitry Andric #include "llvm/Testing/Support/Error.h"
10*0b57cec5SDimitry Andric 
11*0b57cec5SDimitry Andric using namespace llvm;
12*0b57cec5SDimitry Andric 
13*0b57cec5SDimitry Andric llvm::detail::ErrorHolder llvm::detail::TakeError(llvm::Error Err) {
14*0b57cec5SDimitry Andric   std::vector<std::shared_ptr<ErrorInfoBase>> Infos;
15*0b57cec5SDimitry Andric   handleAllErrors(std::move(Err),
16*0b57cec5SDimitry Andric                   [&Infos](std::unique_ptr<ErrorInfoBase> Info) {
17*0b57cec5SDimitry Andric                     Infos.emplace_back(std::move(Info));
18*0b57cec5SDimitry Andric                   });
19*0b57cec5SDimitry Andric   return {std::move(Infos)};
20*0b57cec5SDimitry Andric }
21