summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ObjectYAML/WasmYAML.cpp
diff options
context:
space:
mode:
authorThomas Lively <tlively@google.com>2019-01-16 23:46:14 +0000
committerThomas Lively <tlively@google.com>2019-01-16 23:46:14 +0000
commita56c23c5ba561126f64488fbda0566fc92c26e58 (patch)
tree33176c5c495f6c9e88bdd6c4dd68bae8dac3d080 /llvm/lib/ObjectYAML/WasmYAML.cpp
parentc7700127ae79dec3b6fe0c1773824da56352e194 (diff)
downloadbcm5719-llvm-a56c23c5ba561126f64488fbda0566fc92c26e58.tar.gz
bcm5719-llvm-a56c23c5ba561126f64488fbda0566fc92c26e58.zip
[WebAssembly] Parse llvm.ident into producers section
Summary: Everything before the word "version" is the tool, and everything after the word "version" is the version. Reviewers: aheejin, dschuff Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D56742 llvm-svn: 351399
Diffstat (limited to 'llvm/lib/ObjectYAML/WasmYAML.cpp')
-rw-r--r--llvm/lib/ObjectYAML/WasmYAML.cpp18
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);
OpenPOWER on IntegriCloud