Index: tools/llvm-objdump/llvm-objdump.cpp =================================================================== --- tools/llvm-objdump/llvm-objdump.cpp +++ tools/llvm-objdump/llvm-objdump.cpp @@ -338,7 +338,6 @@ static StringSet<> DisasmFuncsSet; static StringSet<> FoundSectionSet; -static StringRef ToolName; typedef std::vector> SectionSymbolsTy; @@ -367,8 +366,7 @@ void error(std::error_code EC) { if (!EC) return; - WithColor::error(errs(), ToolName) - << "reading file: " << EC.message() << ".\n"; + WithColor::error(errs()) << "reading file: " << EC.message() << ".\n"; errs().flush(); exit(1); } @@ -376,12 +374,12 @@ void error(Error E) { if (!E) return; - WithColor::error(errs(), ToolName) << toString(std::move(E)); + WithColor::error(errs()) << toString(std::move(E)); exit(1); } LLVM_ATTRIBUTE_NORETURN void error(Twine Message) { - WithColor::error(errs(), ToolName) << Message << ".\n"; + WithColor::error(errs()) << Message << ".\n"; errs().flush(); exit(1); } @@ -390,13 +388,12 @@ // Output order between errs() and outs() matters especially for archive // files where the output is per member object. outs().flush(); - WithColor::warning(errs(), ToolName) << Message << "\n"; + WithColor::warning(errs()) << Message << "\n"; errs().flush(); } LLVM_ATTRIBUTE_NORETURN void report_error(StringRef File, Twine Message) { - WithColor::error(errs(), ToolName) - << "'" << File << "': " << Message << ".\n"; + WithColor::error(errs()) << "'" << File << "': " << Message << ".\n"; exit(1); } @@ -406,7 +403,7 @@ raw_string_ostream OS(Buf); logAllUnhandledErrors(std::move(E), OS); OS.flush(); - WithColor::error(errs(), ToolName) << "'" << File << "': " << Buf; + WithColor::error(errs()) << "'" << File << "': " << Buf; exit(1); } @@ -414,7 +411,7 @@ StringRef FileName, StringRef ArchitectureName) { assert(E); - WithColor::error(errs(), ToolName); + WithColor::error(errs()); if (ArchiveName != "") errs() << ArchiveName << "(" << FileName << ")"; else @@ -1879,16 +1876,15 @@ printMachOUnwindInfo(MachO); else // TODO: Extract DWARF dump tool to objdump. - WithColor::error(errs(), ToolName) - << "This operation is only currently supported " - "for COFF and MachO object files.\n"; + WithColor::error(errs()) << "This operation is only currently supported " + "for COFF and MachO object files.\n"; } /// Dump the raw contents of the __clangast section so the output can be piped /// into llvm-bcanalyzer. void printRawClangAST(const ObjectFile *Obj) { if (outs().is_displayed()) { - WithColor::error(errs(), ToolName) + WithColor::error(errs()) << "The -raw-clang-ast option will dump the raw binary contents of " "the clang ast section.\n" "Please redirect the output to a file or another program such as " @@ -1930,9 +1926,8 @@ } else if (isa(Obj)) { FaultMapSectionName = "__llvm_faultmaps"; } else { - WithColor::error(errs(), ToolName) - << "This operation is only currently supported " - "for ELF and Mach-O executable files.\n"; + WithColor::error(errs()) << "This operation is only currently supported " + "for ELF and Mach-O executable files.\n"; return; } @@ -2002,7 +1997,7 @@ static void printArchiveChild(StringRef Filename, const Archive::Child &C) { Expected ModeOrErr = C.getAccessMode(); if (!ModeOrErr) { - WithColor::error(errs(), ToolName) << "ill-formed archive entry.\n"; + WithColor::error(errs()) << "ill-formed archive entry.\n"; consumeError(ModeOrErr.takeError()); return; } @@ -2223,8 +2218,6 @@ if (StartAddress >= StopAddress) error("start address should be less than stop address"); - ToolName = argv[0]; - // Defaults to a.out if no filenames specified. if (InputFilenames.empty()) InputFilenames.push_back("a.out");