19#ifndef LLVM_CLANG_CODEGENUTILS_BACKENDDIAGNOSTICHANDLER_H
20#define LLVM_CLANG_CODEGENUTILS_BACKENDDIAGNOSTICHANDLER_H
23#include "llvm/ADT/Hashing.h"
24#include "llvm/ADT/StringRef.h"
25#include "llvm/IR/DiagnosticHandler.h"
32class DiagnosticInfoDontCall;
33class DiagnosticInfoInlineAsm;
34class DiagnosticInfoMisExpect;
35class DiagnosticInfoOptimizationBase;
36class DiagnosticInfoOptimizationFailure;
37class DiagnosticInfoResourceLimit;
38class DiagnosticInfoSrcMgr;
39class DiagnosticInfoStackSize;
40class DiagnosticInfoUnsupported;
41class DiagnosticInfoUnsupportedTargetIntrinsic;
42class DiagnosticInfoWithLocationBase;
45class OptimizationRemarkAnalysisAliasing;
46class OptimizationRemarkAnalysisFPCommute;
64 : Diags(Diags), CodeGenOpts(CodeGenOpts) {}
83 std::optional<FullSourceLoc>
90 bool &BadDebugInfo, StringRef &Filename,
105 bool InlineAsmDiagHandler(
const llvm::DiagnosticInfoInlineAsm &D);
107 void SrcMgrDiagHandler(
const llvm::DiagnosticInfoSrcMgr &D);
111 bool StackSizeDiagHandler(
const llvm::DiagnosticInfoStackSize &D);
115 bool ResourceLimitDiagHandler(
const llvm::DiagnosticInfoResourceLimit &D);
117 void UnsupportedDiagHandler(
const llvm::DiagnosticInfoUnsupported &D);
119 void UnsupportedTargetIntrinsicDiagHandler(
120 const llvm::DiagnosticInfoUnsupportedTargetIntrinsic &D);
124 void EmitOptimizationMessage(
const llvm::DiagnosticInfoOptimizationBase &D,
126 void OptimizationRemarkHandler(
const llvm::DiagnosticInfoOptimizationBase &D);
128 OptimizationRemarkHandler(
const llvm::OptimizationRemarkAnalysisFPCommute &D);
130 OptimizationRemarkHandler(
const llvm::OptimizationRemarkAnalysisAliasing &D);
132 OptimizationFailureHandler(
const llvm::DiagnosticInfoOptimizationFailure &D);
133 void DontCallDiagHandler(
const llvm::DiagnosticInfoDontCall &D);
136 void MisExpectDiagHandler(
const llvm::DiagnosticInfoMisExpect &D);
141 llvm::Module *CurLinkModule =
nullptr;
151 std::vector<std::pair<llvm::hash_code, FullSourceLoc>> ManglingFullSourceLocs;
Defines the clang::SourceLocation class and associated facilities.
BackendDiagnosticConsumer(DiagnosticsEngine &Diags, const CodeGenOptions &CodeGenOpts)
void addFunctionSourceLocation(StringRef MangledName, FullSourceLoc Loc)
Record the source location of the function with the given mangled name, used to approximate a locatio...
void setCurLinkModule(llvm::Module *M)
Set the module currently being linked in, used to name DK_Linker diagnostics.
std::unique_ptr< llvm::DiagnosticHandler > createDiagnosticHandler()
Create an llvm::DiagnosticHandler that forwards diagnostics to this consumer.
void setSourceManager(SourceManager *SM)
The SourceManager used to translate backend-reported file:line:col locations back into clang SourceLo...
std::optional< FullSourceLoc > getFunctionSourceLocation(const llvm::Function &F) const
void handleDiagnostics(const llvm::DiagnosticInfo &DI)
This is invoked when the backend needs to report something to the user.
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.
CodeGenOptions - Track various options which control how the code is optimized and passed to the back...
Concrete class used by the front-end to report problems and issues.
A SourceLocation and its associated SourceManager.
This class handles loading and caching of source files into memory.
Top level wrappers for InstallAPI frontend operations.
@ Module
Module linkage, which indicates that the entity can be referred to from other translation units withi...
Diagnostic wrappers for TextAPI types for error reporting.