![]() System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, Directory : /usr/include/llvm-10/llvm/IR/ |
Upload File : |
//===- DiagnosticHandler.h - DiagnosticHandler class for LLVM ---*- C++ -*-===// // // 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 // //===----------------------------------------------------------------------===// // Base DiagnosticHandler class declaration. Derive from this class to provide // custom diagnostic reporting. //===----------------------------------------------------------------------===// #ifndef LLVM_IR_DIAGNOSTICHANDLER_H #define LLVM_IR_DIAGNOSTICHANDLER_H #include "llvm/ADT/StringRef.h" namespace llvm { class DiagnosticInfo; /// 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. struct DiagnosticHandler { void *DiagnosticContext = nullptr; DiagnosticHandler(void *DiagContext = nullptr) : DiagnosticContext(DiagContext) {} virtual ~DiagnosticHandler() = default; using DiagnosticHandlerTy = void (*)(const DiagnosticInfo &DI, void *Context); /// 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(). DiagnosticHandlerTy DiagHandlerCallback = nullptr; /// 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. virtual bool handleDiagnostics(const DiagnosticInfo &DI) { if (DiagHandlerCallback) { DiagHandlerCallback(DI, DiagnosticContext); return true; } return false; } /// Return true if analysis remarks are enabled, override /// to provide different implementation. virtual bool isAnalysisRemarkEnabled(StringRef PassName) const; /// Return true if missed optimization remarks are enabled, override /// to provide different implementation. virtual bool isMissedOptRemarkEnabled(StringRef PassName) const; /// Return true if passed optimization remarks are enabled, override /// to provide different implementation. virtual bool isPassedOptRemarkEnabled(StringRef PassName) const; /// Return true if any type of remarks are enabled for this pass. bool isAnyRemarkEnabled(StringRef PassName) const { return (isMissedOptRemarkEnabled(PassName) || isPassedOptRemarkEnabled(PassName) || isAnalysisRemarkEnabled(PassName)); } /// Return true if any type of remarks are enabled for any pass. virtual bool isAnyRemarkEnabled() const; }; } // namespace llvm #endif // LLVM_IR_DIAGNOSTICHANDLER_H