Francis Visoiu Mistrih | b8a847c | 2019-03-06 15:20:13 +0000 | [diff] [blame^] | 1 | //===- 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 | |
| 16 | using namespace llvm; |
| 17 | |
| 18 | RemarkStreamer::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 | |
| 24 | void RemarkStreamer::emit(const DiagnosticInfoOptimizationBase &Diag) { |
| 25 | DiagnosticInfoOptimizationBase *DiagPtr = |
| 26 | const_cast<DiagnosticInfoOptimizationBase *>(&Diag); |
| 27 | YAMLOutput << DiagPtr; |
| 28 | } |