summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ObjectYAML/WasmYAML.cpp
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2018-01-09 21:38:53 +0000
committerSam Clegg <sbc@chromium.org>2018-01-09 21:38:53 +0000
commite53af7f6df2cabaa62516e32ae00aaf271258fa4 (patch)
treedac521f63a63655bedd0ea9cb27429a8943ea6cb /llvm/lib/ObjectYAML/WasmYAML.cpp
parentd68fa1be57ae66236af53f7a16e78309d2aecdea (diff)
downloadbcm5719-llvm-e53af7f6df2cabaa62516e32ae00aaf271258fa4.tar.gz
bcm5719-llvm-e53af7f6df2cabaa62516e32ae00aaf271258fa4.zip
[WebAssembly] Explicitly specify function/global index space in YAML
These indexes are useful because they are not always zero based and functions and globals are referenced elsewhere by their index. This matches what we already do for the type index space. Differential Revision: https://reviews.llvm.org/D41877 llvm-svn: 322121
Diffstat (limited to 'llvm/lib/ObjectYAML/WasmYAML.cpp')
-rw-r--r--llvm/lib/ObjectYAML/WasmYAML.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/ObjectYAML/WasmYAML.cpp b/llvm/lib/ObjectYAML/WasmYAML.cpp
index b2411395dc0..70721e006da 100644
--- a/llvm/lib/ObjectYAML/WasmYAML.cpp
+++ b/llvm/lib/ObjectYAML/WasmYAML.cpp
@@ -236,7 +236,7 @@ void ScalarEnumerationTraits<WasmYAML::SectionType>::enumeration(
void MappingTraits<WasmYAML::Signature>::mapping(
IO &IO, WasmYAML::Signature &Signature) {
- IO.mapOptional("Index", Signature.Index);
+ IO.mapRequired("Index", Signature.Index);
IO.mapRequired("ReturnType", Signature.ReturnType);
IO.mapRequired("ParamTypes", Signature.ParamTypes);
}
@@ -248,6 +248,7 @@ void MappingTraits<WasmYAML::Table>::mapping(IO &IO, WasmYAML::Table &Table) {
void MappingTraits<WasmYAML::Function>::mapping(IO &IO,
WasmYAML::Function &Function) {
+ IO.mapRequired("Index", Function.Index);
IO.mapRequired("Locals", Function.Locals);
IO.mapRequired("Body", Function.Body);
}
@@ -323,6 +324,7 @@ void MappingTraits<WasmYAML::Export>::mapping(IO &IO,
void MappingTraits<WasmYAML::Global>::mapping(IO &IO,
WasmYAML::Global &Global) {
+ IO.mapRequired("Index", Global.Index);
IO.mapRequired("Type", Global.Type);
IO.mapRequired("Mutable", Global.Mutable);
IO.mapRequired("InitExpr", Global.InitExpr);
OpenPOWER on IntegriCloud