Run clang-format on tools/llvm-objdump/MachODump.cpp again as some of my

previous changes got in with incorrect formatting. No functional change.

llvm-svn: 225417
This commit is contained in:
Kevin Enderby 2015-01-08 00:25:24 +00:00
parent 9d7bc0874c
commit 66d51fc41a
1 changed files with 28 additions and 27 deletions

View File

@ -3560,8 +3560,7 @@ static void PrintUuidLoadCommand(MachO::uuid_command uuid) {
outs() << "\n"; outs() << "\n";
} }
static void PrintRpathLoadCommand(MachO::rpath_command rpath, static void PrintRpathLoadCommand(MachO::rpath_command rpath, const char *Ptr) {
const char *Ptr) {
outs() << " cmd LC_RPATH\n"; outs() << " cmd LC_RPATH\n";
outs() << " cmdsize " << rpath.cmdsize; outs() << " cmdsize " << rpath.cmdsize;
if (rpath.cmdsize < sizeof(struct MachO::rpath_command)) if (rpath.cmdsize < sizeof(struct MachO::rpath_command))
@ -3659,7 +3658,7 @@ static void PrintEncryptionInfoCommand(MachO::encryption_info_command ec,
} }
static void PrintEncryptionInfoCommand64(MachO::encryption_info_command_64 ec, static void PrintEncryptionInfoCommand64(MachO::encryption_info_command_64 ec,
uint32_t object_size) { uint32_t object_size) {
outs() << " cmd LC_ENCRYPTION_INFO_64\n"; outs() << " cmd LC_ENCRYPTION_INFO_64\n";
outs() << " cmdsize " << ec.cmdsize; outs() << " cmdsize " << ec.cmdsize;
if (ec.cmdsize != sizeof(struct MachO::encryption_info_command_64)) if (ec.cmdsize != sizeof(struct MachO::encryption_info_command_64))
@ -3707,8 +3706,8 @@ static void PrintLinkerOptionCommand(MachO::linker_option_command lo,
} }
} }
if (lo.count != i) if (lo.count != i)
outs() << " count " << lo.count << " does not match number of strings " << i outs() << " count " << lo.count << " does not match number of strings "
<< "\n"; << i << "\n";
} }
static void PrintSubFrameworkCommand(MachO::sub_framework_command sub, static void PrintSubFrameworkCommand(MachO::sub_framework_command sub,
@ -3744,7 +3743,7 @@ static void PrintSubUmbrellaCommand(MachO::sub_umbrella_command sub,
} }
static void PrintSubLibraryCommand(MachO::sub_library_command sub, static void PrintSubLibraryCommand(MachO::sub_library_command sub,
const char *Ptr) { const char *Ptr) {
outs() << " cmd LC_SUB_LIBRARY\n"; outs() << " cmd LC_SUB_LIBRARY\n";
outs() << " cmdsize " << sub.cmdsize; outs() << " cmdsize " << sub.cmdsize;
if (sub.cmdsize < sizeof(struct MachO::sub_library_command)) if (sub.cmdsize < sizeof(struct MachO::sub_library_command))
@ -3879,7 +3878,7 @@ static void Print_x86_float_state_t(MachO::x86_float_state64_t &fpu) {
else if (fpu.fpu_fcw.rc == MachO::x86_FP_RND_UP) else if (fpu.fpu_fcw.rc == MachO::x86_FP_RND_UP)
outs() << "FP_RND_UP "; outs() << "FP_RND_UP ";
else if (fpu.fpu_fcw.rc == MachO::x86_FP_CHOP) else if (fpu.fpu_fcw.rc == MachO::x86_FP_CHOP)
outs() << "FP_CHOP "; outs() << "FP_CHOP ";
outs() << "\n"; outs() << "\n";
outs() << "\t status: invalid " << fpu.fpu_fsw.invalid; outs() << "\t status: invalid " << fpu.fpu_fsw.invalid;
outs() << " denorm " << fpu.fpu_fsw.denorm; outs() << " denorm " << fpu.fpu_fsw.denorm;
@ -3959,7 +3958,7 @@ static void Print_x86_float_state_t(MachO::x86_float_state64_t &fpu) {
for (uint32_t f = 0; f < 6; f++) { for (uint32_t f = 0; f < 6; f++) {
outs() << "\t "; outs() << "\t ";
for (uint32_t g = 0; g < 16; g++) for (uint32_t g = 0; g < 16; g++)
outs() << format("%02" PRIx32, fpu.fpu_rsrv4[f*g]) << " "; outs() << format("%02" PRIx32, fpu.fpu_rsrv4[f * g]) << " ";
outs() << "\n"; outs() << "\n";
} }
outs() << "\t fpu_reserved1 " << format("0x%08" PRIx32, fpu.fpu_reserved1); outs() << "\t fpu_reserved1 " << format("0x%08" PRIx32, fpu.fpu_reserved1);
@ -3994,7 +3993,7 @@ static void PrintThreadCommand(MachO::thread_command t, const char *Ptr,
if (end - begin > (ptrdiff_t)sizeof(uint32_t)) { if (end - begin > (ptrdiff_t)sizeof(uint32_t)) {
memcpy((char *)&flavor, begin, sizeof(uint32_t)); memcpy((char *)&flavor, begin, sizeof(uint32_t));
begin += sizeof(uint32_t); begin += sizeof(uint32_t);
} else{ } else {
flavor = 0; flavor = 0;
begin = end; begin = end;
} }
@ -4003,7 +4002,7 @@ static void PrintThreadCommand(MachO::thread_command t, const char *Ptr,
if (end - begin > (ptrdiff_t)sizeof(uint32_t)) { if (end - begin > (ptrdiff_t)sizeof(uint32_t)) {
memcpy((char *)&count, begin, sizeof(uint32_t)); memcpy((char *)&count, begin, sizeof(uint32_t));
begin += sizeof(uint32_t); begin += sizeof(uint32_t);
} else{ } else {
count = 0; count = 0;
begin = end; begin = end;
} }
@ -4057,16 +4056,15 @@ static void PrintThreadCommand(MachO::thread_command t, const char *Ptr,
<< " (not x86_THREAD_STATE64_COUNT\n"; << " (not x86_THREAD_STATE64_COUNT\n";
Print_x86_thread_state64_t(ts.uts.ts64); Print_x86_thread_state64_t(ts.uts.ts64);
} else { } else {
outs() << "\t tsh.flavor " << ts.tsh.flavor outs() << "\t tsh.flavor " << ts.tsh.flavor << " tsh.count "
<< " tsh.count " << ts.tsh.count << "\n"; << ts.tsh.count << "\n";
} }
} else if (flavor == MachO::x86_FLOAT_STATE) { } else if (flavor == MachO::x86_FLOAT_STATE) {
outs() << " flavor x86_FLOAT_STATE\n"; outs() << " flavor x86_FLOAT_STATE\n";
if (count == MachO::x86_FLOAT_STATE_COUNT) if (count == MachO::x86_FLOAT_STATE_COUNT)
outs() << " count x86_FLOAT_STATE_COUNT\n"; outs() << " count x86_FLOAT_STATE_COUNT\n";
else else
outs() << " count " << count outs() << " count " << count << " (not x86_FLOAT_STATE_COUNT)\n";
<< " (not x86_FLOAT_STATE_COUNT)\n";
struct MachO::x86_float_state_t fs; struct MachO::x86_float_state_t fs;
left = end - begin; left = end - begin;
if (left >= sizeof(MachO::x86_float_state_t)) { if (left >= sizeof(MachO::x86_float_state_t)) {
@ -4081,22 +4079,22 @@ static void PrintThreadCommand(MachO::thread_command t, const char *Ptr,
swapStruct(fs); swapStruct(fs);
if (fs.fsh.flavor == MachO::x86_FLOAT_STATE64) { if (fs.fsh.flavor == MachO::x86_FLOAT_STATE64) {
outs() << "\t fsh.flavor x86_FLOAT_STATE64 "; outs() << "\t fsh.flavor x86_FLOAT_STATE64 ";
if (fs.fsh.count == MachO::x86_FLOAT_STATE64_COUNT) if (fs.fsh.count == MachO::x86_FLOAT_STATE64_COUNT)
outs() << "fsh.count x86_FLOAT_STATE64_COUNT\n"; outs() << "fsh.count x86_FLOAT_STATE64_COUNT\n";
else else
outs() << "fsh.count " << fs.fsh.count outs() << "fsh.count " << fs.fsh.count
<< " (not x86_FLOAT_STATE64_COUNT\n"; << " (not x86_FLOAT_STATE64_COUNT\n";
Print_x86_float_state_t(fs.ufs.fs64); Print_x86_float_state_t(fs.ufs.fs64);
} else { } else {
outs() << "\t fsh.flavor " << fs.fsh.flavor outs() << "\t fsh.flavor " << fs.fsh.flavor << " fsh.count "
<< " fsh.count " << fs.fsh.count << "\n"; << fs.fsh.count << "\n";
} }
} else if (flavor == MachO::x86_EXCEPTION_STATE) { } else if (flavor == MachO::x86_EXCEPTION_STATE) {
outs() << " flavor x86_EXCEPTION_STATE\n"; outs() << " flavor x86_EXCEPTION_STATE\n";
if (count == MachO::x86_EXCEPTION_STATE_COUNT) if (count == MachO::x86_EXCEPTION_STATE_COUNT)
outs() << " count x86_EXCEPTION_STATE_COUNT\n"; outs() << " count x86_EXCEPTION_STATE_COUNT\n";
else else
outs() << " count " << count outs() << " count " << count
<< " (not x86_EXCEPTION_STATE_COUNT)\n"; << " (not x86_EXCEPTION_STATE_COUNT)\n";
struct MachO::x86_exception_state_t es; struct MachO::x86_exception_state_t es;
left = end - begin; left = end - begin;
@ -4112,15 +4110,15 @@ static void PrintThreadCommand(MachO::thread_command t, const char *Ptr,
swapStruct(es); swapStruct(es);
if (es.esh.flavor == MachO::x86_EXCEPTION_STATE64) { if (es.esh.flavor == MachO::x86_EXCEPTION_STATE64) {
outs() << "\t esh.flavor x86_EXCEPTION_STATE64\n"; outs() << "\t esh.flavor x86_EXCEPTION_STATE64\n";
if (es.esh.count == MachO::x86_EXCEPTION_STATE64_COUNT) if (es.esh.count == MachO::x86_EXCEPTION_STATE64_COUNT)
outs() << "\t esh.count x86_EXCEPTION_STATE64_COUNT\n"; outs() << "\t esh.count x86_EXCEPTION_STATE64_COUNT\n";
else else
outs() << "\t esh.count " << es.esh.count outs() << "\t esh.count " << es.esh.count
<< " (not x86_EXCEPTION_STATE64_COUNT\n"; << " (not x86_EXCEPTION_STATE64_COUNT\n";
Print_x86_exception_state_t(es.ues.es64); Print_x86_exception_state_t(es.ues.es64);
} else { } else {
outs() << "\t esh.flavor " << es.esh.flavor outs() << "\t esh.flavor " << es.esh.flavor << " esh.count "
<< " esh.count " << es.esh.count << "\n"; << es.esh.count << "\n";
} }
} else { } else {
outs() << " flavor " << flavor << " (unknown)\n"; outs() << " flavor " << flavor << " (unknown)\n";
@ -4134,7 +4132,7 @@ static void PrintThreadCommand(MachO::thread_command t, const char *Ptr,
if (end - begin > (ptrdiff_t)sizeof(uint32_t)) { if (end - begin > (ptrdiff_t)sizeof(uint32_t)) {
memcpy((char *)&flavor, begin, sizeof(uint32_t)); memcpy((char *)&flavor, begin, sizeof(uint32_t));
begin += sizeof(uint32_t); begin += sizeof(uint32_t);
} else{ } else {
flavor = 0; flavor = 0;
begin = end; begin = end;
} }
@ -4143,7 +4141,7 @@ static void PrintThreadCommand(MachO::thread_command t, const char *Ptr,
if (end - begin > (ptrdiff_t)sizeof(uint32_t)) { if (end - begin > (ptrdiff_t)sizeof(uint32_t)) {
memcpy((char *)&count, begin, sizeof(uint32_t)); memcpy((char *)&count, begin, sizeof(uint32_t));
begin += sizeof(uint32_t); begin += sizeof(uint32_t);
} else{ } else {
count = 0; count = 0;
begin = end; begin = end;
} }
@ -4156,7 +4154,7 @@ static void PrintThreadCommand(MachO::thread_command t, const char *Ptr,
} }
} }
} }
static void PrintDylibCommand(MachO::dylib_command dl, const char *Ptr) { static void PrintDylibCommand(MachO::dylib_command dl, const char *Ptr) {
if (dl.cmd == MachO::LC_ID_DYLIB) if (dl.cmd == MachO::LC_ID_DYLIB)
outs() << " cmd LC_ID_DYLIB\n"; outs() << " cmd LC_ID_DYLIB\n";
@ -4307,13 +4305,16 @@ static void PrintLoadCommands(const MachOObjectFile *Obj, uint32_t ncmds,
MachO::entry_point_command Ep = Obj->getEntryPointCommand(Command); MachO::entry_point_command Ep = Obj->getEntryPointCommand(Command);
PrintEntryPointCommand(Ep); PrintEntryPointCommand(Ep);
} else if (Command.C.cmd == MachO::LC_ENCRYPTION_INFO) { } else if (Command.C.cmd == MachO::LC_ENCRYPTION_INFO) {
MachO::encryption_info_command Ei = Obj->getEncryptionInfoCommand(Command); MachO::encryption_info_command Ei =
Obj->getEncryptionInfoCommand(Command);
PrintEncryptionInfoCommand(Ei, Buf.size()); PrintEncryptionInfoCommand(Ei, Buf.size());
} else if (Command.C.cmd == MachO::LC_ENCRYPTION_INFO_64) { } else if (Command.C.cmd == MachO::LC_ENCRYPTION_INFO_64) {
MachO::encryption_info_command_64 Ei = Obj->getEncryptionInfoCommand64(Command); MachO::encryption_info_command_64 Ei =
Obj->getEncryptionInfoCommand64(Command);
PrintEncryptionInfoCommand64(Ei, Buf.size()); PrintEncryptionInfoCommand64(Ei, Buf.size());
} else if (Command.C.cmd == MachO::LC_LINKER_OPTION) { } else if (Command.C.cmd == MachO::LC_LINKER_OPTION) {
MachO::linker_option_command Lo = Obj->getLinkerOptionLoadCommand(Command); MachO::linker_option_command Lo =
Obj->getLinkerOptionLoadCommand(Command);
PrintLinkerOptionCommand(Lo, Command.Ptr); PrintLinkerOptionCommand(Lo, Command.Ptr);
} else if (Command.C.cmd == MachO::LC_SUB_FRAMEWORK) { } else if (Command.C.cmd == MachO::LC_SUB_FRAMEWORK) {
MachO::sub_framework_command Sf = Obj->getSubFrameworkCommand(Command); MachO::sub_framework_command Sf = Obj->getSubFrameworkCommand(Command);