[PATCH] D63239: [llvm-objcopy] Refactor output target parsing
Seiya Nuta via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 13 03:31:23 PDT 2019
seiya marked an inline comment as done.
seiya added inline comments.
================
Comment at: llvm/tools/llvm-objcopy/CopyConfig.cpp:279
// FIXME: consolidate with the bfd parsing used by lld.
-static const StringMap<MachineInfo> OutputFormatMap{
- // Name, {EMachine, 64bit, LittleEndian}
+static const StringMap<std::pair<FileFormat, MachineInfo>> FileFormatMap{
+ // Name, {FileFormat, {EMachine, 64bit, LittleEndian}}
----------------
jhenderson wrote:
> seiya wrote:
> > compnerd wrote:
> > > I think it would be nicer to use a tuple with an enumeration to give the values names rather than "first" and "second"
> > What is an elegant way to get an element from tuple using enum? We need to cast the enum values so it should be `std::get<static_cast<std::size_t>(Foo::Bar)>(Tuple)`. It looks verbose a bit to me.
> > I think it would be nicer to use a tuple with an enumeration to give the values names rather than "first" and "second"
> Shouldn't it should just be a `struct` then?
>
> ```
> struct {
> FileFormat Format;
> MachineInfo Machine;
> };
`struct` sounds good to me. I'll use it here.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D63239/new/
https://reviews.llvm.org/D63239
More information about the llvm-commits
mailing list