diff options
author | Nico Weber <nicolasweber@gmx.de> | 2019-10-14 14:44:26 +0000 |
---|---|---|
committer | Nico Weber <nicolasweber@gmx.de> | 2019-10-14 14:44:26 +0000 |
commit | 961c34d5f452b07ccd289fe54a8aff8404c9bc59 (patch) | |
tree | 4f0a8282790d58855694e7fd99c42ae4b2c9ee0f /llvm/tools/llvm-size | |
parent | 03462bbe7d549e1cbe0d38fbf0b195bb78456a80 (diff) | |
download | bcm5719-llvm-961c34d5f452b07ccd289fe54a8aff8404c9bc59.tar.gz bcm5719-llvm-961c34d5f452b07ccd289fe54a8aff8404c9bc59.zip |
Revert r374771 "[llvm-size] Tidy up error messages (PR42970)"
This reverts commit 83e52f5e1150018329b8907bb014c77ac382d611.
Makes Object/macho-invalid.test fail everywhere, e.g. here:
http://lab.llvm.org:8011/builders/llvm-hexagon-elf/builds/23669/steps/test-llvm/logs/FAIL%3A%20LLVM%3A%3Amacho-invalid.test
llvm-svn: 374780
Diffstat (limited to 'llvm/tools/llvm-size')
-rw-r--r-- | llvm/tools/llvm-size/llvm-size.cpp | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/llvm/tools/llvm-size/llvm-size.cpp b/llvm/tools/llvm-size/llvm-size.cpp index 7c63bc291f1..da56199fe3c 100644 --- a/llvm/tools/llvm-size/llvm-size.cpp +++ b/llvm/tools/llvm-size/llvm-size.cpp @@ -24,7 +24,6 @@ #include "llvm/Support/Format.h" #include "llvm/Support/InitLLVM.h" #include "llvm/Support/MemoryBuffer.h" -#include "llvm/Support/WithColor.h" #include "llvm/Support/raw_ostream.h" #include <algorithm> #include <string> @@ -107,9 +106,11 @@ static bool HadError = false; static std::string ToolName; -static void error(const Twine &Message, StringRef File) { +static bool error(Twine Message) { HadError = true; - WithColor::error(errs(), ToolName) << "'" << File << "': " << Message << "\n"; + errs() << ToolName << ": " << Message << ".\n"; + errs().flush(); + return true; } // This version of error() prints the archive name and member name, for example: @@ -118,7 +119,7 @@ static void error(const Twine &Message, StringRef File) { static void error(llvm::Error E, StringRef FileName, const Archive::Child &C, StringRef ArchitectureName = StringRef()) { HadError = true; - WithColor::error(errs(), ToolName) << "'" << FileName << "'"; + errs() << ToolName << ": " << FileName; Expected<StringRef> NameOrErr = C.getName(); // TODO: if we have a error getting the name then it would be nice to print @@ -137,7 +138,7 @@ static void error(llvm::Error E, StringRef FileName, const Archive::Child &C, raw_string_ostream OS(Buf); logAllUnhandledErrors(std::move(E), OS); OS.flush(); - errs() << ": " << Buf << "\n"; + errs() << " " << Buf << "\n"; } // This version of error() prints the file name and which architecture slice it // is from, for example: "foo.o (for architecture i386)" after the ToolName @@ -146,7 +147,7 @@ static void error(llvm::Error E, StringRef FileName, const Archive::Child &C, static void error(llvm::Error E, StringRef FileName, StringRef ArchitectureName = StringRef()) { HadError = true; - WithColor::error(errs(), ToolName) << "'" << FileName << "'"; + errs() << ToolName << ": " << FileName; if (!ArchitectureName.empty()) errs() << " (for architecture " << ArchitectureName << ") "; @@ -155,7 +156,7 @@ static void error(llvm::Error E, StringRef FileName, raw_string_ostream OS(Buf); logAllUnhandledErrors(std::move(E), OS); OS.flush(); - errs() << ": " << Buf << "\n"; + errs() << " " << Buf << "\n"; } /// Get the length of the string that represents @p num in Radix including the @@ -528,7 +529,7 @@ static bool checkMachOAndArchFlags(ObjectFile *O, StringRef Filename) { if (none_of(ArchFlags, [&](const std::string &Name) { return Name == T.getArchName(); })) { - error("no architecture specified", Filename); + error(Filename + ": No architecture specified"); return false; } return true; @@ -657,15 +658,15 @@ static void printFileSectionSizes(StringRef file) { error(std::move(Err), UA->getFileName()); } else { consumeError(AOrErr.takeError()); - error("mach-o universal file for architecture " + - StringRef(I->getArchFlagName()) + - " is not a mach-o file or an archive file", - file); + error("Mach-O universal file: " + file + " for architecture " + + StringRef(I->getArchFlagName()) + + " is not a Mach-O file or an archive file"); } } } if (!ArchFound) { - error("file does not contain architecture " + ArchFlags[i], file); + errs() << ToolName << ": file: " << file + << " does not contain architecture" << ArchFlags[i] << ".\n"; return; } } @@ -739,10 +740,9 @@ static void printFileSectionSizes(StringRef file) { error(std::move(Err), UA->getFileName()); } else { consumeError(AOrErr.takeError()); - error("mach-o universal file for architecture " + - StringRef(I->getArchFlagName()) + - " is not a mach-o file or an archive file", - file); + error("Mach-O universal file: " + file + " for architecture " + + StringRef(I->getArchFlagName()) + + " is not a Mach-O file or an archive file"); } return; } @@ -816,10 +816,9 @@ static void printFileSectionSizes(StringRef file) { error(std::move(Err), UA->getFileName()); } else { consumeError(AOrErr.takeError()); - error("mach-o universal file for architecture " + - StringRef(I->getArchFlagName()) + - " is not a mach-o file or an archive file", - file); + error("Mach-O universal file: " + file + " for architecture " + + StringRef(I->getArchFlagName()) + + " is not a Mach-O file or an archive file"); } } } else if (ObjectFile *o = dyn_cast<ObjectFile>(&Bin)) { @@ -837,7 +836,8 @@ static void printFileSectionSizes(StringRef file) { outs() << "\n"; } } else { - error("unsupported file type", file); + errs() << ToolName << ": " << file << ": " + << "Unrecognized file type.\n"; } // System V adds an extra newline at the end of each file. if (OutputFormat == sysv) |