15ffd83dbSDimitry Andric //===- Object.cpp ---------------------------------------------------------===//
25ffd83dbSDimitry Andric //
35ffd83dbSDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
45ffd83dbSDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
55ffd83dbSDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
65ffd83dbSDimitry Andric //
75ffd83dbSDimitry Andric //===----------------------------------------------------------------------===//
85ffd83dbSDimitry Andric 
95ffd83dbSDimitry Andric #include "Object.h"
105ffd83dbSDimitry Andric 
115ffd83dbSDimitry Andric #include "llvm/Support/LEB128.h"
125ffd83dbSDimitry Andric #include "llvm/Support/raw_ostream.h"
135ffd83dbSDimitry Andric 
145ffd83dbSDimitry Andric namespace llvm {
155ffd83dbSDimitry Andric namespace objcopy {
165ffd83dbSDimitry Andric namespace wasm {
175ffd83dbSDimitry Andric 
185ffd83dbSDimitry Andric using namespace object;
195ffd83dbSDimitry Andric using namespace llvm::wasm;
205ffd83dbSDimitry Andric 
addSectionWithOwnedContents(Section NewSection,std::unique_ptr<MemoryBuffer> && Content)215ffd83dbSDimitry Andric void Object::addSectionWithOwnedContents(
225ffd83dbSDimitry Andric     Section NewSection, std::unique_ptr<MemoryBuffer> &&Content) {
235ffd83dbSDimitry Andric   Sections.push_back(NewSection);
245ffd83dbSDimitry Andric   OwnedContents.emplace_back(std::move(Content));
255ffd83dbSDimitry Andric }
265ffd83dbSDimitry Andric 
removeSections(function_ref<bool (const Section &)> ToRemove)275ffd83dbSDimitry Andric void Object::removeSections(function_ref<bool(const Section &)> ToRemove) {
285ffd83dbSDimitry Andric   // TODO: remove reloc sections for the removed section, handle symbols, etc.
29*af732203SDimitry Andric   llvm::erase_if(Sections, ToRemove);
305ffd83dbSDimitry Andric }
315ffd83dbSDimitry Andric 
325ffd83dbSDimitry Andric } // end namespace wasm
335ffd83dbSDimitry Andric } // end namespace objcopy
345ffd83dbSDimitry Andric } // end namespace llvm
35