mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-01 15:40:46 +00:00
b6c4a84592
The patch adds a new LLVMContext::diagnose that can be used to communicate to the front-end, if any, that something of interest happened. The diagnostics are supported by a new abstraction, the DiagnosticInfo class. The base class contains the following information: - The kind of the report: What this is about. - The severity of the report: How bad this is. This patch also adds 2 classes: - DiagnosticInfoInlineAsm: For inline asm reporting. Basically, this diagnostic will be used to switch to the new diagnostic API for LLVMContext::emitError. - DiagnosticStackSize: For stack size reporting. Comes as a replacement of the hard coded warning in PEI. This patch also features dynamic diagnostic identifiers. In other words plugins can use this infrastructure for their own diagnostics (for more details, see getNextAvailablePluginDiagnosticKind). This patch introduces a new DiagnosticHandlerTy and a new DiagnosticContext in the LLVMContext that should be set by the front-end to be able to map these diagnostics in its own system. http://llvm-reviews.chandlerc.com/D2376 <rdar://problem/15515174> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197438 91177308-0d34-0410-b5e6-96231b3b80d8
104 lines
2.5 KiB
C++
104 lines
2.5 KiB
C++
//===- llvm/Support/DiagnosticInfo.cpp - Diagnostic Definitions -*- C++ -*-===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This file defines the a diagnostic printer relying on raw_ostream.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "llvm/ADT/Twine.h"
|
|
#include "llvm/Analysis/ScalarEvolution.h"
|
|
#include "llvm/CodeGen/MachineInstr.h"
|
|
#include "llvm/IR/Value.h"
|
|
#include "llvm/Support/DiagnosticPrinter.h"
|
|
#include "llvm/Support/raw_ostream.h"
|
|
|
|
using namespace llvm;
|
|
|
|
DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(char C) {
|
|
Stream << C;
|
|
return *this;
|
|
}
|
|
|
|
DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(unsigned char C) {
|
|
Stream << C;
|
|
return *this;
|
|
}
|
|
|
|
DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(signed char C) {
|
|
Stream << C;
|
|
return *this;
|
|
}
|
|
|
|
DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(StringRef Str) {
|
|
Stream << Str;
|
|
return *this;
|
|
}
|
|
|
|
DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(const char *Str) {
|
|
Stream << Str;
|
|
return *this;
|
|
}
|
|
|
|
DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(
|
|
const std::string &Str) {
|
|
Stream << Str;
|
|
return *this;
|
|
}
|
|
|
|
DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(unsigned long N) {
|
|
Stream << N;
|
|
return *this;
|
|
}
|
|
DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(long N) {
|
|
Stream << N;
|
|
return *this;
|
|
}
|
|
|
|
DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(
|
|
unsigned long long N) {
|
|
Stream << N;
|
|
return *this;
|
|
}
|
|
|
|
DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(long long N) {
|
|
Stream << N;
|
|
return *this;
|
|
}
|
|
|
|
DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(const void *P) {
|
|
Stream << P;
|
|
return *this;
|
|
}
|
|
|
|
DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(unsigned int N) {
|
|
Stream << N;
|
|
return *this;
|
|
}
|
|
|
|
DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(int N) {
|
|
Stream << N;
|
|
return *this;
|
|
}
|
|
|
|
DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(double N) {
|
|
Stream << N;
|
|
return *this;
|
|
}
|
|
|
|
DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(const Twine &Str) {
|
|
Stream << Str.getSingleStringRef();
|
|
return *this;
|
|
}
|
|
|
|
// IR related types.
|
|
DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(const Value &V) {
|
|
Stream << V.getName();
|
|
return *this;
|
|
}
|