LLVM  8.0.1
Public Types | Public Member Functions | Public Attributes | List of all members
llvm::DiagnosticHandler Struct Reference

This is the base class for diagnostic handling in LLVM. More...

#include "llvm/IR/DiagnosticHandler.h"

Inheritance diagram for llvm::DiagnosticHandler:
Inheritance graph
[legend]
Collaboration diagram for llvm::DiagnosticHandler:
Collaboration graph
[legend]

Public Types

using DiagnosticHandlerTy = void(*)(const DiagnosticInfo &DI, void *Context)
 

Public Member Functions

 DiagnosticHandler (void *DiagContext=nullptr)
 
virtual ~DiagnosticHandler ()=default
 
virtual bool handleDiagnostics (const DiagnosticInfo &DI)
 Override handleDiagnostics to provide custom implementation. More...
 
virtual bool isAnalysisRemarkEnabled (StringRef PassName) const
 Return true if analysis remarks are enabled, override to provide different implementation. More...
 
virtual bool isMissedOptRemarkEnabled (StringRef PassName) const
 Return true if missed optimization remarks are enabled, override to provide different implementation. More...
 
virtual bool isPassedOptRemarkEnabled (StringRef PassName) const
 Return true if passed optimization remarks are enabled, override to provide different implementation. More...
 
bool isAnyRemarkEnabled (StringRef PassName) const
 Return true if any type of remarks are enabled for this pass. More...
 
virtual bool isAnyRemarkEnabled () const
 Return true if any type of remarks are enabled for any pass. More...
 

Public Attributes

void * DiagnosticContext = nullptr
 
DiagnosticHandlerTy DiagHandlerCallback = nullptr
 DiagHandlerCallback is settable from the C API and base implementation of DiagnosticHandler will call it from handleDiagnostics(). More...
 

Detailed Description

This is the base class for diagnostic handling in LLVM.

The handleDiagnostics method must be overriden by the subclasses to handle diagnostic. The *RemarkEnabled methods can be overriden to control which remarks are enabled.

Definition at line 25 of file DiagnosticHandler.h.

Member Typedef Documentation

◆ DiagnosticHandlerTy

Definition at line 31 of file DiagnosticHandler.h.

Constructor & Destructor Documentation

◆ DiagnosticHandler()

llvm::DiagnosticHandler::DiagnosticHandler ( void *  DiagContext = nullptr)
inline

Definition at line 27 of file DiagnosticHandler.h.

References ~DiagnosticHandler().

◆ ~DiagnosticHandler()

virtual llvm::DiagnosticHandler::~DiagnosticHandler ( )
virtualdefault

Referenced by DiagnosticHandler().

Member Function Documentation

◆ handleDiagnostics()

virtual bool llvm::DiagnosticHandler::handleDiagnostics ( const DiagnosticInfo DI)
inlinevirtual

Override handleDiagnostics to provide custom implementation.

Return true if it handles diagnostics reporting properly otherwise return false to make LLVMContext::diagnose() to print the message with a prefix based on the severity.

Reimplemented in llvm::lto::LTOLLVMDiagnosticHandler.

Definition at line 43 of file DiagnosticHandler.h.

References DiagHandlerCallback, isAnalysisRemarkEnabled(), isMissedOptRemarkEnabled(), and isPassedOptRemarkEnabled().

◆ isAnalysisRemarkEnabled()

bool DiagnosticHandler::isAnalysisRemarkEnabled ( StringRef  PassName) const
virtual

Return true if analysis remarks are enabled, override to provide different implementation.

Definition at line 75 of file DiagnosticHandler.cpp.

Referenced by handleDiagnostics(), isAnyRemarkEnabled(), llvm::MachineOptimizationRemarkAnalysis::isEnabled(), llvm::OptimizationRemarkAnalysis::isEnabled(), and llvm::Module::shouldEmitInstrCountChangedRemark().

◆ isAnyRemarkEnabled() [1/2]

bool llvm::DiagnosticHandler::isAnyRemarkEnabled ( StringRef  PassName) const
inline

◆ isAnyRemarkEnabled() [2/2]

bool DiagnosticHandler::isAnyRemarkEnabled ( ) const
virtual

Return true if any type of remarks are enabled for any pass.

Definition at line 88 of file DiagnosticHandler.cpp.

Referenced by isAnyRemarkEnabled().

◆ isMissedOptRemarkEnabled()

bool DiagnosticHandler::isMissedOptRemarkEnabled ( StringRef  PassName) const
virtual

Return true if missed optimization remarks are enabled, override to provide different implementation.

Definition at line 79 of file DiagnosticHandler.cpp.

Referenced by handleDiagnostics(), isAnyRemarkEnabled(), llvm::MachineOptimizationRemarkMissed::isEnabled(), and llvm::OptimizationRemarkMissed::isEnabled().

◆ isPassedOptRemarkEnabled()

bool DiagnosticHandler::isPassedOptRemarkEnabled ( StringRef  PassName) const
virtual

Return true if passed optimization remarks are enabled, override to provide different implementation.

Definition at line 83 of file DiagnosticHandler.cpp.

Referenced by handleDiagnostics(), isAnyRemarkEnabled(), llvm::MachineOptimizationRemark::isEnabled(), and llvm::OptimizationRemark::isEnabled().

Member Data Documentation

◆ DiagHandlerCallback

DiagnosticHandlerTy llvm::DiagnosticHandler::DiagHandlerCallback = nullptr

DiagHandlerCallback is settable from the C API and base implementation of DiagnosticHandler will call it from handleDiagnostics().

Any derived class of DiagnosticHandler should not use callback but implement handleDiagnostics().

Definition at line 37 of file DiagnosticHandler.h.

Referenced by handleDiagnostics().

◆ DiagnosticContext

void* llvm::DiagnosticHandler::DiagnosticContext = nullptr

Definition at line 26 of file DiagnosticHandler.h.


The documentation for this struct was generated from the following files: