WasmObject.cpp 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. //===- WasmObject.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. #include "WasmObject.h"
  9. #include "llvm/Support/LEB128.h"
  10. #include "llvm/Support/raw_ostream.h"
  11. namespace llvm {
  12. namespace objcopy {
  13. namespace wasm {
  14. using namespace object;
  15. using namespace llvm::wasm;
  16. void Object::addSectionWithOwnedContents(
  17. Section NewSection, std::unique_ptr<MemoryBuffer> &&Content) {
  18. Sections.push_back(NewSection);
  19. OwnedContents.emplace_back(std::move(Content));
  20. }
  21. void Object::removeSections(function_ref<bool(const Section &)> ToRemove) {
  22. // TODO: remove reloc sections for the removed section, handle symbols, etc.
  23. llvm::erase_if(Sections, ToRemove);
  24. }
  25. } // end namespace wasm
  26. } // end namespace objcopy
  27. } // end namespace llvm