14 #ifndef LLVM_CLANG_SEMA_SEMABASE_H
15 #define LLVM_CLANG_SEMA_SEMABASE_H
23 #include "llvm/ADT/DenseMap.h"
25 #include <type_traits>
32 class DiagnosticsEngine;
88 typename = std::enable_if_t<!std::is_lvalue_reference<T>::value>>
91 BaseDiag << std::move(
V);
121 LLVM_MARK_AS_BITMASK_ENUM(
All)
127 typedef std::pair<const FunctionDecl *, const FunctionDecl *> CallPair;
135 UndefinedReachableFromSyclDevice.push_back(std::make_pair(Callee, Caller));
141 return llvm::any_of(UndefinedReachableFromSyclDevice,
142 [Callee, Caller](
const CallPair &
P) {
143 return P.first == Callee &&
P.second == Caller;
218 template <
typename T>
221 if (
Diag.ImmediateDiag)
223 else if (
Diag.PartialDiagId)
224 Diag.getDeviceDeferredDiags()[
Diag.Fn][*
Diag.PartialDiagId]
234 template <
typename T,
235 typename = std::enable_if_t<!std::is_lvalue_reference<T>::value>>
238 *ImmediateDiag << std::move(
V);
239 else if (PartialDiagId)
240 getDeviceDeferredDiags()[Fn][*PartialDiagId].getDiag().second
263 llvm::DenseMap<CanonicalDeclPtr<const FunctionDecl>,
264 std::vector<DeviceDeferredDiagnostic>>;
275 std::optional<ImmediateDiagBuilder> ImmediateDiag;
276 std::optional<unsigned> PartialDiagId;
283 bool DeferHint =
false);
287 bool DeferHint =
false);
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 little helper class used to produce diagnostics.
A little helper class (which is basically a smart pointer that forwards info from DiagnosticsEngine) ...
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...
DeviceDiagnosticReason getReason() const
DeviceDeferredDiagnostic(SourceLocation SL, const PartialDiagnostic &PD, DeviceDiagnosticReason R)
PartialDiagnosticAt & getDiag()
A generic diagnostic builder for errors which may or may not be deferred.
SemaDiagnosticBuilder(const SemaDiagnosticBuilder &)=default
@ 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
const SemaDiagnosticBuilder & operator<<(T &&V) const
SemaDiagnosticBuilder & operator=(const SemaDiagnosticBuilder &)=delete
SemaDiagnosticBuilder & operator=(SemaDiagnosticBuilder &&)=delete
SemaDiagnosticBuilder(Kind K, SourceLocation Loc, unsigned DiagID, const FunctionDecl *Fn, Sema &S, DeviceDiagnosticReason R)
friend StmtResult StmtError(const SemaDiagnosticBuilder &)
llvm::DenseMap< CanonicalDeclPtr< const FunctionDecl >, std::vector< DeviceDeferredDiagnostic > > DeferredDiagnosticsType
friend const SemaDiagnosticBuilder & operator<<(const SemaDiagnosticBuilder &Diag, const T &Value)
friend ExprResult ExprError(const SemaDiagnosticBuilder &)
SemaDiagnosticBuilder(SemaDiagnosticBuilder &&D)
bool isFDReachableFromSyclDevice(const FunctionDecl *Callee, const FunctionDecl *Caller)
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID, bool DeferHint=false)
Emit a diagnostic.
DeviceDiagnosticReason
Bitmask to contain the list of reasons a single diagnostic should be emitted, based on its language.
@ Sycl
SYCL specific diagnostic.
@ CudaDevice
CUDA specific diagnostics.
@ Esimd
ESIMD specific diagnostic.
@ None
Diagnostic doesn't apply to anything.
@ All
A flag representing 'all'.
@ OmpDevice
OpenMP specific diagnostic.
void addFDToReachableFromSyclDevice(const FunctionDecl *Callee, const FunctionDecl *Caller)
ASTContext & getASTContext() const
const LangOptions & getLangOpts() const
DiagnosticsEngine & getDiagnostics() const
Sema - This implements semantic analysis and AST building for C.
Encodes a location in the source.
The JSON file list parser is used to communicate input to InstallAPI.
ActionResult< CXXCtorInitializer * > MemInitResult
ActionResult< Expr * > ExprResult
ActionResult< Stmt * > StmtResult
ActionResult< ParsedType > TypeResult
const FunctionProtoType * T
std::pair< SourceLocation, PartialDiagnostic > PartialDiagnosticAt
A partial diagnostic along with the source location where this diagnostic occurs.
ActionResult< Decl * > DeclResult