Commit e244a6fe authored by Simon Pilgrim's avatar Simon Pilgrim
Browse files

[mlir] Replace report_fatal_error(std::string) uses with report_fatal_error(Twine)

As described on D111049, we're trying to remove the <string> dependency from error handling and replace uses of report_fatal_error(const std::string&) with the Twine() variant which can be forward declared.
parent 00e704bf
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -394,7 +394,7 @@ private:
  void checkHasAbstractOperation(const OperationName &name) {
    if (LLVM_UNLIKELY(!name.getAbstractOperation()))
      llvm::report_fatal_error(
          "Building op `" + name.getStringRef().str() +
          "Building op `" + name.getStringRef() +
          "` but it isn't registered in this MLIRContext: the dialect may not "
          "be loaded or this operation isn't registered by the dialect. See "
          "also https://mlir.llvm.org/getting_started/Faq/"
+1 −1
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ using namespace mlir;
  os << "neither the scoping op nor the type class provide data layout "
        "information for "
     << type;
  llvm::report_fatal_error(os.str());
  llvm::report_fatal_error(Twine(os.str()));
}

/// Returns the bitwidth of the index type if specified in the param list.
+6 −4
Original line number Diff line number Diff line
@@ -39,14 +39,16 @@ Tester::isInteresting(ModuleOp module) const {
      llvm::sys::fs::createTemporaryFile("mlir-reduce", "mlir", fd, filepath);

  if (ec)
    llvm::report_fatal_error("Error making unique filename: " + ec.message());
    llvm::report_fatal_error(llvm::Twine("Error making unique filename: ") +
                             ec.message());

  llvm::ToolOutputFile out(filepath, fd);
  module.print(out.os());
  out.os().close();

  if (out.os().has_error())
    llvm::report_fatal_error("Error emitting the IR to file '" + filepath);
    llvm::report_fatal_error(llvm::Twine("Error emitting the IR to file '") +
                             filepath);

  size_t size = out.os().tell();
  return std::make_pair(isInteresting(filepath), size);
@@ -70,8 +72,8 @@ Tester::Interestingness Tester::isInteresting(StringRef testCase) const {
      /*SecondsToWait=*/0, /*MemoryLimit=*/0, &errMsg);

  if (result < 0)
    llvm::report_fatal_error("Error running interestingness test: " + errMsg,
                             false);
    llvm::report_fatal_error(
        llvm::Twine("Error running interestingness test: ") + errMsg, false);

  if (!result)
    return Interestingness::False;