[PATCH] D63239: [llvm-objcopy] Refactor output target parsing

Seiya Nuta via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 12 20:47:59 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}}
----------------
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.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63239/new/

https://reviews.llvm.org/D63239





More information about the llvm-commits mailing list