Use formatv for the error instead of string stream.
authorJacques Pienaar <jpienaar@google.com>
Wed, 30 Jan 2019 01:39:52 +0000 (17:39 -0800)
committerjpienaar <jpienaar@google.com>
Fri, 29 Mar 2019 23:01:08 +0000 (16:01 -0700)
PiperOrigin-RevId: 231507680

mlir/lib/Target/LLVMIR/ConvertToLLVMIR.cpp

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