aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Target/JSBackend/CallHandlers.h15
-rw-r--r--lib/Target/JSBackend/JSBackend.cpp8
2 files changed, 11 insertions, 12 deletions
diff --git a/lib/Target/JSBackend/CallHandlers.h b/lib/Target/JSBackend/CallHandlers.h
index 266b0596a6..ab4bc2e950 100644
--- a/lib/Target/JSBackend/CallHandlers.h
+++ b/lib/Target/JSBackend/CallHandlers.h
@@ -49,29 +49,20 @@ DEF_CALL_HANDLER(__default__, {
unsigned TypeNumArgs = FT->getNumParams();
unsigned ActualNumArgs = getNumArgOperands(CI);
if (TypeNumArgs != ActualNumArgs) {
- errs().changeColor(raw_ostream::YELLOW);
- errs() << "warning:";
- errs().resetColor();
- errs() << " unexpected number of arguments " << utostr(ActualNumArgs) << " in call to '" << F->getName() << "', should be " << utostr(TypeNumArgs) << "\n";
+ prettyWarning() << "unexpected number of arguments " << utostr(ActualNumArgs) << " in call to '" << F->getName() << "', should be " << utostr(TypeNumArgs) << "\n";
}
for (unsigned i = 0; i < std::min(TypeNumArgs, ActualNumArgs); i++) {
Type *TypeType = FT->getParamType(i);
Type *ActualType = CI->getOperand(i)->getType();
if (getFunctionSignatureLetter(TypeType) != getFunctionSignatureLetter(ActualType)) {
- errs().changeColor(raw_ostream::YELLOW);
- errs() << "warning:";
- errs().resetColor();
- errs() << " unexpected argument type " << *ActualType << " at index " << utostr(i) << " in call to '" << F->getName() << "', should be " << *TypeType << "\n";
+ prettyWarning() << "unexpected argument type " << *ActualType << " at index " << utostr(i) << " in call to '" << F->getName() << "', should be " << *TypeType << "\n";
}
}
}
Type *TypeType = FT->getReturnType();
Type *ActualType = CI->getType();
if (getFunctionSignatureLetter(TypeType) != getFunctionSignatureLetter(ActualType)) {
- errs().changeColor(raw_ostream::YELLOW);
- errs() << "warning:";
- errs().resetColor();
- errs() << " unexpected return type " << *ActualType << " in call to '" << F->getName() << "', should be " << *TypeType << "\n";
+ prettyWarning() << "unexpected return type " << *ActualType << " in call to '" << F->getName() << "', should be " << *TypeType << "\n";
}
}
} else {
diff --git a/lib/Target/JSBackend/JSBackend.cpp b/lib/Target/JSBackend/JSBackend.cpp
index 44b2f41955..0e0e199c49 100644
--- a/lib/Target/JSBackend/JSBackend.cpp
+++ b/lib/Target/JSBackend/JSBackend.cpp
@@ -55,6 +55,14 @@ using namespace llvm;
#define assert(x) { if (!(x)) report_fatal_error(#x); }
#endif
+raw_ostream &prettyWarning() {
+ errs().changeColor(raw_ostream::YELLOW);
+ errs() << "warning:";
+ errs().resetColor();
+ errs() << " ";
+ return errs();
+}
+
static cl::opt<bool>
PreciseF32("emscripten-precise-f32",
cl::desc("Enables Math.fround usage to implement precise float32 semantics and performance (see emscripten PRECISE_F32 option)"),