LLVM 22.0.0git
llvm::DiagnosticInfoWithLocationBase Class Reference

Common features for diagnostics with an associated location. More...

#include "llvm/IR/DiagnosticInfo.h"

Inheritance diagram for llvm::DiagnosticInfoWithLocationBase:
[legend]

Public Member Functions

 DiagnosticInfoWithLocationBase (enum DiagnosticKind Kind, enum DiagnosticSeverity Severity, const Function &Fn, const DiagnosticLocation &Loc)
 Fn is the function where the diagnostic is being emitted.
bool isLocationAvailable () const
 Return true if location information is available for this diagnostic.
std::string getLocationStr () const
 Return a string with the location information for this diagnostic in the format "file:line:col".
void getLocation (StringRef &RelativePath, unsigned &Line, unsigned &Column) const
 Return location information for this diagnostic in three parts: the relative source file path, line number and column.
std::string getAbsolutePath () const
 Return the absolute path tot the file.
const FunctiongetFunction () const
DiagnosticLocation getLocation () const
Public Member Functions inherited from llvm::DiagnosticInfo
 DiagnosticInfo (int Kind, DiagnosticSeverity Severity)
virtual ~DiagnosticInfo ()=default
int getKind () const
DiagnosticSeverity getSeverity () const
virtual void print (DiagnosticPrinter &DP) const =0
 Print using the given DP a user-friendly message.

Detailed Description

Common features for diagnostics with an associated location.

Definition at line 349 of file DiagnosticInfo.h.

Constructor & Destructor Documentation

◆ DiagnosticInfoWithLocationBase()

Member Function Documentation

◆ getAbsolutePath()

std::string DiagnosticInfoWithLocationBase::getAbsolutePath ( ) const

Return the absolute path tot the file.

Definition at line 181 of file DiagnosticInfo.cpp.

◆ getFunction()

◆ getLocation() [1/2]

DiagnosticLocation llvm::DiagnosticInfoWithLocationBase::getLocation ( ) const
inline

Definition at line 377 of file DiagnosticInfo.h.

Referenced by getLocationStr().

◆ getLocation() [2/2]

void DiagnosticInfoWithLocationBase::getLocation ( StringRef & RelativePath,
unsigned & Line,
unsigned & Column ) const

Return location information for this diagnostic in three parts: the relative source file path, line number and column.

Definition at line 185 of file DiagnosticInfo.cpp.

Referenced by llvm::DiagnosticInfoIROptimization::DiagnosticInfoIROptimization().

◆ getLocationStr()

std::string DiagnosticInfoWithLocationBase::getLocationStr ( ) const

Return a string with the location information for this diagnostic in the format "file:line:col".

If location information is not available, it returns "<unknown>:0:0".

Definition at line 193 of file DiagnosticInfo.cpp.

References getLocation(), and isLocationAvailable().

Referenced by llvm::DiagnosticInfoGenericWithLoc::print(), llvm::DiagnosticInfoLegalizationFailure::print(), llvm::DiagnosticInfoMisExpect::print(), llvm::DiagnosticInfoOptimizationBase::print(), llvm::DiagnosticInfoRegAllocFailure::print(), llvm::DiagnosticInfoResourceLimit::print(), and llvm::DiagnosticInfoUnsupported::print().

◆ isLocationAvailable()

bool llvm::DiagnosticInfoWithLocationBase::isLocationAvailable ( ) const
inline

Return true if location information is available for this diagnostic.

Definition at line 361 of file DiagnosticInfo.h.

Referenced by getLocationStr().


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