15 #ifndef LLVM_IR_DIAGNOSTICINFO_H
16 #define LLVM_IR_DIAGNOSTICINFO_H
28 class DiagnosticPrinter;
31 class LLVMContextImpl;
88 : Kind(Kind), Severity(Severity) {}
133 MsgStr(MsgStr), Instr(nullptr) {}
189 unsigned MetadataVersion;
197 MetadataVersion(MetadataVersion) {}
217 LineNum(LineNum), Msg(Msg) {}
221 LineNum(0), Msg(Msg) {}
225 LineNum(0), Msg(Msg) {}
240 const char *FileName;
262 const char *PassName,
const Function &Fn,
264 :
DiagnosticInfo(Kind, Severity), PassName(PassName), Fn(Fn), DLoc(DLoc),
302 const char *PassName;
328 PassName, Fn, DLoc, Msg) {}
354 PassName, Fn, DLoc, Msg) {}
381 PassName, Fn, DLoc, Msg) {}
454 nullptr, Fn, DLoc, Msg) {}
468 const DebugLoc &DLoc,
const Twine &Msg);
474 const DebugLoc &DLoc,
const Twine &Msg);
DiagnosticInfoStackSize(const Function &Fn, unsigned StackSize, DiagnosticSeverity Severity=DS_Warning)
The function that is concerned by this stack size diagnostic.
DiagnosticKind
Defines the different supported kind of a diagnostic.
DiagnosticInfoOptimizationBase(enum DiagnosticKind Kind, enum DiagnosticSeverity Severity, const char *PassName, const Function &Fn, const DebugLoc &DLoc, const Twine &Msg)
PassName is the name of the pass emitting this diagnostic.
void getLocation(StringRef *Filename, unsigned *Line, unsigned *Column) const
Return location information for this diagnostic in three parts: the source file name, line number and column.
unsigned getStackSize() const
A Module instance is used to store all the information related to an LLVM module. ...
DiagnosticInfoInlineAsm(const Twine &MsgStr, DiagnosticSeverity Severity=DS_Error)
MsgStr is the message to be reported to the frontend.
DiagnosticSeverity
Defines the different supported severity of a diagnostic.
void print(DiagnosticPrinter &DP) const override
DiagnosticInfoMIRParser(DiagnosticSeverity Severity, const SMDiagnostic &Diagnostic)
Diagnostic information for machine IR parser.
const Function & getFunction() const
DiagnosticInfoInlineAsm(unsigned LocCookie, const Twine &MsgStr, DiagnosticSeverity Severity=DS_Error)
LocCookie if non-zero gives the line number for this report.
static bool classof(const DiagnosticInfo *DI)
Diagnostic information for stack size reporting.
void emitOptimizationRemark(LLVMContext &Ctx, const char *PassName, const Function &Fn, const DebugLoc &DLoc, const Twine &Msg)
Emit an optimization-applied message.
DiagnosticInfoOptimizationFailure(const Function &Fn, const DebugLoc &DLoc, const Twine &Msg)
Fn is the function where the diagnostic is being emitted.
#define DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ty, ref)
void emitOptimizationRemarkAnalysis(LLVMContext &Ctx, const char *PassName, const Function &Fn, const DebugLoc &DLoc, const Twine &Msg)
Emit an optimization analysis remark message.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
const char * getPassName() const
Diagnostic information for optimization failures.
Interface for custom diagnostic printing.
const char * getFileName() const
DiagnosticInfo(int Kind, DiagnosticSeverity Severity)
virtual ~DiagnosticInfo()
const DebugLoc & getDebugLoc() const
void emitOptimizationRemarkMissed(LLVMContext &Ctx, const char *PassName, const Function &Fn, const DebugLoc &DLoc, const Twine &Msg)
Emit an optimization-missed message.
DiagnosticInfoSampleProfile(const char *FileName, unsigned LineNum, const Twine &Msg, DiagnosticSeverity Severity=DS_Error)
static bool classof(const DiagnosticInfo *DI)
DiagnosticSeverity getSeverity() const
This is the base abstract class for diagnostic reporting in the backend.
bool isLocationAvailable() const
Return true if location information is available for this diagnostic.
const Twine & getMsg() const
const Instruction * getInstruction() const
static bool classof(const DiagnosticInfo *DI)
Diagnostic information for inline asm reporting.
virtual void print(DiagnosticPrinter &DP) const =0
Print using the given DP a user-friendly message.
const std::string getLocationStr() const
Return a string with the location information for this diagnostic in the format "file:line:col".
void emitLoopVectorizeWarning(LLVMContext &Ctx, const Function &Fn, const DebugLoc &DLoc, const Twine &Msg)
Emit a warning when loop vectorization is specified but fails.
void emitLoopInterleaveWarning(LLVMContext &Ctx, const Function &Fn, const DebugLoc &DLoc, const Twine &Msg)
Emit a warning when loop interleaving is specified but fails.
unsigned getLocCookie() const
static bool classof(const DiagnosticInfo *DI)
Common features for diagnostics dealing with optimization remarks.
static bool classof(const DiagnosticInfo *DI)
Module.h This file contains the declarations for the Module class.
std::function< void(const DiagnosticInfo &)> DiagnosticHandlerFunction
unsigned getLineNum() const
int getNextAvailablePluginDiagnosticKind()
Get the next available kind ID for a plugin diagnostic.
const Function & getFunction() const
DiagnosticInfoSampleProfile(const char *FileName, const Twine &Msg, DiagnosticSeverity Severity=DS_Error)
void print(DiagnosticPrinter &DP) const override
DiagnosticInfoSampleProfile(const Twine &Msg, DiagnosticSeverity Severity=DS_Error)
static bool classof(const DiagnosticInfo *DI)
static bool isEnabled(StringRef Feature)
isEnabled - Return true if enable flag; '+'.
const Twine & getMsgStr() const
const Twine & getMsg() const
void print(DiagnosticPrinter &DP) const override
const SMDiagnostic & getDiagnostic() const
struct LLVMOpaqueDiagnosticInfo * LLVMDiagnosticInfoRef
StringRef - Represent a constant reference to a string, i.e.
void print(DiagnosticPrinter &DP) const override
Diagnostic information for the sample profiler.
void print(DiagnosticPrinter &DP) const override
Print using the given DP a user-friendly message.
virtual bool isEnabled() const =0
Return true if this optimization remark is enabled by one of of the LLVM command line flags (-pass-re...
Instances of this class encapsulate one diagnostic report, allowing printing to a raw_ostream as a ca...