summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2018-04-18 15:26:51 +0000
committerJonas Devlieghere <jonas@devlieghere.com>2018-04-18 15:26:51 +0000
commit6adef098913cdec275fac4c0682dde11eb30e77f (patch)
treeb1342930c2c5217cef552854e8be2ce68ab79174
parent02caafd7e5594123d44556a800545d7c71b175ff (diff)
downloadbcm5719-llvm-6adef098913cdec275fac4c0682dde11eb30e77f.tar.gz
bcm5719-llvm-6adef098913cdec275fac4c0682dde11eb30e77f.zip
[llvm-mca] Use WithColor for printing errors
Use convenience helpers in WithColor to print errors and notes. Differential revision: https://reviews.llvm.org/D45666 llvm-svn: 330267
-rw-r--r--llvm/tools/llvm-mca/llvm-mca.cpp27
1 files changed, 15 insertions, 12 deletions
diff --git a/llvm/tools/llvm-mca/llvm-mca.cpp b/llvm/tools/llvm-mca/llvm-mca.cpp
index a304d477892..9b9c70a8565 100644
--- a/llvm/tools/llvm-mca/llvm-mca.cpp
+++ b/llvm/tools/llvm-mca/llvm-mca.cpp
@@ -47,6 +47,7 @@
#include "llvm/Support/TargetRegistry.h"
#include "llvm/Support/TargetSelect.h"
#include "llvm/Support/ToolOutputFile.h"
+#include "llvm/Support/WithColor.h"
using namespace llvm;
@@ -306,7 +307,7 @@ int main(int argc, char **argv) {
ErrorOr<std::unique_ptr<MemoryBuffer>> BufferPtr =
MemoryBuffer::getFileOrSTDIN(InputFilename);
if (std::error_code EC = BufferPtr.getError()) {
- errs() << InputFilename << ": " << EC.message() << '\n';
+ WithColor::error() << InputFilename << ": " << EC.message() << '\n';
return 1;
}
@@ -337,29 +338,31 @@ int main(int argc, char **argv) {
return 1;
if (!STI->getSchedModel().isOutOfOrder()) {
- errs() << "error: please specify an out-of-order cpu. '" << MCPU
- << "' is an in-order cpu.\n";
+ WithColor::error() << "please specify an out-of-order cpu. '" << MCPU
+ << "' is an in-order cpu.\n";
return 1;
}
if (!STI->getSchedModel().hasInstrSchedModel()) {
- errs()
- << "error: unable to find instruction-level scheduling information for"
+ WithColor::error()
+ << "unable to find instruction-level scheduling information for"
<< " target triple '" << TheTriple.normalize() << "' and cpu '" << MCPU
<< "'.\n";
if (STI->getSchedModel().InstrItineraries)
- errs() << "note: cpu '" << MCPU << "' provides itineraries. However, "
- << "instruction itineraries are currently unsupported.\n";
+ WithColor::note()
+ << "cpu '" << MCPU << "' provides itineraries. However, "
+ << "instruction itineraries are currently unsupported.\n";
return 1;
}
std::unique_ptr<MCInstPrinter> IP(TheTarget->createMCInstPrinter(
Triple(TripleName), OutputAsmVariant, *MAI, *MCII, *MRI));
if (!IP) {
- errs() << "error: unable to create instruction printer for target triple '"
- << TheTriple.normalize() << "' with assembly variant "
- << OutputAsmVariant << ".\n";
+ WithColor::error()
+ << "unable to create instruction printer for target triple '"
+ << TheTriple.normalize() << "' with assembly variant "
+ << OutputAsmVariant << ".\n";
return 1;
}
@@ -372,14 +375,14 @@ int main(int argc, char **argv) {
return 1;
if (Regions.empty()) {
- errs() << "error: no assembly instructions found.\n";
+ WithColor::error() << "no assembly instructions found.\n";
return 1;
}
// Now initialize the output file.
auto OF = getOutputStream();
if (std::error_code EC = OF.getError()) {
- errs() << EC.message() << '\n';
+ WithColor::error() << EC.message() << '\n';
return 1;
}
OpenPOWER on IntegriCloud