14#ifndef LLVM_CLANG_SEMA_SEMABASE_H
15#define LLVM_CLANG_SEMA_SEMABASE_H
23#include "llvm/ADT/DenseMap.h"
24#include "llvm/ADT/DenseMapInfo.h"
25#include "llvm/ADT/Hashing.h"
71 : DiagnosticBuilder(DB), SemaRef(SemaRef), DiagID(DiagID) {}
73 : DiagnosticBuilder(DB), SemaRef(SemaRef), DiagID(DiagID) {}
89 const DiagnosticBuilder &BaseDiag =
Diag;
98 typename = std::enable_if_t<!std::is_lvalue_reference<T>::value>>
100 const DiagnosticBuilder &BaseDiag = *
this;
101 BaseDiag << std::move(
V);
163 template <
typename T>
166 if (
Diag.ImmediateDiag)
168 else if (
Diag.PartialDiagId)
169 Diag.getDeviceDeferredDiags()[
Diag.Fn][*
Diag.PartialDiagId].second
177 template <
typename T,
178 typename = std::enable_if_t<!std::is_lvalue_reference<T>::value>>
181 *ImmediateDiag << std::move(
V);
182 else if (PartialDiagId)
183 getDeviceDeferredDiags()[Fn][*PartialDiagId].second << std::move(
V);
205 llvm::DenseMap<CanonicalDeclPtr<const FunctionDecl>,
206 std::vector<PartialDiagnosticAt>>;
217 std::optional<ImmediateDiagBuilder> ImmediateDiag;
218 std::optional<unsigned> PartialDiagId;
241template <>
struct DenseMapInfo<
clang::SemaBase::FunctionDeclAndLoc> {
244 DenseMapInfo<clang::CanonicalDeclPtr<const clang::FunctionDecl>>;
247 return hash_combine(FDBaseInfo::getHashValue(FDL.
FD),
253 return LHS.
FD == RHS.
FD && LHS.
Loc == RHS.
Loc;
Defines the Diagnostic-related interfaces.
Implements a partial diagnostic that can be emitted anwyhere in a DiagnosticBuilder stream.
Defines the clang::SourceLocation class and associated facilities.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
A wrapper class around a pointer that always points to its canonical declaration.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Concrete class used by the front-end to report problems and issues.
Annotates a diagnostic with some code that should be inserted, removed, or replaced to fix the proble...
Represents a function declaration or definition.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
A generic diagnostic builder for errors which may or may not be deferred.
SemaDiagnosticBuilder(const SemaDiagnosticBuilder &)=default
llvm::DenseMap< CanonicalDeclPtr< const FunctionDecl >, std::vector< PartialDiagnosticAt > > DeferredDiagnosticsType
@ K_Deferred
Create a deferred diagnostic, which is emitted only if the function it's attached to is codegen'ed.
@ K_ImmediateWithCallStack
Emit the diagnostic immediately, and, if it's a warning or error, also emit a call stack showing how ...
@ K_Nop
Emit no diagnostics.
@ K_Immediate
Emit the diagnostic immediately (i.e., behave like Sema::Diag()).
void AddFixItHint(const FixItHint &Hint) const
friend const SemaDiagnosticBuilder & operator<<(const SemaDiagnosticBuilder &Diag, const T &Value)
SemaDiagnosticBuilder(Kind K, SourceLocation Loc, unsigned DiagID, const FunctionDecl *Fn, Sema &S)
friend StmtResult StmtError(const SemaDiagnosticBuilder &)
const SemaDiagnosticBuilder & operator<<(T &&V) const
SemaDiagnosticBuilder & operator=(const SemaDiagnosticBuilder &)=delete
friend ExprResult ExprError(const SemaDiagnosticBuilder &)
SemaDiagnosticBuilder & operator=(SemaDiagnosticBuilder &&)=delete
SemaDiagnosticBuilder(SemaDiagnosticBuilder &&D)
PartialDiagnostic PDiag(unsigned DiagID=0)
Build a partial diagnostic.
ASTContext & getASTContext() const
const LangOptions & getLangOpts() const
DiagnosticsEngine & getDiagnostics() const
SemaDiagnosticBuilder DiagCompat(SourceLocation Loc, unsigned CompatDiagId)
Emit a compatibility diagnostic.
DeclContext * getCurContext() const
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID)
Emit a diagnostic.
Sema - This implements semantic analysis and AST building for C.
Encodes a location in the source.
unsigned getHashValue() const
Top level wrappers for InstallAPI frontend operations.
ActionResult< Decl * > DeclResult
ActionResult< ParsedType > TypeResult
ActionResult< CXXCtorInitializer * > MemInitResult
const FunctionProtoType * T
ActionResult< Expr * > ExprResult
ActionResult< Stmt * > StmtResult
Diagnostic wrappers for TextAPI types for error reporting.
A pair of a canonical FunctionDecl and a SourceLocation.
CanonicalDeclPtr< const FunctionDecl > FD
static unsigned getHashValue(const FunctionDeclAndLoc &FDL)
static bool isEqual(const FunctionDeclAndLoc &LHS, const FunctionDeclAndLoc &RHS)
clang::SemaBase::FunctionDeclAndLoc FunctionDeclAndLoc
DenseMapInfo< clang::CanonicalDeclPtr< const clang::FunctionDecl > > FDBaseInfo