|
clang 24.0.0git
|
Owns the state needed to translate LLVM backend diagnostics into clang diagnostics, and implements the translation itself. More...
#include "clang/CodeGenUtils/BackendDiagnosticHandler.h"
Public Member Functions | |
| BackendDiagnosticConsumer (DiagnosticsEngine &Diags, const CodeGenOptions &CodeGenOpts) | |
| void | setSourceManager (SourceManager *SM) |
| The SourceManager used to translate backend-reported file:line:col locations back into clang SourceLocations. | |
| void | setCurLinkModule (llvm::Module *M) |
| Set the module currently being linked in, used to name DK_Linker diagnostics. | |
| void | addFunctionSourceLocation (StringRef MangledName, FullSourceLoc Loc) |
| Record the source location of the function with the given mangled name, used to approximate a location for backend diagnostics (e.g. | |
| std::optional< FullSourceLoc > | getFunctionSourceLocation (const llvm::Function &F) const |
| const FullSourceLoc | getBestLocationFromDebugLoc (const llvm::DiagnosticInfoWithLocationBase &D, bool &BadDebugInfo, StringRef &Filename, unsigned &Line, unsigned &Column) const |
| Get the best possible source location to represent a diagnostic that may have associated debug info. | |
| std::unique_ptr< llvm::DiagnosticHandler > | createDiagnosticHandler () |
| Create an llvm::DiagnosticHandler that forwards diagnostics to this consumer. | |
| void | handleDiagnostics (const llvm::DiagnosticInfo &DI) |
| This is invoked when the backend needs to report something to the user. | |
Owns the state needed to translate LLVM backend diagnostics into clang diagnostics, and implements the translation itself.
This is not itself an llvm::DiagnosticHandler so that it can be installed/updated independently of the llvm::LLVMContext's handler lifetime; use BackendDiagnosticConsumer::createDiagnosticHandler() to get an llvm::DiagnosticHandler that forwards into it.
Definition at line 60 of file BackendDiagnosticHandler.h.
|
inline |
Definition at line 62 of file BackendDiagnosticHandler.h.
| void BackendDiagnosticConsumer::addFunctionSourceLocation | ( | StringRef | MangledName, |
| FullSourceLoc | Loc ) |
Record the source location of the function with the given mangled name, used to approximate a location for backend diagnostics (e.g.
stack-size warnings) that don't carry debug-info locations of their own.
Definition at line 133 of file BackendDiagnosticHandler.cpp.
References llvm::hash_value().
| std::unique_ptr< llvm::DiagnosticHandler > BackendDiagnosticConsumer::createDiagnosticHandler | ( | ) |
Create an llvm::DiagnosticHandler that forwards diagnostics to this consumer.
The returned handler must not outlive this consumer.
Definition at line 129 of file BackendDiagnosticHandler.cpp.
| const FullSourceLoc BackendDiagnosticConsumer::getBestLocationFromDebugLoc | ( | const llvm::DiagnosticInfoWithLocationBase & | D, |
| bool & | BadDebugInfo, | ||
| StringRef & | Filename, | ||
| unsigned & | Line, | ||
| unsigned & | Column ) const |
Get the best possible source location to represent a diagnostic that may have associated debug info.
Definition at line 150 of file BackendDiagnosticHandler.cpp.
References clang::Column, getFunctionSourceLocation(), clang::SourceLocation::isInvalid(), and clang::Line.
| std::optional< FullSourceLoc > BackendDiagnosticConsumer::getFunctionSourceLocation | ( | const llvm::Function & | F | ) | const |
Definition at line 141 of file BackendDiagnosticHandler.cpp.
References clang::Function, and llvm::hash_value().
Referenced by getBestLocationFromDebugLoc().
| void BackendDiagnosticConsumer::handleDiagnostics | ( | const llvm::DiagnosticInfo & | DI | ) |
This is invoked when the backend needs to report something to the user.
Definition at line 552 of file BackendDiagnosticHandler.cpp.
References clang::cast(), ComputeDiagID, and ComputeDiagRemarkID.
|
inline |
Set the module currently being linked in, used to name DK_Linker diagnostics.
Definition at line 75 of file BackendDiagnosticHandler.h.
|
inline |
The SourceManager used to translate backend-reported file:line:col locations back into clang SourceLocations.
May be null (e.g. when compiling a raw LLVM IR input file with no clang AST), in which case diagnostics are still reported, just without clang-level source locations.
Definition at line 71 of file BackendDiagnosticHandler.h.