29 "Should only be called during SYCL compilation");
31 SemaDiagnosticBuilder::Kind DiagKind = [
this, FD] {
33 return SemaDiagnosticBuilder::K_Nop;
35 return SemaDiagnosticBuilder::K_ImmediateWithCallStack;
36 return SemaDiagnosticBuilder::K_Deferred;
43 return CAT->isZeroSize();
51 "Should only be called during SYCL compilation");
54 bool NeedToEmitNotes =
true;
57 bool ErrorFound =
false;
64 if (NeedToEmitNotes) {
65 if (
auto *FD = dyn_cast<FieldDecl>(
D))
67 diag::note_illegal_field_declared_here)
68 << FD->getType()->isPointerType() << FD->getType();
79 StackForRecursion.push_back(DeclToCheck);
83 History.push_back(
nullptr);
86 const ValueDecl *Next = StackForRecursion.pop_back_val();
88 assert(!History.empty());
95 if (!
Visited.insert(NextTy).second)
98 auto EmitHistory = [&]() {
100 for (uint64_t Index = 1; Index < History.size(); ++Index) {
102 diag::note_within_field_of_type)
103 << History[Index]->getType();
107 if (Check(NextTy, Next)) {
110 NeedToEmitNotes =
false;
121 if (Check(NextTy, Next)) {
124 NeedToEmitNotes =
false;
129 if (
auto *NextFD = dyn_cast<FieldDecl>(Next))
130 History.push_back(NextFD);
133 StackForRecursion.push_back(
nullptr);
134 llvm::copy(RecDecl->fields(), std::back_inserter(StackForRecursion));
136 }
while (!StackForRecursion.empty());
164 const auto *FD = cast<FunctionDecl>(
D);
166 assert(FT &&
"Function template is expected");
170 if (TL->
size() < 2) {
171 Diag(FT->
getLocation(), diag::warn_sycl_kernel_num_of_template_params);
176 for (
unsigned I = 0; I < 2; ++I) {
178 if (isa<NonTypeTemplateParmDecl>(TParam)) {
180 diag::warn_sycl_kernel_invalid_template_param_type);
187 Diag(FT->
getLocation(), diag::warn_sycl_kernel_num_of_function_params);
198 handleSimpleAttribute<SYCLKernelAttr>(*
this,
D, AL);
llvm::DenseSet< const void * > Visited
static bool isZeroSizedArray(SemaSYCL &S, QualType Ty)
This file declares semantic analysis for SYCL constructs.
const ConstantArrayType * getAsConstantArrayType(QualType T) const
TypeSourceInfo * getTrivialTypeSourceInfo(QualType T, SourceLocation Loc=SourceLocation()) const
Allocate a TypeSourceInfo where all locations have been initialized to a given location,...
Decl - This represents one declaration (or definition), e.g.
SourceLocation getLocation() const
Represents a function declaration or definition.
Declaration of a template function.
This represents a decl that may have a name.
ParsedAttr - Represents a syntactic attribute.
A (possibly-)qualified type.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
static SYCLUniqueStableNameExpr * Create(const ASTContext &Ctx, SourceLocation OpLoc, SourceLocation LParen, SourceLocation RParen, TypeSourceInfo *TSI)
A generic diagnostic builder for errors which may or may not be deferred.
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID, bool DeferHint=false)
Emit a diagnostic.
ASTContext & getASTContext() const
const LangOptions & getLangOpts() const
SemaDiagnosticBuilder DiagIfDeviceCode(SourceLocation Loc, unsigned DiagID)
Creates a SemaDiagnosticBuilder that emits the diagnostic if the current context is "used as device c...
ExprResult BuildUniqueStableNameExpr(SourceLocation OpLoc, SourceLocation LParen, SourceLocation RParen, TypeSourceInfo *TSI)
void deepTypeCheckForDevice(SourceLocation UsedAt, llvm::DenseSet< QualType > Visited, ValueDecl *DeclToCheck)
void handleKernelAttr(Decl *D, const ParsedAttr &AL)
ExprResult ActOnUniqueStableNameExpr(SourceLocation OpLoc, SourceLocation LParen, SourceLocation RParen, ParsedType ParsedTy)
Sema - This implements semantic analysis and AST building for C.
ASTContext & getASTContext() const
DeclContext * getCurLexicalContext() const
FunctionEmissionStatus getEmissionStatus(const FunctionDecl *Decl, bool Final=false)
static QualType GetTypeFromParser(ParsedType Ty, TypeSourceInfo **TInfo=nullptr)
Encodes a location in the source.
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
Stores a list of template parameters for a TemplateDecl and its derived classes.
NamedDecl * getParam(unsigned Idx)
A container of type source information.
bool isReferenceType() const
const Type * getArrayElementTypeNoTypeQual() const
If this is an array type, return the element type of the array, potentially with type qualifiers miss...
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
bool isAnyPointerType() const
RecordDecl * getAsRecordDecl() const
Retrieves the RecordDecl this type refers to.
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
The JSON file list parser is used to communicate input to InstallAPI.
QualType getFunctionOrMethodResultType(const Decl *D)
unsigned getFunctionOrMethodNumParams(const Decl *D)
getFunctionOrMethodNumParams - Return number of function or method parameters.