diff options
author | Thomas Lively <tlively@google.com> | 2019-01-17 02:29:55 +0000 |
---|---|---|
committer | Thomas Lively <tlively@google.com> | 2019-01-17 02:29:55 +0000 |
commit | cbda16eb8ebf52e10a44bd6f15e2743d69e9632a (patch) | |
tree | 43a795712422a63a3f60e732ac9131ceaa0bfd32 /llvm/lib/ObjectYAML/WasmYAML.cpp | |
parent | 2a0868ff48cbf9b3b57858c0f95b89607b69aac9 (diff) | |
download | bcm5719-llvm-cbda16eb8ebf52e10a44bd6f15e2743d69e9632a.tar.gz bcm5719-llvm-cbda16eb8ebf52e10a44bd6f15e2743d69e9632a.zip |
[WebAssembly] Parse llvm.ident into producers section
llvm-svn: 351413
Diffstat (limited to 'llvm/lib/ObjectYAML/WasmYAML.cpp')
-rw-r--r-- | llvm/lib/ObjectYAML/WasmYAML.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/llvm/lib/ObjectYAML/WasmYAML.cpp b/llvm/lib/ObjectYAML/WasmYAML.cpp index 47bf853e0d3..b45c8ce65eb 100644 --- a/llvm/lib/ObjectYAML/WasmYAML.cpp +++ b/llvm/lib/ObjectYAML/WasmYAML.cpp @@ -74,6 +74,14 @@ static void sectionMapping(IO &IO, WasmYAML::LinkingSection &Section) { IO.mapOptional("Comdats", Section.Comdats); } +static void sectionMapping(IO &IO, WasmYAML::ProducersSection &Section) { + commonSectionMapping(IO, Section); + IO.mapRequired("Name", Section.Name); + IO.mapOptional("Languages", Section.Languages); + IO.mapOptional("Tools", Section.Tools); + IO.mapOptional("SDKs", Section.SDKs); +} + static void sectionMapping(IO &IO, WasmYAML::CustomSection &Section) { commonSectionMapping(IO, Section); IO.mapRequired("Name", Section.Name); @@ -169,6 +177,10 @@ void MappingTraits<std::unique_ptr<WasmYAML::Section>>::mapping( if (!IO.outputting()) Section.reset(new WasmYAML::NameSection()); sectionMapping(IO, *cast<WasmYAML::NameSection>(Section.get())); + } else if (SectionName == "producers") { + if (!IO.outputting()) + Section.reset(new WasmYAML::ProducersSection()); + sectionMapping(IO, *cast<WasmYAML::ProducersSection>(Section.get())); } else { if (!IO.outputting()) Section.reset(new WasmYAML::CustomSection(SectionName)); @@ -293,6 +305,12 @@ void MappingTraits<WasmYAML::NameEntry>::mapping( IO.mapRequired("Name", NameEntry.Name); } +void MappingTraits<WasmYAML::ProducerEntry>::mapping( + IO &IO, WasmYAML::ProducerEntry &ProducerEntry) { + IO.mapRequired("Name", ProducerEntry.Name); + IO.mapRequired("Version", ProducerEntry.Version); +} + void MappingTraits<WasmYAML::SegmentInfo>::mapping( IO &IO, WasmYAML::SegmentInfo &SegmentInfo) { IO.mapRequired("Index", SegmentInfo.Index); |