24 "Should only be called during SYCL compilation");
38 "Should only be called during SYCL compilation");
39 assert(Callee &&
"Callee may not be null.");
54 return CAT->getSize() == 0;
62 "Should only be called during SYCL compilation");
65 bool NeedToEmitNotes =
true;
68 bool ErrorFound =
false;
75 if (NeedToEmitNotes) {
76 if (
auto *FD = dyn_cast<FieldDecl>(D))
78 diag::note_illegal_field_declared_here)
79 << FD->getType()->isPointerType() << FD->getType();
90 StackForRecursion.push_back(DeclToCheck);
94 History.push_back(
nullptr);
97 const ValueDecl *Next = StackForRecursion.pop_back_val();
99 assert(!History.empty());
106 if (!Visited.insert(NextTy).second)
109 auto EmitHistory = [&]() {
111 for (uint64_t Index = 1; Index < History.size(); ++Index) {
113 diag::note_within_field_of_type)
114 << History[Index]->getType();
118 if (Check(NextTy, Next)) {
121 NeedToEmitNotes =
false;
132 if (Check(NextTy, Next)) {
135 NeedToEmitNotes =
false;
140 if (
auto *NextFD = dyn_cast<FieldDecl>(Next))
141 History.push_back(NextFD);
144 StackForRecursion.push_back(
nullptr);
145 llvm::copy(RecDecl->fields(), std::back_inserter(StackForRecursion));
147 }
while (!StackForRecursion.empty());
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 ...
@ K_Immediate
Emit the diagnostic immediately (i.e., behave like Sema::Diag()).
Sema - This implements semantic analysis and AST building for C.
ASTContext & getASTContext() const
bool checkSYCLDeviceFunction(SourceLocation Loc, FunctionDecl *Callee)
Check whether we're allowed to call Callee from the current context.
const LangOptions & getLangOpts() const
DeclContext * getCurLexicalContext() const
void deepTypeCheckForSYCLDevice(SourceLocation UsedAt, llvm::DenseSet< QualType > Visited, ValueDecl *DeclToCheck)
bool isConstantEvaluated() const
bool isUnevaluatedContext() const
Determines whether we are currently in a context that is not evaluated as per C++ [expr] p5.
FunctionEmissionStatus getEmissionStatus(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 ...