[PATCH] D86860: [DWARFYAML] Make the debug_str section optional.

Xing GUO via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 31 04:18:14 PDT 2020


Higuoxing added inline comments.


================
Comment at: llvm/lib/ObjectYAML/DWARFEmitter.cpp:89
 Error DWARFYAML::emitDebugStr(raw_ostream &OS, const DWARFYAML::Data &DI) {
-  for (auto Str : DI.DebugStrings) {
+  assert(DI.DebugStrings && "unexpected emitDebugStr() call");
+  for (auto Str : *DI.DebugStrings) {
----------------
grimar wrote:
>  I think you don't really need this assert, because `Optional<>` implementation is based on
> `OptionalStorage` which has it already:
> 
> ```
>   T &getValue() LLVM_LVALUE_FUNCTION noexcept {
>     assert(hasVal);
>     return value;
>   }
> ```
Thanks. I use `assert()` in other places as well. I will propose a change to remove them.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86860



More information about the llvm-commits mailing list