[PATCH] D82462: [llvm-readelf] - Report a warning instead of an error when dumping a broken section header.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 25 01:35:48 PDT 2020


grimar marked an inline comment as done.
grimar added inline comments.


================
Comment at: llvm/tools/llvm-readobj/ELFDumper.cpp:3829-3834
+  Expected<StringRef> SecStrTableOrErr =
+      Obj->getSectionStringTable(Sections, this->dumper()->WarningHandler);
+  if (!SecStrTableOrErr)
+    this->reportUniqueWarning(SecStrTableOrErr.takeError());
+  else
+    SecStrTable = *SecStrTableOrErr;
----------------
jhenderson wrote:
> Consider using the following instead to limit the scope of `SecStrTableOrErr`:
> ```
>   if (Expected<StringRef> SecStrTableOrErr =
>       Obj->getSectionStringTable(Sections, this->dumper()->WarningHandler);)
>     SecStrTable = *SecStrTableOrErr;
>   else
>     this->reportUniqueWarning(SecStrTableOrErr.takeError());
> ```
> 
> (I don't mind if you don't want to do that though)
Will do, I like the idea to limit scopes where possible. Thanks!


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

https://reviews.llvm.org/D82462





More information about the llvm-commits mailing list