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.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/IR/LLVMContext.cpp b/llvm/lib/IR/LLVMContext.cpp
index ead65ecfdb8..455ffb5ea62 100644
--- a/llvm/lib/IR/LLVMContext.cpp
+++ b/llvm/lib/IR/LLVMContext.cpp
@@ -225,6 +225,14 @@ LLVMContext::getDiagnosticMessagePrefix(DiagnosticSeverity Severity) {
}
void LLVMContext::diagnose(const DiagnosticInfo &DI) {
+ 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