LLVM 20.0.0git
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]

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.
 
virtual bool isAnalysisRemarkEnabled (StringRef PassName) const
 Return true if analysis remarks are enabled, override to provide different implementation.
 
virtual bool isMissedOptRemarkEnabled (StringRef PassName) const
 Return true if missed optimization remarks are enabled, override to provide different implementation.
 
virtual bool isPassedOptRemarkEnabled (StringRef PassName) const
 Return true if passed optimization remarks are enabled, override to provide different implementation.
 
bool isAnyRemarkEnabled (StringRef PassName) const
 Return true if any type of remarks are enabled for this pass.
 
virtual bool isAnyRemarkEnabled () const
 Return true if any type of remarks are enabled for any pass.
 

Public Attributes

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

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 24 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.

◆ ~DiagnosticHandler()

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

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, and DiagnosticContext.

◆ isAnalysisRemarkEnabled()

bool DiagnosticHandler::isAnalysisRemarkEnabled ( StringRef  PassName) const
virtual

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

Definition at line 71 of file DiagnosticHandler.cpp.

References PassName.

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

◆ isAnyRemarkEnabled() [1/2]

bool DiagnosticHandler::isAnyRemarkEnabled ( ) const
virtual

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

Definition at line 84 of file DiagnosticHandler.cpp.

◆ isAnyRemarkEnabled() [2/2]

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

◆ isMissedOptRemarkEnabled()

bool DiagnosticHandler::isMissedOptRemarkEnabled ( StringRef  PassName) const
virtual

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

Definition at line 75 of file DiagnosticHandler.cpp.

References PassName.

Referenced by 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 79 of file DiagnosticHandler.cpp.

References PassName.

Referenced by 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 25 of file DiagnosticHandler.h.

Referenced by handleDiagnostics().

◆ HasErrors

bool llvm::DiagnosticHandler::HasErrors = false

Definition at line 26 of file DiagnosticHandler.h.


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