aboutsummaryrefslogtreecommitdiff
path: root/lib/IR/LLVMContext.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2019-08-20 20:50:12 +0000
committerDimitry Andric <dim@FreeBSD.org>2019-08-20 20:50:12 +0000
commite6d1592492a3a379186bfb02bd0f4eda0669c0d5 (patch)
tree599ab169a01f1c86eda9adc774edaedde2f2db5b /lib/IR/LLVMContext.cpp
parent1a56a5ead7a2e84bee8240f5f6b033b5f1707154 (diff)
Diffstat (limited to 'lib/IR/LLVMContext.cpp')
-rw-r--r--lib/IR/LLVMContext.cpp35
1 files changed, 18 insertions, 17 deletions
diff --git a/lib/IR/LLVMContext.cpp b/lib/IR/LLVMContext.cpp
index 944d8265151d..e1cdf6b539db 100644
--- a/lib/IR/LLVMContext.cpp
+++ b/lib/IR/LLVMContext.cpp
@@ -1,9 +1,8 @@
//===-- LLVMContext.cpp - Implement LLVMContext ---------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
@@ -22,6 +21,7 @@
#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"
@@ -62,6 +62,8 @@ LLVMContext::LLVMContext() : pImpl(new LLVMContextImpl(*this)) {
{MD_callees, "callees"},
{MD_irr_loop, "irr_loop"},
{MD_access_group, "llvm.access.group"},
+ {MD_callback, "callback"},
+ {MD_preserve_access_index, "llvm.preserve.access.index"},
};
for (auto &MDKind : MDKinds) {
@@ -160,12 +162,15 @@ uint64_t LLVMContext::getDiagnosticsHotnessThreshold() const {
return pImpl->DiagnosticsHotnessThreshold;
}
-yaml::Output *LLVMContext::getDiagnosticsOutputFile() {
- return pImpl->DiagnosticsOutputFile.get();
+RemarkStreamer *LLVMContext::getRemarkStreamer() {
+ return pImpl->RemarkDiagStreamer.get();
}
-
-void LLVMContext::setDiagnosticsOutputFile(std::unique_ptr<yaml::Output> F) {
- pImpl->DiagnosticsOutputFile = std::move(F);
+const RemarkStreamer *LLVMContext::getRemarkStreamer() const {
+ return const_cast<LLVMContext *>(this)->getRemarkStreamer();
+}
+void LLVMContext::setRemarkStreamer(
+ std::unique_ptr<RemarkStreamer> RemarkStreamer) {
+ pImpl->RemarkDiagStreamer = std::move(RemarkStreamer);
}
DiagnosticHandler::DiagnosticHandlerTy
@@ -228,14 +233,10 @@ 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 (auto *OptDiagBase = dyn_cast<DiagnosticInfoOptimizationBase>(&DI))
+ if (RemarkStreamer *RS = getRemarkStreamer())
+ RS->emit(*OptDiagBase);
+
// If there is a report handler, use it.
if (pImpl->DiagHandler &&
(!pImpl->RespectDiagnosticFilters || isDiagnosticEnabled(DI)) &&