LLVM 20.0.0git
Public Member Functions | List of all members
llvm::SMDiagnostic Class Reference

Instances of this class encapsulate one diagnostic report, allowing printing to a raw_ostream as a caret diagnostic. More...

#include "llvm/Support/SourceMgr.h"

Public Member Functions

 SMDiagnostic ()=default
 
 SMDiagnostic (StringRef filename, SourceMgr::DiagKind Knd, StringRef Msg)
 
 SMDiagnostic (const SourceMgr &sm, SMLoc L, StringRef FN, int Line, int Col, SourceMgr::DiagKind Kind, StringRef Msg, StringRef LineStr, ArrayRef< std::pair< unsigned, unsigned > > Ranges, ArrayRef< SMFixIt > FixIts={})
 
const SourceMgrgetSourceMgr () const
 
SMLoc getLoc () const
 
StringRef getFilename () const
 
int getLineNo () const
 
int getColumnNo () const
 
SourceMgr::DiagKind getKind () const
 
StringRef getMessage () const
 
StringRef getLineContents () const
 
ArrayRef< std::pair< unsigned, unsigned > > getRanges () const
 
void addFixIt (const SMFixIt &Hint)
 
ArrayRef< SMFixItgetFixIts () const
 
void print (const char *ProgName, raw_ostream &S, bool ShowColors=true, bool ShowKindLabel=true, bool ShowLocation=true) const
 

Detailed Description

Instances of this class encapsulate one diagnostic report, allowing printing to a raw_ostream as a caret diagnostic.

Definition at line 281 of file SourceMgr.h.

Constructor & Destructor Documentation

◆ SMDiagnostic() [1/3]

llvm::SMDiagnostic::SMDiagnostic ( )
default

◆ SMDiagnostic() [2/3]

llvm::SMDiagnostic::SMDiagnostic ( StringRef  filename,
SourceMgr::DiagKind  Knd,
StringRef  Msg 
)
inline

Definition at line 296 of file SourceMgr.h.

◆ SMDiagnostic() [3/3]

SMDiagnostic::SMDiagnostic ( const SourceMgr sm,
SMLoc  L,
StringRef  FN,
int  Line,
int  Col,
SourceMgr::DiagKind  Kind,
StringRef  Msg,
StringRef  LineStr,
ArrayRef< std::pair< unsigned, unsigned > >  Ranges,
ArrayRef< SMFixIt FixIts = {} 
)

Definition at line 378 of file SourceMgr.cpp.

References llvm::sort(), and string.

Member Function Documentation

◆ addFixIt()

void llvm::SMDiagnostic::addFixIt ( const SMFixIt Hint)
inline

◆ getColumnNo()

int llvm::SMDiagnostic::getColumnNo ( ) const
inline

Definition at line 309 of file SourceMgr.h.

Referenced by DiagHandler().

◆ getFilename()

StringRef llvm::SMDiagnostic::getFilename ( ) const
inline

Definition at line 307 of file SourceMgr.h.

◆ getFixIts()

ArrayRef< SMFixIt > llvm::SMDiagnostic::getFixIts ( ) const
inline

Definition at line 317 of file SourceMgr.h.

Referenced by DiagHandler().

◆ getKind()

SourceMgr::DiagKind llvm::SMDiagnostic::getKind ( ) const
inline

Definition at line 310 of file SourceMgr.h.

Referenced by DiagHandler(), and llvm::MIRParserImpl::reportDiagnostic().

◆ getLineContents()

StringRef llvm::SMDiagnostic::getLineContents ( ) const
inline

Definition at line 312 of file SourceMgr.h.

Referenced by DiagHandler().

◆ getLineNo()

int llvm::SMDiagnostic::getLineNo ( ) const
inline

Definition at line 308 of file SourceMgr.h.

Referenced by DiagHandler().

◆ getLoc()

SMLoc llvm::SMDiagnostic::getLoc ( ) const
inline

Definition at line 306 of file SourceMgr.h.

Referenced by DiagHandler(), and llvm::SourceMgr::PrintMessage().

◆ getMessage()

StringRef llvm::SMDiagnostic::getMessage ( ) const
inline

◆ getRanges()

ArrayRef< std::pair< unsigned, unsigned > > llvm::SMDiagnostic::getRanges ( ) const
inline

Definition at line 313 of file SourceMgr.h.

Referenced by DiagHandler().

◆ getSourceMgr()

const SourceMgr * llvm::SMDiagnostic::getSourceMgr ( ) const
inline

Definition at line 305 of file SourceMgr.h.

Referenced by DiagHandler().

◆ print()

void SMDiagnostic::print ( const char ProgName,
raw_ostream S,
bool  ShowColors = true,
bool  ShowKindLabel = true,
bool  ShowLocation = true 
) const

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