blob: 0b983408e46668605df8e9eef1bf1da2d7d931ce [file] [log] [blame]
Francis Visoiu Mistrihb8a847c2019-03-06 15:20:13 +00001//===- llvm/IR/RemarkStreamer.cpp - Remark Streamer -*- C++ -------------*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file contains the implementation of the remark outputting as part of
10// LLVMContext.
11//
12//===----------------------------------------------------------------------===//
13
14#include "llvm/IR/RemarkStreamer.h"
15
16using namespace llvm;
17
18RemarkStreamer::RemarkStreamer(StringRef Filename, raw_ostream &OS)
19 : Filename(Filename), OS(OS),
20 YAMLOutput(OS, reinterpret_cast<void *>(this)) {
21 assert(!Filename.empty() && "This needs to be a real filename.");
22}
23
24void RemarkStreamer::emit(const DiagnosticInfoOptimizationBase &Diag) {
25 DiagnosticInfoOptimizationBase *DiagPtr =
26 const_cast<DiagnosticInfoOptimizationBase *>(&Diag);
27 YAMLOutput << DiagPtr;
28}