clang
19.0.0git
|
#include "clang/Sema/SemaSYCL.h"
Public Types | |
enum | SYCLRestrictKind { KernelGlobalVariable , KernelRTTI , KernelNonConstStaticDataVariable , KernelCallVirtualFunction , KernelUseExceptions , KernelCallRecursiveFunction , KernelCallFunctionPointer , KernelAllocateStorage , KernelUseAssembly , KernelCallDllimportFunction , KernelCallVariadicFunction , KernelCallUndefinedFunction , KernelConstStaticVariable } |
![]() | |
enum class | DeviceDiagnosticReason { None = 0 , OmpDevice = 1 << 0 , OmpHost = 1 << 1 , OmpAll = OmpDevice | OmpHost , CudaDevice = 1 << 2 , CudaHost = 1 << 3 , CudaAll = CudaDevice | CudaHost , Sycl = 1 << 4 , Esimd = 1 << 5 , All = OmpAll | CudaAll | Sycl | Esimd } |
Bitmask to contain the list of reasons a single diagnostic should be emitted, based on its language. More... | |
Static Public Member Functions | |
template<typename AttrTy > | |
static bool | isTypeDecoratedWithDeclAttribute (QualType Ty) |
static bool | isSyclType (QualType Ty, SYCLTypeAttr::SYCLType TypeName) |
Check whether Ty corresponds to a SYCL type of name TypeName . More... | |
Additional Inherited Members | |
![]() | |
Sema & | SemaRef |
Definition at line 216 of file SemaSYCL.h.
Definition at line 299 of file SemaSYCL.h.
SemaSYCL::SemaSYCL | ( | Sema & | S | ) |
Definition at line 396 of file SemaSYCL.cpp.
ExprResult SemaSYCL::ActOnSYCLBuiltinBaseTypeExpr | ( | ParsedType | PT, |
Expr * | Idx | ||
) |
Get a value based on the type of the given base number so that callers can wrap it in a decltype() to get the actual type of the base class.
Definition at line 246 of file SemaSYCL.cpp.
References clang::TypeLoc::getBeginLoc(), and clang::TypeSourceInfo::getTypeLoc().
ExprResult SemaSYCL::ActOnSYCLBuiltinFieldTypeExpr | ( | ParsedType | PT, |
Expr * | Idx | ||
) |
Get a value based on the type of the given field number so that callers can wrap it in a decltype() to get the actual type of the field.
Definition at line 140 of file SemaSYCL.cpp.
References clang::TypeLoc::getBeginLoc(), clang::Sema::GetTypeFromParser(), and clang::TypeSourceInfo::getTypeLoc().
ExprResult SemaSYCL::ActOnSYCLBuiltinNumBasesExpr | ( | ParsedType | PT | ) |
Get the number of base classes within the parsed type.
Definition at line 219 of file SemaSYCL.cpp.
References clang::TypeLoc::getBeginLoc(), clang::Sema::GetTypeFromParser(), and clang::TypeSourceInfo::getTypeLoc().
ExprResult SemaSYCL::ActOnSYCLBuiltinNumFieldsExpr | ( | ParsedType | PT | ) |
Get the number of fields or captures within the parsed type.
Definition at line 113 of file SemaSYCL.cpp.
References clang::TypeLoc::getBeginLoc(), clang::Sema::GetTypeFromParser(), and clang::TypeSourceInfo::getTypeLoc().
ExprResult SemaSYCL::ActOnUniqueStableIdExpr | ( | SourceLocation | OpLoc, |
SourceLocation | LParen, | ||
SourceLocation | RParen, | ||
Expr * | E | ||
) |
Definition at line 6587 of file SemaSYCL.cpp.
References BuildUniqueStableIdExpr().
ExprResult SemaSYCL::ActOnUniqueStableNameExpr | ( | SourceLocation | OpLoc, |
SourceLocation | LParen, | ||
SourceLocation | RParen, | ||
ParsedType | ParsedTy | ||
) |
Definition at line 6601 of file SemaSYCL.cpp.
References BuildUniqueStableNameExpr(), clang::ExprError(), clang::SemaBase::getASTContext(), clang::ASTContext::getTrivialTypeSourceInfo(), clang::Sema::GetTypeFromParser(), clang::QualType::isNull(), and clang::SemaBase::SemaRef.
|
inline |
Definition at line 275 of file SemaSYCL.h.
|
inline |
Definition at line 270 of file SemaSYCL.h.
|
inline |
Definition at line 291 of file SemaSYCL.h.
References clang::SYCLIntegrationFooter::addVarDecl(), clang::SemaBase::getLangOpts(), and getSyclIntegrationFooter().
Referenced by clang::Sema::BuildVarTemplateInstantiation().
ExprResult SemaSYCL::BuildSYCLBuiltinBaseTypeExpr | ( | SourceLocation | Loc, |
QualType | SourceTy, | ||
Expr * | Idx | ||
) |
Definition at line 255 of file SemaSYCL.cpp.
References Diag(), clang::ExprError(), clang::Type::getAsCXXRecordDecl(), clang::Expr::getIntegerConstantExpr(), clang::Type::isDependentType(), clang::Type::isRecordType(), clang::Expr::isValueDependent(), and Loc.
ExprResult SemaSYCL::BuildSYCLBuiltinFieldTypeExpr | ( | SourceLocation | Loc, |
QualType | SourceTy, | ||
Expr * | Idx | ||
) |
Definition at line 149 of file SemaSYCL.cpp.
References Diag(), clang::ExprError(), clang::Type::getAsRecordDecl(), clang::Expr::getIntegerConstantExpr(), clang::Type::isDependentType(), clang::Type::isRecordType(), clang::Expr::isValueDependent(), Loc, and clang::VK_PRValue.
ExprResult SemaSYCL::BuildSYCLBuiltinNumBasesExpr | ( | SourceLocation | Loc, |
QualType | SourceTy | ||
) |
Definition at line 228 of file SemaSYCL.cpp.
References Diag(), clang::ExprError(), clang::Type::isDependentType(), clang::Type::isRecordType(), and Loc.
ExprResult SemaSYCL::BuildSYCLBuiltinNumFieldsExpr | ( | SourceLocation | Loc, |
QualType | SourceTy | ||
) |
Definition at line 122 of file SemaSYCL.cpp.
References Diag(), clang::ExprError(), clang::Type::isDependentType(), clang::Type::isRecordType(), and Loc.
ExprResult SemaSYCL::BuildUniqueStableIdExpr | ( | SourceLocation | OpLoc, |
SourceLocation | LParen, | ||
SourceLocation | RParen, | ||
Expr * | E | ||
) |
Definition at line 6555 of file SemaSYCL.cpp.
References clang::SYCLUniqueStableIdExpr::Create(), clang::SemaBase::Diag(), clang::ExprError(), clang::SemaBase::getASTContext(), clang::Expr::getExprLoc(), clang::Expr::IgnoreUnlessSpelledInSource(), and clang::Expr::isInstantiationDependent().
Referenced by ActOnUniqueStableIdExpr().
ExprResult SemaSYCL::BuildUniqueStableNameExpr | ( | SourceLocation | OpLoc, |
SourceLocation | LParen, | ||
SourceLocation | RParen, | ||
TypeSourceInfo * | TSI | ||
) |
Definition at line 6593 of file SemaSYCL.cpp.
References clang::SYCLUniqueStableNameExpr::Create(), and clang::SemaBase::getASTContext().
Referenced by ActOnUniqueStableNameExpr().
Definition at line 5510 of file SemaSYCL.cpp.
References clang::SemaBase::getASTContext(), clang::VarDecl::getInit(), clang::SemaBase::getLangOpts(), clang::VarDecl::hasGlobalStorage(), clang::VarDecl::hasInit(), clang::VarDecl::isConstexpr(), and clang::Decl::isInvalidDecl().
void SemaSYCL::checkSYCLDeviceVarDecl | ( | VarDecl * | Var | ) |
Definition at line 473 of file SemaSYCL.cpp.
References checkSYCLType(), clang::SemaBase::getLangOpts(), clang::Decl::getLocation(), clang::ValueDecl::getType(), Loc, and Visited.
void SemaSYCL::CheckSYCLKernelCall | ( | FunctionDecl * | CallerFunc, |
ArrayRef< const Expr * > | Args | ||
) |
Definition at line 4779 of file SemaSYCL.cpp.
References calculateKernelNameType(), clang::CXXRecordDecl::captures(), clang::SemaBase::Diag(), clang::Type::getAsCXXRecordDecl(), clang::SemaBase::getASTContext(), clang::QualType::getCanonicalType(), clang::Decl::getLocation(), clang::FunctionDecl::getParamDecl(), GetSYCLKernelObjectType(), clang::ValueDecl::getType(), clang::CXXRecordDecl::hasDefinition(), clang::Decl::isInvalidDecl(), clang::CXXRecordDecl::isLambda(), clang::Type::isReferenceType(), SYCLKernelNameTypeVisitor::isValid(), clang::Sema::LangOpts, clang::SemaBase::SemaRef, clang::Decl::setInvalidDecl(), clang::LangOptionsBase::SYCL_2017, clang::LangOptionsBase::SYCL_2020, and SYCLKernelNameTypeVisitor::Visit().
void SemaSYCL::ConstructOpenCLKernel | ( | FunctionDecl * | KernelCallerFunc, |
MangleContext & | MC | ||
) |
Definition at line 4949 of file SemaSYCL.cpp.
References calculateKernelNameType(), constructKernelName(), copySYCLKernelAttrs(), clang::Type::getAsCXXRecordDecl(), clang::SemaBase::getASTContext(), clang::CXXRecordDecl::getLambdaCallOperator(), clang::SemaBase::getLangOpts(), clang::Decl::getLocation(), getSyclIntegrationFooter(), getSyclIntegrationHeader(), getSyclKernelHandlerArg(), GetSYCLKernelObjectType(), clang::ValueDecl::getType(), clang::FunctionDecl::isInlined(), clang::Decl::isInvalidDecl(), and clang::CXXRecordDecl::isLambda().
void SemaSYCL::copySYCLKernelAttrs | ( | CXXMethodDecl * | CallOperator | ) |
Definition at line 4848 of file SemaSYCL.cpp.
References clang::Decl::addAttr(), clang::CallGraph::addToCallGraph(), collectSYCLAttributes(), clang::CallGraph::getNode(), isSYCLKernelBodyFunction(), and Visited.
Referenced by ConstructOpenCLKernel().
void SemaSYCL::deepTypeCheckForDevice | ( | SourceLocation | UsedAt, |
llvm::DenseSet< QualType > | Visited, | ||
ValueDecl * | DeclToCheck | ||
) |
Definition at line 5385 of file SemaSYCL.cpp.
References DiagIfDeviceCode(), clang::SemaBase::getLangOpts(), clang::Decl::getLocation(), clang::ValueDecl::getType(), clang::Type::isPointerType(), and isZeroSizedArray().
Sema::SemaDiagnosticBuilder SemaSYCL::DiagIfDeviceCode | ( | SourceLocation | Loc, |
unsigned | DiagID, | ||
DeviceDiagnosticReason | Reason = DeviceDiagnosticReason::Sycl | DeviceDiagnosticReason::Esimd |
||
) |
Creates a SemaDiagnosticBuilder that emits the diagnostic if the current context is "used as device code".
Example usage:
Diagnose __float128 type usage only from SYCL device code if the current target doesn't support it if (!S.Context.getTargetInfo().hasFloat128Type() && S.getLangOpts().SYCLIsDevice) DiagIfDeviceCode(Loc, diag::err_type_unsupported) << "__float128";
Definition at line 5361 of file SemaSYCL.cpp.
References clang::Sema::Emitted, clang::Sema::getCurLexicalContext(), clang::Sema::getEmissionReason(), clang::Sema::getEmissionStatus(), clang::SemaBase::getLangOpts(), clang::SemaBase::SemaDiagnosticBuilder::K_Deferred, clang::SemaBase::SemaDiagnosticBuilder::K_ImmediateWithCallStack, clang::SemaBase::SemaDiagnosticBuilder::K_Nop, Loc, clang::SemaBase::None, and clang::SemaBase::SemaRef.
Referenced by deepTypeCheckForDevice().
void SemaSYCL::finalizeSYCLDelayedAnalysis | ( | const FunctionDecl * | Caller, |
const FunctionDecl * | Callee, | ||
SourceLocation | Loc, | ||
DeviceDiagnosticReason | Reason | ||
) |
Finishes analysis of the deferred functions calls that may be not properly declared for device compilation.
Definition at line 5477 of file SemaSYCL.cpp.
References clang::CUDA, clang::SemaBase::Diag(), clang::SemaBase::getLangOpts(), clang::Decl::getLocation(), clang::Sema::getSourceManager(), clang::SemaBase::isFDReachableFromSyclDevice(), isSYCLUndefinedAllowed(), KernelCallUndefinedFunction, Loc, clang::SemaBase::None, clang::SemaBase::SemaRef, and clang::SemaBase::Sycl.
|
inline |
Definition at line 285 of file SemaSYCL.h.
Referenced by clang::Sema::ActOnEndOfTranslationUnitFragment(), addSyclVarDecl(), ConstructFreeFunctionKernel(), and ConstructOpenCLKernel().
|
inline |
Lazily creates and returns SYCL integration header instance.
Definition at line 279 of file SemaSYCL.h.
Referenced by clang::Sema::ActOnEndOfTranslationUnitFragment(), ConstructFreeFunctionKernel(), ConstructOpenCLKernel(), and SetSYCLKernelNames().
|
inline |
Definition at line 297 of file SemaSYCL.h.
|
inline |
Definition at line 296 of file SemaSYCL.h.
Definition at line 375 of file SemaSYCL.cpp.
References clang::CXXLanguageLinkage, clang::DeclContext::getEnclosingNamespaceContext(), clang::IdentifierInfo::isStr(), and clang::DeclContext::isTranslationUnit().
Tells whether given variable is a SYCL explicit SIMD extension's "private global" variable - global variable in the private address space.
Definition at line 356 of file SemaSYCL.h.
References clang::QualType::getAddressSpace(), clang::SemaBase::getLangOpts(), clang::ValueDecl::getType(), clang::Decl::hasAttr(), clang::VarDecl::hasGlobalStorage(), and clang::sycl_private.
Check whether Ty
corresponds to a SYCL type of name TypeName
.
Definition at line 73 of file SemaSYCL.cpp.
References clang::Type::getAsCXXRecordDecl(), clang::Decl::getAttr(), clang::TemplateDecl::getTemplatedDecl(), and clang::TypeName.
Referenced by clang::SYCLIntegrationFooter::addVarDecl(), getAccessTarget(), getSyclKernelHandlerArg(), isSyclAccessorType(), isSYCLPrivateMemoryVar(), and MarkWIScopeFnVisitor::VisitCXXMemberCallExpr().
|
inlinestatic |
Definition at line 363 of file SemaSYCL.h.
References clang::Type::getAsCXXRecordDecl(), clang::ClassTemplateDecl::getTemplatedDecl(), and clang::Decl::hasAttr().
void SemaSYCL::MarkDevices | ( | ) |
Definition at line 5311 of file SemaSYCL.cpp.
References CheckSYCL2020Attributes(), clang::Sema::CheckSYCLAddIRAttributesFunctionAttrConflicts(), PropagateAndDiagnoseDeviceAttr(), clang::SemaBase::SemaRef, syclDeviceDecls(), and clang::T.
Referenced by clang::Sema::ActOnEndOfTranslationUnitFragment().
void SemaSYCL::ProcessFreeFunction | ( | FunctionDecl * | FD | ) |
Definition at line 5334 of file SemaSYCL.cpp.
References ConstructFreeFunctionKernel(), and isFreeFunction().
void SemaSYCL::SetSYCLKernelNames | ( | ) |
Definition at line 4896 of file SemaSYCL.cpp.
References constructFreeFunctionKernelName(), constructKernelName(), clang::SemaBase::getASTContext(), getSyclIntegrationHeader(), isFreeFunction(), and clang::SYCLIntegrationHeader::updateKernelNames().
Referenced by clang::Sema::ActOnEndOfTranslationUnitFragment().
|
inline |
Definition at line 276 of file SemaSYCL.h.
Referenced by MarkDevices().