[PATCH] D81356: [ObjectYAML] Add support for error handling in DWARFYAML. NFC.

Xing GUO via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 8 04:52:10 PDT 2020


Higuoxing added inline comments.


================
Comment at: llvm/lib/ObjectYAML/ELFEmitter.cpp:862
+  } else
     llvm_unreachable("unexpected emitDWARF() call");
 
----------------
grimar wrote:
> My concern this starts to look a bit bulky. Perhaps something like the following would be better?
> 
> ```
> uint64_t BeginOffset = OS.tell();
> Error Err = Error::success();
> 
> if (Name == ".debug_str")
>   Err = DWARFYAML::EmitDebugStr(OS, DWARF);
> else if (Name == ".debug_aranges")
>   Err = DWARFYAML::EmitDebugAranges(OS, DWARF);
> ...
> 
> if (Err)
>   return std::move(Err);
> ```
Thanks a lot!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81356





More information about the llvm-commits mailing list