Path: blob/main/contrib/llvm-project/llvm/lib/ExecutionEngine/Orc/Shared/AllocationActions.cpp
39606 views
//===----- AllocationActions.gpp -- JITLink allocation support calls -----===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#include "llvm/ExecutionEngine/Orc/Shared/AllocationActions.h"910namespace llvm {11namespace orc {12namespace shared {1314Expected<std::vector<WrapperFunctionCall>>15runFinalizeActions(AllocActions &AAs) {16std::vector<WrapperFunctionCall> DeallocActions;17DeallocActions.reserve(numDeallocActions(AAs));1819for (auto &AA : AAs) {20if (AA.Finalize)21if (auto Err = AA.Finalize.runWithSPSRetErrorMerged())22return joinErrors(std::move(Err), runDeallocActions(DeallocActions));2324if (AA.Dealloc)25DeallocActions.push_back(std::move(AA.Dealloc));26}2728AAs.clear();29return DeallocActions;30}3132Error runDeallocActions(ArrayRef<WrapperFunctionCall> DAs) {33Error Err = Error::success();34while (!DAs.empty()) {35Err = joinErrors(std::move(Err), DAs.back().runWithSPSRetErrorMerged());36DAs = DAs.drop_back();37}38return Err;39}4041} // namespace shared42} // namespace orc43} // namespace llvm444546