From 724a7b145d480018ddae894ffdd848154cd5478f Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Mon, 8 Apr 2013 08:39:59 +0000 Subject: [PATCH] Cleanup the formatting of obj2yaml.cpp. I couldn't touch this file and not clean it up some. These reformattings brought to you by clang-format, with some minor adjustments by me. More spring cleaning to follow here. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179004 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/obj2yaml/obj2yaml.cpp | 45 +++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/tools/obj2yaml/obj2yaml.cpp b/tools/obj2yaml/obj2yaml.cpp index 68701dea5670..615ff863b1fd 100644 --- a/tools/obj2yaml/obj2yaml.cpp +++ b/tools/obj2yaml/obj2yaml.cpp @@ -21,9 +21,9 @@ namespace yaml { // generic yaml-writing specific routines unsigned char printable(unsigned char Ch) { return Ch >= ' ' && Ch <= '~' ? Ch : '.'; } - -llvm::raw_ostream &writeHexStream(llvm::raw_ostream &Out, - const llvm::ArrayRef arr) { + +llvm::raw_ostream &writeHexStream(llvm::raw_ostream &Out, + const llvm::ArrayRef arr) { const char *hex = "0123456789ABCDEF"; Out << " !hex \""; @@ -38,9 +38,10 @@ llvm::raw_ostream &writeHexStream(llvm::raw_ostream &Out, Out << "|\n"; return Out; - } +} -llvm::raw_ostream &writeHexNumber(llvm::raw_ostream &Out, unsigned long long N) { +llvm::raw_ostream &writeHexNumber(llvm::raw_ostream &Out, + unsigned long long N) { if (N >= 10) Out << "0x"; Out.write_hex(N); @@ -49,32 +50,32 @@ llvm::raw_ostream &writeHexNumber(llvm::raw_ostream &Out, unsigned long long N) } - using namespace llvm; -enum ObjectFileType { coff }; +enum ObjectFileType { + coff +}; cl::opt InputFormat( - cl::desc("Choose input format"), - cl::values( - clEnumVal(coff, "process COFF object files"), - clEnumValEnd)); - -cl::opt InputFilename(cl::Positional, cl::desc(""), cl::init("-")); - -int main(int argc, char * argv[]) { + cl::desc("Choose input format"), + cl::values(clEnumVal(coff, "process COFF object files"), clEnumValEnd)); + +cl::opt InputFilename(cl::Positional, cl::desc(""), + cl::init("-")); + +int main(int argc, char *argv[]) { cl::ParseCommandLineOptions(argc, argv); sys::PrintStackTraceOnErrorSignal(); PrettyStackTraceProgram X(argc, argv); - llvm_shutdown_obj Y; // Call llvm_shutdown() on exit. + llvm_shutdown_obj Y; // Call llvm_shutdown() on exit. -// Process the input file + // Process the input file OwningPtr buf; -// TODO: If this is an archive, then burst it and dump each entry - if (error_code ec = MemoryBuffer::getFileOrSTDIN(InputFilename, buf)) - llvm::errs() << "Error: '" << ec.message() << "' opening file '" - << InputFilename << "'\n"; - else { + // TODO: If this is an archive, then burst it and dump each entry + if (error_code ec = MemoryBuffer::getFileOrSTDIN(InputFilename, buf)) { + llvm::errs() << "Error: '" << ec.message() << "' opening file '" + << InputFilename << "'\n"; + } else { ec = coff2yaml(llvm::outs(), buf.take()); if (ec) llvm::errs() << "Error: " << ec.message() << " dumping COFF file\n";