labath added inline comments.
================
Comment at: lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp:864-866
+ // If the StringSwitch above picked any type, including
+ // eSectionTypeOther, accept that instead of the generic mappings
+ // based on flags below.
----------------
This makes pretty weird control flow. I think it would be way clearer if all of
this code were moved into a function like `GetSectionType` (there's a function
like that in ObjectFileELF). Then you can use return statements to shortcut
control flow, like so:
```
if (m_sect_headers[idx].flags & llvm::COFF::IMAGE_SCN_CNT_CODE &&
((const_sect_name == g_code_sect_name) ||
(const_sect_name == g_CODE_sect_name)))
return eSectionTypeCode;
if (...)
return eSectionTypeZeroFill;
SectionType type = StringSwitch<SectionType>(name)...;
if (type != Invalid)
return type;
...
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D70778/new/
https://reviews.llvm.org/D70778
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits