[llvm-commits] [llvm] r120198 - in /llvm/trunk: include/llvm/Object/MachOFormat.h include/llvm/Object/MachOObject.h lib/Object/MachOObject.cpp tools/macho-dump/macho-dump.cpp

Chris Lattner clattner at apple.com
Sun Nov 28 11:24:55 PST 2010


On Nov 26, 2010, at 11:19 PM, Daniel Dunbar wrote:

> MachOObject::MachOObject(MemoryBuffer *Buffer_, bool IsLittleEndian_,
>                          bool Is64Bit_)
> -  : Buffer(Buffer_), IsLittleEndian(IsLittleEndian_), Is64Bit(Is64Bit_) {
> +  : Buffer(Buffer_), IsLittleEndian(IsLittleEndian_), Is64Bit(Is64Bit_),
> +    IsSwappedEndian(IsLittleEndian != sys::isLittleEndianHost()),
> +    LoadCommands(0), NumLoadedCommands(0) {
> +  // Load the common header.
> +  memcpy(&Header, Buffer->getBuffer().data(), sizeof(Header));

Is it really a good idea to tie object file format reading to the struct layout of the host compiler?

-Chris



More information about the llvm-commits mailing list