LLVM: lib/ObjCopy/wasm/WasmReader.cpp Source File (original) (raw)
Go to the documentation of this file.
1
2
3
4
5
6
7
8
10
11namespace llvm {
13namespace wasm {
14
15using namespace object;
16using namespace llvm::wasm;
17
19 auto Obj = std::make_unique();
20 Obj->Header = WasmObj.getHeader();
21 Obj->isRelocatableObject = WasmObj.isRelocatableObject();
22 Obj->Sections.reserve(WasmObj.getNumSections());
23 for (const SectionRef &Sec : WasmObj.sections()) {
24 const WasmSection &WS = WasmObj.getWasmSection(Sec);
25 Obj->Sections.push_back({static_cast<uint8_t>(WS.Type),
27
28
29 Section &ReaderSec = Obj->Sections.back();
33 }
34 return std::move(Obj);
35}
36
37}
38}
39}
Tagged union holding either a T or a Error.
Expected< std::unique_ptr< Object > > create() const
Definition WasmReader.cpp:18
This is a value type class that represents a single section in the list of sections in the object fil...
LLVM_ABI llvm::StringRef sectionTypeToString(uint32_t type)
This is an optimization pass for GlobalISel generic memory operations.
ArrayRef< uint8_t > Content
std::optional< uint8_t > HeaderSecSizeEncodingLen