1cb30e705SZachary Turner //===- llvm/Testing/Support/Error.cpp -------------------------------------===//
2cb30e705SZachary Turner //
3*2946cd70SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*2946cd70SChandler Carruth // See https://llvm.org/LICENSE.txt for license information.
5*2946cd70SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6cb30e705SZachary Turner //
7cb30e705SZachary Turner //===----------------------------------------------------------------------===//
8cb30e705SZachary Turner 
9cb30e705SZachary Turner #include "llvm/Testing/Support/Error.h"
10cb30e705SZachary Turner 
11cb30e705SZachary Turner #include "llvm/ADT/StringRef.h"
12cb30e705SZachary Turner 
13cb30e705SZachary Turner using namespace llvm;
14cb30e705SZachary Turner 
TakeError(llvm::Error Err)15cb30e705SZachary Turner llvm::detail::ErrorHolder llvm::detail::TakeError(llvm::Error Err) {
16510725c2SPavel Labath   std::vector<std::shared_ptr<ErrorInfoBase>> Infos;
17510725c2SPavel Labath   handleAllErrors(std::move(Err),
18510725c2SPavel Labath                   [&Infos](std::unique_ptr<ErrorInfoBase> Info) {
19510725c2SPavel Labath                     Infos.emplace_back(std::move(Info));
20510725c2SPavel Labath                   });
21510725c2SPavel Labath   return {std::move(Infos)};
22cb30e705SZachary Turner }
23