Files
archived-llvm-mirror/lib/IR/RemarkStreamer.cpp
Francis Visoiu Mistrih db7c2e63ef Reland "[Remarks] Refactor remark diagnostic emission in a RemarkStreamer"
This allows us to store more info about where we're emitting the remarks
without cluttering LLVMContext. This is needed for future support for
the remark section.

Differential Revision: https://reviews.llvm.org/D58996

Original llvm-svn: 355507

llvm-svn: 355514
2019-03-06 15:20:13 +00:00

29 lines
1.0 KiB
C++

//===- llvm/IR/RemarkStreamer.cpp - Remark Streamer -*- C++ -------------*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file contains the implementation of the remark outputting as part of
// LLVMContext.
//
//===----------------------------------------------------------------------===//
#include "llvm/IR/RemarkStreamer.h"
using namespace llvm;
RemarkStreamer::RemarkStreamer(StringRef Filename, raw_ostream &OS)
: Filename(Filename), OS(OS),
YAMLOutput(OS, reinterpret_cast<void *>(this)) {
assert(!Filename.empty() && "This needs to be a real filename.");
}
void RemarkStreamer::emit(const DiagnosticInfoOptimizationBase &Diag) {
DiagnosticInfoOptimizationBase *DiagPtr =
const_cast<DiagnosticInfoOptimizationBase *>(&Diag);
YAMLOutput << DiagPtr;
}