1*81ad6265SDimitry Andric //===- WasmObject.cpp -----------------------------------------------------===// 2*81ad6265SDimitry Andric // 3*81ad6265SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4*81ad6265SDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 5*81ad6265SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6*81ad6265SDimitry Andric // 7*81ad6265SDimitry Andric //===----------------------------------------------------------------------===// 8*81ad6265SDimitry Andric 9*81ad6265SDimitry Andric #include "WasmObject.h" 10*81ad6265SDimitry Andric 11*81ad6265SDimitry Andric #include "llvm/Support/LEB128.h" 12*81ad6265SDimitry Andric #include "llvm/Support/raw_ostream.h" 13*81ad6265SDimitry Andric 14*81ad6265SDimitry Andric namespace llvm { 15*81ad6265SDimitry Andric namespace objcopy { 16*81ad6265SDimitry Andric namespace wasm { 17*81ad6265SDimitry Andric 18*81ad6265SDimitry Andric using namespace object; 19*81ad6265SDimitry Andric using namespace llvm::wasm; 20*81ad6265SDimitry Andric addSectionWithOwnedContents(Section NewSection,std::unique_ptr<MemoryBuffer> && Content)21*81ad6265SDimitry Andricvoid Object::addSectionWithOwnedContents( 22*81ad6265SDimitry Andric Section NewSection, std::unique_ptr<MemoryBuffer> &&Content) { 23*81ad6265SDimitry Andric Sections.push_back(NewSection); 24*81ad6265SDimitry Andric OwnedContents.emplace_back(std::move(Content)); 25*81ad6265SDimitry Andric } 26*81ad6265SDimitry Andric removeSections(function_ref<bool (const Section &)> ToRemove)27*81ad6265SDimitry Andricvoid Object::removeSections(function_ref<bool(const Section &)> ToRemove) { 28*81ad6265SDimitry Andric // TODO: remove reloc sections for the removed section, handle symbols, etc. 29*81ad6265SDimitry Andric llvm::erase_if(Sections, ToRemove); 30*81ad6265SDimitry Andric } 31*81ad6265SDimitry Andric 32*81ad6265SDimitry Andric } // end namespace wasm 33*81ad6265SDimitry Andric } // end namespace objcopy 34*81ad6265SDimitry Andric } // end namespace llvm 35