[Lldb-commits] [lldb] [lldb][AIX] Extract CPU type and set up process architecture accordingly (PR #189910)
David Spickett via lldb-commits
lldb-commits at lists.llvm.org
Wed Apr 1 02:00:08 PDT 2026
================
@@ -52,8 +52,8 @@ class ObjectFileXCOFF : public lldb_private::ObjectFile {
lldb::DataExtractorSP &extractor_sp,
lldb::offset_t file_offset, lldb::offset_t length);
- static bool MagicBytesMatch(lldb::DataExtractorSP &extractor_sp,
- lldb::addr_t offset, lldb::addr_t length);
+ static uint16_t GetMagicBytes(lldb::DataExtractorSP &extractor_sp,
----------------
DavidSpickett wrote:
The name of this function is ok but doesn't imply the "return 0 if not a known pattern" part. Perhaps do that using the return type:
```
std::optional<uint16_t> GetMagicBytes(....
```
Then if I'm looking at this function I wonder what that optional is doing, and then I look at the code, and from there it's clear what you are doing.
Even better, could you use the MagicNumber type?
```
std::optional<llvm::XCOFF::MagicNumber>
```
Then we expect either a valid magic number, or nothing.
https://github.com/llvm/llvm-project/pull/189910
More information about the lldb-commits
mailing list