16 llvm::remarks::Format fmt) {
17 std::string errorMessage;
18 std::unique_ptr<llvm::ToolOutputFile> f =
openOutputFile(path, &errorMessage);
20 return llvm::createStringError(errorMessage);
22 auto serOr = llvm::remarks::createRemarkSerializer(fmt, f->os());
24 return llvm::createFileError(path, serOr.takeError());
27 std::make_unique<llvm::remarks::RemarkStreamer>(std::move(*serOr), path);
29 auto impl = std::unique_ptr<LLVMRemarkStreamer>(
new LLVMRemarkStreamer());
30 impl->remarkStreamer = std::move(rs);
31 impl->file = std::move(f);
32 return std::unique_ptr<MLIRRemarkStreamerBase>(std::move(
impl));
MLIRContext is the top-level object for a collection of MLIR operations.
std::unique_ptr< llvm::ToolOutputFile > openOutputFile(llvm::StringRef outputFilename, std::string *errorMessage=nullptr)
Open the file specified by its name for writing.