summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/LLVMContext.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/IR/LLVMContext.cpp')
-rw-r--r--llvm/lib/IR/LLVMContext.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/llvm/lib/IR/LLVMContext.cpp b/llvm/lib/IR/LLVMContext.cpp
index 75d0218bcc8..1cea21461f4 100644
--- a/llvm/lib/IR/LLVMContext.cpp
+++ b/llvm/lib/IR/LLVMContext.cpp
@@ -21,7 +21,6 @@
#include "llvm/IR/DiagnosticPrinter.h"
#include "llvm/IR/Metadata.h"
#include "llvm/IR/Module.h"
-#include "llvm/IR/RemarkStreamer.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
@@ -161,15 +160,12 @@ uint64_t LLVMContext::getDiagnosticsHotnessThreshold() const {
return pImpl->DiagnosticsHotnessThreshold;
}
-RemarkStreamer *LLVMContext::getRemarkStreamer() {
- return pImpl->RemarkStreamer.get();
+yaml::Output *LLVMContext::getDiagnosticsOutputFile() {
+ return pImpl->DiagnosticsOutputFile.get();
}
-const RemarkStreamer *LLVMContext::getRemarkStreamer() const {
- return const_cast<LLVMContext *>(this)->getRemarkStreamer();
-}
-void LLVMContext::setRemarkStreamer(
- std::unique_ptr<RemarkStreamer> RemarkStreamer) {
- pImpl->RemarkStreamer = std::move(RemarkStreamer);
+
+void LLVMContext::setDiagnosticsOutputFile(std::unique_ptr<yaml::Output> F) {
+ pImpl->DiagnosticsOutputFile = std::move(F);
}
DiagnosticHandler::DiagnosticHandlerTy
@@ -232,10 +228,14 @@ LLVMContext::getDiagnosticMessagePrefix(DiagnosticSeverity Severity) {
}
void LLVMContext::diagnose(const DiagnosticInfo &DI) {
- if (auto *OptDiagBase = dyn_cast<DiagnosticInfoOptimizationBase>(&DI))
- if (RemarkStreamer *RS = getRemarkStreamer())
- RS->emit(*OptDiagBase);
-
+ if (auto *OptDiagBase = dyn_cast<DiagnosticInfoOptimizationBase>(&DI)) {
+ yaml::Output *Out = getDiagnosticsOutputFile();
+ if (Out) {
+ // For remarks the << operator takes a reference to a pointer.
+ auto *P = const_cast<DiagnosticInfoOptimizationBase *>(OptDiagBase);
+ *Out << P;
+ }
+ }
// If there is a report handler, use it.
if (pImpl->DiagHandler &&
(!pImpl->RespectDiagnosticFilters || isDiagnosticEnabled(DI)) &&
OpenPOWER on IntegriCloud