27 "Should only be called during SYCL compilation");
29 SemaDiagnosticBuilder::Kind DiagKind = [
this, FD] {
31 return SemaDiagnosticBuilder::K_Nop;
33 return SemaDiagnosticBuilder::K_ImmediateWithCallStack;
34 return SemaDiagnosticBuilder::K_Deferred;
41 return CAT->isZeroSize();
49 "Should only be called during SYCL compilation");
52 bool NeedToEmitNotes =
true;
55 bool ErrorFound =
false;
62 if (NeedToEmitNotes) {
63 if (
auto *FD = dyn_cast<FieldDecl>(D))
65 diag::note_illegal_field_declared_here)
66 << FD->getType()->isPointerType() << FD->getType();
77 StackForRecursion.push_back(DeclToCheck);
81 History.push_back(
nullptr);
84 const ValueDecl *Next = StackForRecursion.pop_back_val();
86 assert(!History.empty());
93 if (!
Visited.insert(NextTy).second)
96 auto EmitHistory = [&]() {
98 for (uint64_t Index = 1; Index < History.size(); ++Index) {
100 diag::note_within_field_of_type)
101 << History[Index]->getType();
105 if (Check(NextTy, Next)) {
108 NeedToEmitNotes =
false;
119 if (Check(NextTy, Next)) {
122 NeedToEmitNotes =
false;
127 if (
auto *NextFD = dyn_cast<FieldDecl>(Next))
128 History.push_back(NextFD);
131 StackForRecursion.push_back(
nullptr);
132 llvm::copy(RecDecl->fields(), std::back_inserter(StackForRecursion));
134 }
while (!StackForRecursion.empty());
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,...
Represents a function declaration or definition.
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.
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)
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.
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.