clang 23.0.0git
clang::SemaSYCL Class Reference

#include "clang/Sema/SemaSYCL.h"

Inheritance diagram for clang::SemaSYCL:
[legend]

Public Member Functions

 SemaSYCL (Sema &S)
SemaDiagnosticBuilder DiagIfDeviceCode (SourceLocation Loc, unsigned DiagID)
 Creates a SemaDiagnosticBuilder that emits the diagnostic if the current context is "used as device code".
void deepTypeCheckForDevice (SourceLocation UsedAt, llvm::DenseSet< QualType > Visited, ValueDecl *DeclToCheck)
ExprResult BuildUniqueStableNameExpr (SourceLocation OpLoc, SourceLocation LParen, SourceLocation RParen, TypeSourceInfo *TSI)
ExprResult ActOnUniqueStableNameExpr (SourceLocation OpLoc, SourceLocation LParen, SourceLocation RParen, ParsedType ParsedTy)
void handleKernelAttr (Decl *D, const ParsedAttr &AL)
void handleKernelEntryPointAttr (Decl *D, const ParsedAttr &AL)
void CheckDeviceUseOfDecl (NamedDecl *ND, SourceLocation Loc)
 Issues a deferred diagnostic if use of the declaration designated by 'ND' is invalid in a device context.
void CheckSYCLExternalFunctionDecl (FunctionDecl *FD)
void CheckSYCLEntryPointFunctionDecl (FunctionDecl *FD)
ExprResult BuildSYCLKernelLaunchIdExpr (FunctionDecl *FD, QualType KernelName)
 Builds an expression for the lookup of a 'sycl_kernel_launch' template with 'KernelName' as an explicit template argument.
StmtResult BuildSYCLKernelCallStmt (FunctionDecl *FD, CompoundStmt *Body, Expr *LaunchIdExpr)
 Builds a SYCLKernelCallStmt to wrap 'Body' and to be used as the body of 'FD'.
StmtResult BuildUnresolvedSYCLKernelCallStmt (CompoundStmt *Body, Expr *LaunchIdExpr)
 Builds an UnresolvedSYCLKernelCallStmt to wrap 'Body'.
Public Member Functions inherited from clang::SemaBase
 SemaBase (Sema &S)
ASTContextgetASTContext () const
DiagnosticsEnginegetDiagnostics () const
const LangOptionsgetLangOpts () const
DeclContextgetCurContext () const
SemaDiagnosticBuilder Diag (SourceLocation Loc, unsigned DiagID)
 Emit a diagnostic.
SemaDiagnosticBuilder Diag (SourceLocation Loc, const PartialDiagnostic &PD)
 Emit a partial diagnostic.
SemaDiagnosticBuilder DiagCompat (SourceLocation Loc, unsigned CompatDiagId)
 Emit a compatibility diagnostic.
PartialDiagnostic PDiag (unsigned DiagID=0)
 Build a partial diagnostic.

Additional Inherited Members

Public Attributes inherited from clang::SemaBase
SemaSemaRef

Detailed Description

Definition at line 27 of file SemaSYCL.h.

Constructor & Destructor Documentation

◆ SemaSYCL()

SemaSYCL::SemaSYCL ( Sema & S)

Definition at line 28 of file SemaSYCL.cpp.

References clang::SemaBase::SemaBase().

Member Function Documentation

◆ ActOnUniqueStableNameExpr()

◆ BuildSYCLKernelCallStmt()

◆ BuildSYCLKernelLaunchIdExpr()

ExprResult SemaSYCL::BuildSYCLKernelLaunchIdExpr ( FunctionDecl * FD,
QualType KernelName )

Builds an expression for the lookup of a 'sycl_kernel_launch' template with 'KernelName' as an explicit template argument.

Lookup is performed as if from the first statement of the body of 'FD' and thus requires searching the scopes that exist at parse time. This function therefore requires the current semantic context to be the definition of 'FD'. In a dependent context, the returned expression will be an UnresolvedLookupExpr or an UnresolvedMemberExpr. In a non-dependent context, the returned expression will be a DeclRefExpr or MemberExpr. If lookup fails, a null error result is returned. The resulting expression is intended to be passed as the 'LaunchIdExpr' argument in a call to either BuildSYCLKernelCallStmt() or BuildUnresolvedSYCLKernelCallStmt() after the function body has been parsed.

Definition at line 427 of file SemaSYCL.cpp.

References clang::TemplateArgumentListInfo::addArgument(), clang::Sema::CodeSynthesisContext::Entity, clang::ExprError(), clang::IdentifierTable::get(), clang::Decl::getLocation(), clang::ASTContext::Idents, clang::ActionResult< PtrTy, Compress >::isInvalid(), clang::Sema::CodeSynthesisContext::Kind, clang::Sema::LookupOrdinaryName, clang::Result, clang::SemaBase::SemaRef, clang::Sema::CodeSynthesisContext::SYCLKernelLaunchLookup, and clang::Sema::TemplateNameIsRequired.

Referenced by clang::Sema::ActOnStartOfFunctionDef().

◆ BuildUniqueStableNameExpr()

◆ BuildUnresolvedSYCLKernelCallStmt()

StmtResult SemaSYCL::BuildUnresolvedSYCLKernelCallStmt ( CompoundStmt * Body,
Expr * LaunchIdExpr )

Builds an UnresolvedSYCLKernelCallStmt to wrap 'Body'.

'LaunchIdExpr' specifies the lookup result returned by a previous call to BuildSYCLKernelLaunchIdExpr().

Definition at line 713 of file SemaSYCL.cpp.

References clang::UnresolvedSYCLKernelCallStmt::Create(), and clang::SemaBase::SemaRef.

Referenced by clang::Sema::ActOnFinishFunctionBody().

◆ CheckDeviceUseOfDecl()

void SemaSYCL::CheckDeviceUseOfDecl ( NamedDecl * ND,
SourceLocation Loc )

Issues a deferred diagnostic if use of the declaration designated by 'ND' is invalid in a device context.

Definition at line 224 of file SemaSYCL.cpp.

References DiagIfDeviceCode(), clang::SemaBase::getLangOpts(), and clang::SemaBase::SemaRef.

Referenced by clang::Sema::DiagnoseUseOfDecl().

◆ CheckSYCLEntryPointFunctionDecl()

◆ CheckSYCLExternalFunctionDecl()

◆ deepTypeCheckForDevice()

◆ DiagIfDeviceCode()

Sema::SemaDiagnosticBuilder SemaSYCL::DiagIfDeviceCode ( SourceLocation Loc,
unsigned DiagID )

Creates a SemaDiagnosticBuilder that emits the diagnostic if the current context is "used as device code".

  • If CurLexicalContext is a kernel function or it is known that the function will be emitted for the device, emits the diagnostics immediately.
  • If CurLexicalContext is a function and we are compiling for the device, but we don't know yet that this function will be codegen'ed for the devive, creates a diagnostic which is emitted if and when we realize that the function will be codegen'ed.

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 30 of file SemaSYCL.cpp.

References clang::Sema::CUDADiscarded, clang::Sema::Emitted, clang::SemaBase::getLangOpts(), clang::Sema::OMPDiscarded, clang::SemaBase::SemaRef, clang::Sema::TemplateDiscarded, and clang::Sema::Unknown.

Referenced by CheckDeviceUseOfDecl(), and deepTypeCheckForDevice().

◆ handleKernelAttr()

◆ handleKernelEntryPointAttr()

void SemaSYCL::handleKernelEntryPointAttr ( Decl * D,
const ParsedAttr & AL )

The documentation for this class was generated from the following files: