summaryrefslogtreecommitdiff
path: root/lib/ObjectYAML
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
commit6b54fc31e57e38c7ae6b9ba43a8e8916e6116bb4 (patch)
tree99b2e044843f3a586e02d680aa8a09e877aea12a /lib/ObjectYAML
parentebe2b0b004f6511188daafc2d8af69db8f1cebad (diff)
[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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@322121 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ObjectYAML')
-rw-r--r--lib/ObjectYAML/WasmYAML.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/ObjectYAML/WasmYAML.cpp b/lib/ObjectYAML/WasmYAML.cpp
index b2411395dc0..70721e006da 100644
--- a/lib/ObjectYAML/WasmYAML.cpp
+++ b/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);