diff options
author | Quentin Colombet <qcolombet@apple.com> | 2013-12-17 01:19:59 +0000 |
---|---|---|
committer | Quentin Colombet <qcolombet@apple.com> | 2013-12-17 01:19:59 +0000 |
commit | e0c25bd05d3965b31daf6ad27a02fa79991045c8 (patch) | |
tree | 736f98fd5f318a6ea015c3b74f75bf25e874e55d /include | |
parent | 83196a9fcb863dec7a66242f2aa971dd3a273c15 (diff) | |
download | llvm-e0c25bd05d3965b31daf6ad27a02fa79991045c8.tar.gz llvm-e0c25bd05d3965b31daf6ad27a02fa79991045c8.tar.bz2 llvm-e0c25bd05d3965b31daf6ad27a02fa79991045c8.tar.xz |
Revert r197438 and r197447 until we figure out how to avoid circular dependency at link time
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197451 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/IR/LLVMContext.h | 33 | ||||
-rw-r--r-- | include/llvm/Support/DiagnosticInfo.h | 165 | ||||
-rw-r--r-- | include/llvm/Support/DiagnosticPrinter.h | 84 |
3 files changed, 0 insertions, 282 deletions
diff --git a/include/llvm/IR/LLVMContext.h b/include/llvm/IR/LLVMContext.h index b80f7c82db..dd379ae5e7 100644 --- a/include/llvm/IR/LLVMContext.h +++ b/include/llvm/IR/LLVMContext.h @@ -27,7 +27,6 @@ class Twine; class Instruction; class Module; class SMDiagnostic; -class DiagnosticInfo; template <typename T> class SmallVectorImpl; /// This is an important class for using LLVM in a threaded context. It @@ -65,11 +64,6 @@ public: typedef void (*InlineAsmDiagHandlerTy)(const SMDiagnostic&, void *Context, unsigned LocCookie); - /// Defines the type of a diagnostic handler. - /// \see LLVMContext::setDiagnosticHandler. - /// \see LLVMContext::diagnose. - typedef void (*DiagnosticHandlerTy)(const DiagnosticInfo &DI, void *Context); - /// setInlineAsmDiagnosticHandler - This method sets a handler that is invoked /// when problems with inline asm are detected by the backend. The first /// argument is a function pointer and the second is a context pointer that @@ -88,33 +82,6 @@ public: /// setInlineAsmDiagnosticHandler. void *getInlineAsmDiagnosticContext() const; - /// setDiagnosticHandler - This method sets a handler that is invoked - /// when the backend needs to report anything to the user. The first - /// argument is a function pointer and the second is a context pointer that - /// gets passed into the DiagHandler. - /// - /// LLVMContext doesn't take ownership or interpret either of these - /// pointers. - void setDiagnosticHandler(DiagnosticHandlerTy DiagHandler, - void *DiagContext = 0); - - /// getDiagnosticHandler - Return the diagnostic handler set by - /// setDiagnosticHandler. - DiagnosticHandlerTy getDiagnosticHandler() const; - - /// getDiagnosticContext - Return the diagnostic context set by - /// setDiagnosticContext. - void *getDiagnosticContext() const; - - /// diagnose - Report a message to the currently installed diagnostic handler. - /// This function returns, in particular in the case of error reporting - /// (DI.Severity == RS_Error), so the caller should leave the compilation - /// process in a self-consistent state, even though the generated code - /// need not be correct. - /// The diagnostic message will be implicitly prefixed with a severity - /// keyword according to \p DI.getSeverity(), i.e., "error: " - /// for RS_Error, "warning: " for RS_Warning, and "note: " for RS_Note. - void diagnose(const DiagnosticInfo &DI); /// emitError - Emit an error message to the currently installed error handler /// with optional location information. This function returns, so code should diff --git a/include/llvm/Support/DiagnosticInfo.h b/include/llvm/Support/DiagnosticInfo.h deleted file mode 100644 index 151e155eaf..0000000000 --- a/include/llvm/Support/DiagnosticInfo.h +++ /dev/null @@ -1,165 +0,0 @@ -//===- llvm/Support/DiagnosticInfo.h - Diagnostic Declaration ---*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file declares the different classes involved in low level diagnostics. -// -// Diagnostics reporting is still done as part of the LLVMContext. -//===----------------------------------------------------------------------===// - -#ifndef LLVM_SUPPORT_DIAGNOSTICINFO_H -#define LLVM_SUPPORT_DIAGNOSTICINFO_H - -#include "llvm/ADT/ArrayRef.h" -#include "llvm/Support/Casting.h" - -namespace llvm { - -// Forward declarations. -class DiagnosticPrinter; -class Function; -class Instruction; -class Twine; -class Value; - -/// \brief Defines the different supported severity of a diagnostic. -enum DiagnosticSeverity { - DS_Error, - DS_Warning, - DS_Note -}; - -/// \brief Defines the different supported kind of a diagnostic. -/// This enum should be extended with a new ID for each added concrete subclass. -enum DiagnosticKind { - DK_InlineAsm, - DK_StackSize, - DK_FirstPluginKind -}; - -/// \brief Get the next available kind ID for a plugin diagnostic. -/// Each time this function is called, it returns a different number. -/// Therefore, a plugin that wants to "identify" its own classes -/// with a dynamic identifier, just have to use this method to get a new ID -/// and assign it to each of its classes. -/// The returned ID will be greater than or equal to DK_FirstPluginKind. -/// Thus, the plugin identifiers will not conflict with the -/// DiagnosticKind values. -int getNextAvailablePluginDiagnosticKind(); - -/// \brief This is the base abstract class for diagnostic reporting in -/// the backend. -/// The print method must be overloaded by the subclasses to print a -/// user-friendly message in the client of the backend (let us call it a -/// frontend). -class DiagnosticInfo { -private: - /// Kind defines the kind of report this is about. - const /* DiagnosticKind */ int Kind; - /// Severity gives the severity of the diagnostic. - const DiagnosticSeverity Severity; - -public: - DiagnosticInfo(/* DiagnosticKind */ int Kind, DiagnosticSeverity Severity) - : Kind(Kind), Severity(Severity) {} - - virtual ~DiagnosticInfo() {} - - /* DiagnosticKind */ int getKind() const { return Kind; } - DiagnosticSeverity getSeverity() const { return Severity; } - - /// Print using the given \p DP a user-friendly message. - /// This is the default message that will be printed to the user. - /// It is used when the frontend does not directly take advantage - /// of the information contained in fields of the subclasses. - /// The printed message must not end with '.' nor start with a severity - /// keyword. - virtual void print(DiagnosticPrinter &DP) const = 0; -}; - -/// Diagnostic information for inline asm reporting. -/// This is basically a message and an optional location. -class DiagnosticInfoInlineAsm : public DiagnosticInfo { -private: - /// Optional line information. 0 if not set. - unsigned LocCookie; - /// Message to be reported. - const Twine &MsgStr; - /// Optional origin of the problem. - const Instruction *Instr; - -public: - /// \p MsgStr is the message to be reported to the frontend. - /// This class does not copy \p MsgStr, therefore the reference must be valid - /// for the whole life time of the Diagnostic. - DiagnosticInfoInlineAsm(const Twine &MsgStr, - DiagnosticSeverity Severity = DS_Error) - : DiagnosticInfo(DK_InlineAsm, Severity), LocCookie(0), MsgStr(MsgStr), - Instr(NULL) {} - - /// \p LocCookie if non-zero gives the line number for this report. - /// \p MsgStr gives the message. - /// This class does not copy \p MsgStr, therefore the reference must be valid - /// for the whole life time of the Diagnostic. - DiagnosticInfoInlineAsm(unsigned LocCookie, const Twine &MsgStr, - DiagnosticSeverity Severity = DS_Error) - : DiagnosticInfo(DK_InlineAsm, Severity), LocCookie(LocCookie), - MsgStr(MsgStr), Instr(NULL) {} - - /// \p Instr gives the original instruction that triggered the diagnostic. - /// \p MsgStr gives the message. - /// This class does not copy \p MsgStr, therefore the reference must be valid - /// for the whole life time of the Diagnostic. - /// Same for \p I. - DiagnosticInfoInlineAsm(const Instruction &I, const Twine &MsgStr, - DiagnosticSeverity Severity = DS_Error); - - unsigned getLocCookie() const { return LocCookie; } - const Twine &getMsgStr() const { return MsgStr; } - const Instruction *getInstruction() const { return Instr; } - - /// \see DiagnosticInfo::print. - virtual void print(DiagnosticPrinter &DP) const; - - /// Hand rolled RTTI. - static bool classof(const DiagnosticInfo *DI) { - return DI->getKind() == DK_InlineAsm; - } -}; - -/// Diagnostic information for stack size reporting. -/// This is basically a function and a size. -class DiagnosticInfoStackSize : public DiagnosticInfo { -private: - /// The function that is concerned by this stack size diagnostic. - const Function &Fn; - /// The computed stack size. - unsigned StackSize; - -public: - /// \p The function that is concerned by this stack size diagnostic. - /// \p The computed stack size. - DiagnosticInfoStackSize(const Function &Fn, unsigned StackSize, - DiagnosticSeverity Severity = DS_Warning) - : DiagnosticInfo(DK_StackSize, Severity), Fn(Fn), StackSize(StackSize) {} - - const Function &getFunction() const { return Fn; } - unsigned getStackSize() const { return StackSize; } - - /// \see DiagnosticInfo::print. - virtual void print(DiagnosticPrinter &DP) const; - - /// Hand rolled RTTI. - static bool classof(const DiagnosticInfo *DI) { - return DI->getKind() == DK_StackSize; - } -}; - -} // End namespace llvm - -#endif diff --git a/include/llvm/Support/DiagnosticPrinter.h b/include/llvm/Support/DiagnosticPrinter.h deleted file mode 100644 index 721b1b4212..0000000000 --- a/include/llvm/Support/DiagnosticPrinter.h +++ /dev/null @@ -1,84 +0,0 @@ -//===- llvm/Support/DiagnosticPrinter.h - Diagnostic Printer ----*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file declares the main interface for printer backend diagnostic. -// -// Clients of the backend diagnostics should overload this interface based -// on their needs. -//===----------------------------------------------------------------------===// - -#ifndef LLVM_SUPPORT_DIAGNOSTICPRINTER_H -#define LLVM_SUPPORT_DIAGNOSTICPRINTER_H - -#include <string> - -namespace llvm { -// Forward declarations. -class raw_ostream; -class StringRef; -class Twine; -class Value; - -/// \brief Interface for custom diagnostic printing. -class DiagnosticPrinter { -public: - virtual ~DiagnosticPrinter() {} - - // Simple types. - virtual DiagnosticPrinter &operator<<(char C) = 0; - virtual DiagnosticPrinter &operator<<(unsigned char C) = 0; - virtual DiagnosticPrinter &operator<<(signed char C) = 0; - virtual DiagnosticPrinter &operator<<(StringRef Str) = 0; - virtual DiagnosticPrinter &operator<<(const char *Str) = 0; - virtual DiagnosticPrinter &operator<<(const std::string &Str) = 0; - virtual DiagnosticPrinter &operator<<(unsigned long N) = 0; - virtual DiagnosticPrinter &operator<<(long N) = 0; - virtual DiagnosticPrinter &operator<<(unsigned long long N) = 0; - virtual DiagnosticPrinter &operator<<(long long N) = 0; - virtual DiagnosticPrinter &operator<<(const void *P) = 0; - virtual DiagnosticPrinter &operator<<(unsigned int N) = 0; - virtual DiagnosticPrinter &operator<<(int N) = 0; - virtual DiagnosticPrinter &operator<<(double N) = 0; - virtual DiagnosticPrinter &operator<<(const Twine &Str) = 0; - - // IR related types. - virtual DiagnosticPrinter &operator<<(const Value &V) = 0; -}; - -/// \brief Basic diagnostic printer that uses an underlying raw_ostream. -class DiagnosticPrinterRawOStream : public DiagnosticPrinter { -protected: - raw_ostream &Stream; - -public: - DiagnosticPrinterRawOStream(raw_ostream &Stream) : Stream(Stream) {}; - - // Simple types. - virtual DiagnosticPrinter &operator<<(char C); - virtual DiagnosticPrinter &operator<<(unsigned char C); - virtual DiagnosticPrinter &operator<<(signed char C); - virtual DiagnosticPrinter &operator<<(StringRef Str); - virtual DiagnosticPrinter &operator<<(const char *Str); - virtual DiagnosticPrinter &operator<<(const std::string &Str); - virtual DiagnosticPrinter &operator<<(unsigned long N); - virtual DiagnosticPrinter &operator<<(long N); - virtual DiagnosticPrinter &operator<<(unsigned long long N); - virtual DiagnosticPrinter &operator<<(long long N); - virtual DiagnosticPrinter &operator<<(const void *P); - virtual DiagnosticPrinter &operator<<(unsigned int N); - virtual DiagnosticPrinter &operator<<(int N); - virtual DiagnosticPrinter &operator<<(double N); - virtual DiagnosticPrinter &operator<<(const Twine &Str); - - // IR related types. - virtual DiagnosticPrinter &operator<<(const Value &V); -}; -} // End namespace llvm - -#endif |