24 "Should only be called during SYCL compilation");
38 return CAT->getSize() == 0;
46 "Should only be called during SYCL compilation");
49 bool NeedToEmitNotes =
true;
52 bool ErrorFound =
false;
59 if (NeedToEmitNotes) {
60 if (
auto *FD = dyn_cast<FieldDecl>(D))
62 diag::note_illegal_field_declared_here)
63 << FD->getType()->isPointerType() << FD->getType();
74 StackForRecursion.push_back(DeclToCheck);
78 History.push_back(
nullptr);
81 const ValueDecl *Next = StackForRecursion.pop_back_val();
83 assert(!History.empty());
90 if (!
Visited.insert(NextTy).second)
93 auto EmitHistory = [&]() {
95 for (uint64_t Index = 1; Index < History.size(); ++Index) {
97 diag::note_within_field_of_type)
98 << History[Index]->getType();
102 if (Check(NextTy, Next)) {
105 NeedToEmitNotes =
false;
116 if (Check(NextTy, Next)) {
119 NeedToEmitNotes =
false;
124 if (
auto *NextFD = dyn_cast<FieldDecl>(Next))
125 History.push_back(NextFD);
128 StackForRecursion.push_back(
nullptr);
129 llvm::copy(RecDecl->fields(), std::back_inserter(StackForRecursion));
131 }
while (!StackForRecursion.empty());
llvm::DenseSet< const void * > Visited
static bool isZeroSizedArray(Sema &SemaRef, QualType Ty)
const ConstantArrayType * getAsConstantArrayType(QualType T) const
Represents a function declaration or definition.
A (possibly-)qualified type.
A generic diagnostic builder for errors which may or may not be deferred.
@ K_Nop
Emit no diagnostics.
@ 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 ...
Sema - This implements semantic analysis and AST building for C.
ASTContext & getASTContext() const
const LangOptions & getLangOpts() const
DeclContext * getCurLexicalContext() const
void deepTypeCheckForSYCLDevice(SourceLocation UsedAt, llvm::DenseSet< QualType > Visited, ValueDecl *DeclToCheck)
FunctionEmissionStatus getEmissionStatus(const FunctionDecl *Decl, bool Final=false)
SemaDiagnosticBuilder SYCLDiagIfDeviceCode(SourceLocation Loc, unsigned DiagID)
Creates a SemaDiagnosticBuilder that emits the diagnostic if the current context is "used as device c...
Encodes a location in the source.
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 ...