Use formatv for the error instead of string stream.

PiperOrigin-RevId: 231507680
This commit is contained in:
Jacques Pienaar 2019-01-29 17:39:52 -08:00 committed by jpienaar
parent a759cf3190
commit b52dd7f788

View File

@ -39,6 +39,7 @@
#include "llvm/IR/LLVMContext.h" #include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h" #include "llvm/IR/Module.h"
#include "llvm/IR/Type.h" #include "llvm/IR/Type.h"
#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/ToolOutputFile.h" #include "llvm/Support/ToolOutputFile.h"
using namespace mlir; using namespace mlir;
@ -268,11 +269,8 @@ llvm::Type *ModuleLowerer::convertType(Type type) {
return convertVectorType(vectorType); return convertVectorType(vectorType);
MLIRContext *context = type.getContext(); MLIRContext *context = type.getContext();
std::string message; context->emitError(UnknownLoc::get(context),
llvm::raw_string_ostream os(message); llvm::formatv("unsupported type: {0}", type));
os << "unsupported type: ";
type.print(os);
context->emitError(UnknownLoc::get(context), os.str());
return nullptr; return nullptr;
} }