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