summaryrefslogtreecommitdiff
path: root/include/llvm/ObjectYAML/WasmYAML.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/ObjectYAML/WasmYAML.h')
-rw-r--r--include/llvm/ObjectYAML/WasmYAML.h36
1 files changed, 31 insertions, 5 deletions
diff --git a/include/llvm/ObjectYAML/WasmYAML.h b/include/llvm/ObjectYAML/WasmYAML.h
index 447dbd7a603da..74f5664c43ac7 100644
--- a/include/llvm/ObjectYAML/WasmYAML.h
+++ b/include/llvm/ObjectYAML/WasmYAML.h
@@ -112,8 +112,13 @@ struct Signature {
ValueType ReturnType;
};
+struct SymbolInfo {
+ StringRef Name;
+ uint32_t Flags;
+};
+
struct Section {
- Section(SectionType SecType) : Type(SecType) {}
+ explicit Section(SectionType SecType) : Type(SecType) {}
virtual ~Section();
SectionType Type;
@@ -121,20 +126,36 @@ struct Section {
};
struct CustomSection : Section {
- CustomSection() : Section(wasm::WASM_SEC_CUSTOM) {}
+ explicit CustomSection(StringRef Name)
+ : Section(wasm::WASM_SEC_CUSTOM), Name(Name) {}
static bool classof(const Section *S) {
return S->Type == wasm::WASM_SEC_CUSTOM;
}
StringRef Name;
yaml::BinaryRef Payload;
+};
+
+struct NameSection : CustomSection {
+ NameSection() : CustomSection("name") {}
+ static bool classof(const Section *S) {
+ auto C = dyn_cast<CustomSection>(S);
+ return C && C->Name == "name";
+ }
- // The follow is used by the "name" custom section.
- // TODO(sbc): Add support for more then just functions names. The wasm
- // name section can support multiple sub-sections.
std::vector<NameEntry> FunctionNames;
};
+struct LinkingSection : CustomSection {
+ LinkingSection() : CustomSection("linking") {}
+ static bool classof(const Section *S) {
+ auto C = dyn_cast<CustomSection>(S);
+ return C && C->Name == "linking";
+ }
+
+ std::vector<SymbolInfo> SymbolInfos;
+};
+
struct TypeSection : Section {
TypeSection() : Section(wasm::WASM_SEC_TYPE) {}
static bool classof(const Section *S) {
@@ -256,6 +277,7 @@ LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::WasmYAML::Function)
LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::WasmYAML::LocalDecl)
LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::WasmYAML::Relocation)
LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::WasmYAML::NameEntry)
+LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::WasmYAML::SymbolInfo)
LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(uint32_t)
namespace llvm {
@@ -329,6 +351,10 @@ template <> struct MappingTraits<WasmYAML::ElemSegment> {
static void mapping(IO &IO, WasmYAML::ElemSegment &Segment);
};
+template <> struct MappingTraits<WasmYAML::SymbolInfo> {
+ static void mapping(IO &IO, WasmYAML::SymbolInfo &Info);
+};
+
template <> struct ScalarEnumerationTraits<WasmYAML::ValueType> {
static void enumeration(IO &IO, WasmYAML::ValueType &Type);
};