[PATCH] D133030: [AIX] llvm-readobj support a new option --exception-section for xcoff object file.

Digger Lin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 14 10:19:08 PDT 2022


DiggerLin added inline comments.


================
Comment at: llvm/lib/Object/XCOFFObjectFile.cpp:454
+  if (Error E = Binary::checkOffset(Data, SectionStart, SizeOfSection)) {
+    const char *SectionName;
+    switch (SectType) {
----------------
jhenderson wrote:
> `SectionName` is unitialized if this function is called with an unknown section type. Either add a default case to the switch, or, preferably (in my opinion), assign it to some other initial value, preferably that includes the section type value, so that a user can see what the input is that is passed in but has gone wrong.
> 
> If there's a straightforward way to test this, e.g. using a gtest unit test, than that would be good, but I accept that this might not be the case at the moment.
For in the code, I have covered all the enumeration values. 
if I use a  default label, there will be compile error as "error  in switch which covers all enumeration values [-Werror,-Wcovered-switch-default]"



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133030



More information about the llvm-commits mailing list