[PATCH] D73821: [yaml2obj] Support enumeration() with context and add -D e_machine= to override the value in YAML
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 3 01:41:22 PST 2020
grimar added a comment.
Sorry, but I'd probably prefer to have a different approach.
Something that works like a preprocessor. We could have:
--- !ELF
FileHeader:
[[FOO]]: ELFCLASS32
Data: ELFDATA2LSB
Type: ET_REL
Machine: [[MACHINE]]
And then have a code that replaces `[[MACHINE]]', '[[FOO]]' strings in the input data
with something that is specified with `-D` option. e.g.
yaml2obj -DMACHINE="XXX" -DFOO="Class"
gives
--- !ELF
FileHeader:
Class: ELFCLASS32
Data: ELFDATA2LSB
Type: ET_REL
Machine: XXX
It is much more generic (can be used for all targets, fields, etc), and it should be much simpler to implement.
As a bonus we will be able to modify any part of the YAML. It also makes inputs to be more clear,
because currently it is not obvious that some part is overridable.
And I do not have any concerns about the fact we modify the input YAML description here,
because the usage of such construction is limited to our test cases
and we should not met issues with it. When there is no `-D` option given, no preprocessing should happen. Should be safe enough.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D73821/new/
https://reviews.llvm.org/D73821
More information about the llvm-commits
mailing list