Avoid parsing object file each time MachOObjectFile::getHeader() is
called. Instead, cache the header in MachOObjectFile constructor, where
it's parsed anyway. In future, we must avoid constructing the object
at all if the header can't be parsed.
Details
Details
Diff Detail
Diff Detail
Event Timeline
Comment Actions
LGTM.
I'd probably like a comment pointing out that it works because all the (used) members of mach_header and mach_header64 match in size and location.
For people reading the code who aren't familiar with how those headers look, the MachOObjectFile constructor might look weird. (Not a strong want, but I think it might help readability)
Thanks
Comment Actions
We may get rid of Header pointer completely, and instead put this logic (with an appropriate comment) in getHeader() method. Let me know what you prefer.
Comment Actions
Submitted in r239075 (messed with branches, so Phabricator didn't close it for some reason).