clang 20.0.0git
Classes | Public Types | Public Member Functions | Public Attributes | List of all members
clang::SemaOpenACC Class Reference

#include "clang/Sema/SemaOpenACC.h"

Inheritance diagram for clang::SemaOpenACC:
Inheritance graph
[legend]

Classes

class  AssociatedStmtRAII
 Helper type for the registration/assignment of constructs that need to 'know' about their parent constructs and hold a reference to them, such as Loop needing its parent construct. More...
 
struct  LoopGangOnKernelTy
 If there is a current 'active' loop construct with a 'gang' clause on a 'kernel' construct, this will have the source location for it, and the 'kernel kind'. More...
 
class  LoopInConstructRAII
 Helper type to restore the state of various 'loop' constructs when we run into a loop (for, etc) inside the construct. More...
 
struct  LoopWithoutSeqCheckingInfo
 If there is a current 'active' loop construct that does NOT have a 'seq' clause on it, this has that source location and loop Directive 'kind'. More...
 
class  OpenACCParsedClause
 A type to represent all the data for an OpenACC Clause that has been parsed, but not yet created/semantically analyzed. More...
 

Public Types

using DeviceTypeArgument = std::pair< IdentifierInfo *, SourceLocation >
 

Public Member Functions

ComputeConstructInfo & getActiveComputeConstructInfo ()
 
 SemaOpenACC (Sema &S)
 
void ActOnWhileStmt (SourceLocation WhileLoc)
 
void ActOnDoStmt (SourceLocation DoLoc)
 
void ActOnRangeForStmtBegin (SourceLocation ForLoc, const Stmt *OldRangeFor, const Stmt *RangeFor)
 
void ActOnRangeForStmtBegin (SourceLocation ForLoc, const Stmt *RangeFor)
 
void ActOnForStmtBegin (SourceLocation ForLoc, const Stmt *First, const Stmt *Second, const Stmt *Third)
 
void ActOnForStmtBegin (SourceLocation ForLoc, const Stmt *OldFirst, const Stmt *First, const Stmt *OldSecond, const Stmt *Second, const Stmt *OldThird, const Stmt *Third)
 
void ActOnForStmtEnd (SourceLocation ForLoc, StmtResult Body)
 
OpenACCClauseActOnClause (ArrayRef< const OpenACCClause * > ExistingClauses, OpenACCParsedClause &Clause)
 Called after parsing an OpenACC Clause so that it can be checked.
 
void ActOnConstruct (OpenACCDirectiveKind K, SourceLocation DirLoc)
 Called after the construct has been parsed, but clauses haven't been parsed.
 
bool ActOnStartStmtDirective (OpenACCDirectiveKind K, SourceLocation StartLoc, ArrayRef< const OpenACCClause * > Clauses)
 Called after the directive, including its clauses, have been parsed and parsing has consumed the 'annot_pragma_openacc_end' token.
 
bool ActOnStartDeclDirective (OpenACCDirectiveKind K, SourceLocation StartLoc)
 Called after the directive, including its clauses, have been parsed and parsing has consumed the 'annot_pragma_openacc_end' token.
 
StmtResult ActOnAssociatedStmt (SourceLocation DirectiveLoc, OpenACCDirectiveKind K, ArrayRef< const OpenACCClause * > Clauses, StmtResult AssocStmt)
 Called when we encounter an associated statement for our construct, this should check legality of the statement as it appertains to this Construct.
 
StmtResult ActOnEndStmtDirective (OpenACCDirectiveKind K, SourceLocation StartLoc, SourceLocation DirLoc, SourceLocation LParenLoc, SourceLocation MiscLoc, ArrayRef< Expr * > Exprs, SourceLocation RParenLoc, SourceLocation EndLoc, ArrayRef< OpenACCClause * > Clauses, StmtResult AssocStmt)
 Called after the directive has been completely parsed, including the declaration group or associated statement.
 
DeclGroupRef ActOnEndDeclDirective ()
 Called after the directive has been completely parsed, including the declaration group or associated statement.
 
ExprResult ActOnIntExpr (OpenACCDirectiveKind DK, OpenACCClauseKind CK, SourceLocation Loc, Expr *IntExpr)
 Called when encountering an 'int-expr' for OpenACC, and manages conversions and diagnostics to 'int'.
 
ExprResult ActOnVar (OpenACCClauseKind CK, Expr *VarExpr)
 Called when encountering a 'var' for OpenACC, ensures it is actually a declaration reference to a variable of the correct type.
 
ExprResult CheckReductionVar (OpenACCDirectiveKind DirectiveKind, OpenACCReductionOperator ReductionOp, Expr *VarExpr)
 Called while semantically analyzing the reduction clause, ensuring the var is the correct kind of reference.
 
bool CheckVarIsPointerType (OpenACCClauseKind ClauseKind, Expr *VarExpr)
 Called to check the 'var' type is a variable of pointer type, necessary for 'deviceptr' and 'attach' clauses.
 
ExprResult ActOnArraySectionExpr (Expr *Base, SourceLocation LBLoc, Expr *LowerBound, SourceLocation ColonLocFirst, Expr *Length, SourceLocation RBLoc)
 Checks and creates an Array Section used in an OpenACC construct/clause.
 
ExprResult CheckCollapseLoopCount (Expr *LoopCount)
 Checks the loop depth value for a collapse clause.
 
ExprResult CheckTileSizeExpr (Expr *SizeExpr)
 Checks a single size expr for a tile clause.
 
ExprResult CheckGangExpr (ArrayRef< const OpenACCClause * > ExistingClauses, OpenACCDirectiveKind DK, OpenACCGangKind GK, Expr *E)
 
OpenACCClauseCheckGangClause (OpenACCDirectiveKind DirKind, ArrayRef< const OpenACCClause * > ExistingClauses, SourceLocation BeginLoc, SourceLocation LParenLoc, ArrayRef< OpenACCGangKind > GangKinds, ArrayRef< Expr * > IntExprs, SourceLocation EndLoc)
 
OpenACCClauseCheckReductionClause (ArrayRef< const OpenACCClause * > ExistingClauses, OpenACCDirectiveKind DirectiveKind, SourceLocation BeginLoc, SourceLocation LParenLoc, OpenACCReductionOperator ReductionOp, ArrayRef< Expr * > Vars, SourceLocation EndLoc)
 
ExprResult BuildOpenACCAsteriskSizeExpr (SourceLocation AsteriskLoc)
 
ExprResult ActOnOpenACCAsteriskSizeExpr (SourceLocation AsteriskLoc)
 
- Public Member Functions inherited from clang::SemaBase
 SemaBase (Sema &S)
 
ASTContextgetASTContext () const
 
DiagnosticsEnginegetDiagnostics () const
 
const LangOptionsgetLangOpts () const
 
SemaDiagnosticBuilder Diag (SourceLocation Loc, unsigned DiagID, bool DeferHint=false)
 Emit a diagnostic.
 
SemaDiagnosticBuilder Diag (SourceLocation Loc, const PartialDiagnostic &PD, bool DeferHint=false)
 Emit a partial diagnostic.
 
PartialDiagnostic PDiag (unsigned DiagID=0)
 Build a partial diagnostic.
 

Public Attributes

struct clang::SemaOpenACC::LoopGangOnKernelTy LoopGangClauseOnKernel
 
SourceLocation LoopWorkerClauseLoc
 If there is a current 'active' loop construct with a 'worker' clause on it (on any sort of construct), this has the source location for it.
 
SourceLocation LoopVectorClauseLoc
 If there is a current 'active' loop construct with a 'vector' clause on it (on any sort of construct), this has the source location for it.
 
struct clang::SemaOpenACC::LoopWithoutSeqCheckingInfo LoopWithoutSeqInfo
 
- Public Attributes inherited from clang::SemaBase
SemaSemaRef
 

Detailed Description

Definition at line 35 of file SemaOpenACC.h.

Member Typedef Documentation

◆ DeviceTypeArgument

Definition at line 196 of file SemaOpenACC.h.

Constructor & Destructor Documentation

◆ SemaOpenACC()

SemaOpenACC::SemaOpenACC ( Sema S)

Definition at line 1913 of file SemaOpenACC.cpp.

Member Function Documentation

◆ ActOnArraySectionExpr()

ExprResult SemaOpenACC::ActOnArraySectionExpr ( Expr Base,
SourceLocation  LBLoc,
Expr LowerBound,
SourceLocation  ColonLocFirst,
Expr Length,
SourceLocation  RBLoc 
)

Checks and creates an Array Section used in an OpenACC construct/clause.

Definition at line 2543 of file SemaOpenACC.cpp.

References ActOnIntExpr(), clang::ASTContext::ArraySectionTy, clang::Sema::CheckPlaceholderExpr(), clang::Sema::CreateRecoveryExpr(), clang::Sema::DefaultFunctionArrayLvalueConversion(), clang::Sema::DefaultLvalueConversion(), clang::ASTContext::DependentTy, clang::SemaBase::Diag(), E, clang::Expr::EvaluateAsInt(), clang::ExprError(), clang::ActionResult< PtrTy, Compress >::get(), clang::Type::getAsArrayTypeUnsafe(), clang::ASTContext::getAsConstantArrayType(), clang::SemaBase::getASTContext(), clang::ArraySectionExpr::getBaseOriginalType(), clang::Stmt::getBeginLoc(), clang::ArrayType::getElementType(), clang::Stmt::getEndLoc(), clang::Expr::getExprLoc(), clang::APValue::getInt(), clang::Type::getPointeeType(), clang::ConstantArrayType::getSize(), clang::Expr::getType(), clang::ASTContext::IntTy, clang::Invalid, clang::Type::isAnyPointerType(), clang::Type::isArrayType(), clang::Type::isConstantArrayType(), clang::Type::isDependentSizedArrayType(), clang::Type::isDependentType(), clang::Type::isFunctionType(), clang::Expr::isInstantiationDependent(), clang::Type::isNonOverloadPlaceholderType(), clang::QualType::isNull(), clang::Expr::isTypeDependent(), clang::ActionResult< PtrTy, Compress >::isUsable(), clang::OK_Ordinary, clang::Sema::RequireCompleteType(), clang::Result, clang::SemaBase::SemaRef, toString(), clang::Expr::EvalResult::Val, and clang::VK_LValue.

Referenced by clang::Sema::ActOnArraySubscriptExpr(), and clang::TreeTransform< Derived >::RebuildArraySectionExpr().

◆ ActOnAssociatedStmt()

StmtResult SemaOpenACC::ActOnAssociatedStmt ( SourceLocation  DirectiveLoc,
OpenACCDirectiveKind  K,
ArrayRef< const OpenACCClause * >  Clauses,
StmtResult  AssocStmt 
)

◆ ActOnClause()

OpenACCClause * SemaOpenACC::ActOnClause ( ArrayRef< const OpenACCClause * >  ExistingClauses,
OpenACCParsedClause Clause 
)

◆ ActOnConstruct()

void SemaOpenACC::ActOnConstruct ( OpenACCDirectiveKind  K,
SourceLocation  DirLoc 
)

Called after the construct has been parsed, but clauses haven't been parsed.

This allows us to diagnose not-implemented, as well as set up any state required for parsing the clauses.

Definition at line 2305 of file SemaOpenACC.cpp.

References clang::Data, clang::SemaBase::Diag(), clang::EnterData, clang::ExitData, clang::HostData, clang::Init, clang::Invalid, clang::Kernels, clang::KernelsLoop, clang::Loop, clang::Parallel, clang::ParallelLoop, clang::Sema::PotentiallyEvaluated, clang::Sema::PushExpressionEvaluationContext(), clang::SemaBase::SemaRef, clang::Serial, clang::SerialLoop, clang::Shutdown, and clang::Wait.

◆ ActOnDoStmt()

void SemaOpenACC::ActOnDoStmt ( SourceLocation  DoLoc)

◆ ActOnEndDeclDirective()

DeclGroupRef SemaOpenACC::ActOnEndDeclDirective ( )

Called after the directive has been completely parsed, including the declaration group or associated statement.

Definition at line 3809 of file SemaOpenACC.cpp.

◆ ActOnEndStmtDirective()

StmtResult SemaOpenACC::ActOnEndStmtDirective ( OpenACCDirectiveKind  K,
SourceLocation  StartLoc,
SourceLocation  DirLoc,
SourceLocation  LParenLoc,
SourceLocation  MiscLoc,
ArrayRef< Expr * >  Exprs,
SourceLocation  RParenLoc,
SourceLocation  EndLoc,
ArrayRef< OpenACCClause * >  Clauses,
StmtResult  AssocStmt 
)

Called after the directive has been completely parsed, including the declaration group or associated statement.

LParenLoc: Location of the left paren, if it exists (not on all constructs). MiscLoc: First misc location, if necessary (not all constructs). Exprs: List of expressions on the construct itself, if necessary (not all constructs). RParenLoc: Location of the right paren, if it exists (not on all constructs).

Definition at line 3667 of file SemaOpenACC.cpp.

References clang::OpenACCComputeConstruct::Create(), clang::OpenACCCombinedConstruct::Create(), clang::OpenACCLoopConstruct::Create(), clang::OpenACCEnterDataConstruct::Create(), clang::OpenACCExitDataConstruct::Create(), clang::OpenACCInitConstruct::Create(), clang::OpenACCShutdownConstruct::Create(), clang::OpenACCDataConstruct::Create(), clang::OpenACCHostDataConstruct::Create(), clang::OpenACCWaitConstruct::Create(), clang::Data, clang::EnterData, clang::ExitData, clang::ActionResult< PtrTy, Compress >::get(), clang::SemaBase::getASTContext(), clang::HostData, clang::Init, clang::Invalid, clang::ActionResult< PtrTy, Compress >::isUsable(), clang::Kernels, clang::KernelsLoop, clang::Loop, clang::Parallel, clang::ParallelLoop, clang::Serial, clang::SerialLoop, clang::Shutdown, clang::StmtEmpty(), clang::StmtError(), and clang::Wait.

Referenced by clang::Parser::ParseOpenACCDirectiveStmt(), clang::TreeTransform< Derived >::RebuildOpenACCCombinedConstruct(), clang::TreeTransform< Derived >::RebuildOpenACCComputeConstruct(), clang::TreeTransform< Derived >::RebuildOpenACCDataConstruct(), clang::TreeTransform< Derived >::RebuildOpenACCEnterDataConstruct(), clang::TreeTransform< Derived >::RebuildOpenACCExitDataConstruct(), clang::TreeTransform< Derived >::RebuildOpenACCHostDataConstruct(), clang::TreeTransform< Derived >::RebuildOpenACCInitConstruct(), clang::TreeTransform< Derived >::RebuildOpenACCLoopConstruct(), clang::TreeTransform< Derived >::RebuildOpenACCShutdownConstruct(), and clang::TreeTransform< Derived >::RebuildOpenACCWaitConstruct().

◆ ActOnForStmtBegin() [1/2]

void SemaOpenACC::ActOnForStmtBegin ( SourceLocation  ForLoc,
const Stmt First,
const Stmt Second,
const Stmt Third 
)

Definition at line 3444 of file SemaOpenACC.cpp.

References clang::First, and clang::SemaBase::getLangOpts().

◆ ActOnForStmtBegin() [2/2]

void SemaOpenACC::ActOnForStmtBegin ( SourceLocation  ForLoc,
const Stmt OldFirst,
const Stmt First,
const Stmt OldSecond,
const Stmt Second,
const Stmt OldThird,
const Stmt Third 
)

◆ ActOnForStmtEnd()

void SemaOpenACC::ActOnForStmtEnd ( SourceLocation  ForLoc,
StmtResult  Body 
)

◆ ActOnIntExpr()

ExprResult SemaOpenACC::ActOnIntExpr ( OpenACCDirectiveKind  DK,
OpenACCClauseKind  CK,
SourceLocation  Loc,
Expr IntExpr 
)

◆ ActOnOpenACCAsteriskSizeExpr()

ExprResult SemaOpenACC::ActOnOpenACCAsteriskSizeExpr ( SourceLocation  AsteriskLoc)

◆ ActOnRangeForStmtBegin() [1/2]

void SemaOpenACC::ActOnRangeForStmtBegin ( SourceLocation  ForLoc,
const Stmt OldRangeFor,
const Stmt RangeFor 
)

Definition at line 3458 of file SemaOpenACC.cpp.

References clang::SemaBase::getLangOpts().

◆ ActOnRangeForStmtBegin() [2/2]

void SemaOpenACC::ActOnRangeForStmtBegin ( SourceLocation  ForLoc,
const Stmt RangeFor 
)

Definition at line 3478 of file SemaOpenACC.cpp.

References clang::SemaBase::getLangOpts().

◆ ActOnStartDeclDirective()

bool SemaOpenACC::ActOnStartDeclDirective ( OpenACCDirectiveKind  K,
SourceLocation  StartLoc 
)

Called after the directive, including its clauses, have been parsed and parsing has consumed the 'annot_pragma_openacc_end' token.

This DOES happen before any associated declarations or statements have been parsed. This function is only called when we are parsing a 'Decl' context.

Definition at line 3799 of file SemaOpenACC.cpp.

References clang::Sema::DiscardCleanupsInEvaluationContext(), clang::Sema::PopExpressionEvaluationContext(), and clang::SemaBase::SemaRef.

◆ ActOnStartStmtDirective()

bool SemaOpenACC::ActOnStartStmtDirective ( OpenACCDirectiveKind  K,
SourceLocation  StartLoc,
ArrayRef< const OpenACCClause * >  Clauses 
)

Called after the directive, including its clauses, have been parsed and parsing has consumed the 'annot_pragma_openacc_end' token.

This DOES happen before any associated declarations or statements have been parsed. This function is only called when we are parsing a 'statement' context.

Definition at line 3582 of file SemaOpenACC.cpp.

References clang::Attach, clang::Collapse, clang::Copy, clang::CopyIn, clang::CopyOut, clang::Create, clang::Data, clang::Default, clang::Delete, clang::Detach, clang::DevicePtr, clang::SemaBase::Diag(), clang::Sema::DiscardCleanupsInEvaluationContext(), clang::EnterData, clang::ExitData, clang::HostData, clang::NoCreate, clang::Sema::PopExpressionEvaluationContext(), clang::Present, clang::SemaBase::SemaRef, clang::Tile, and clang::UseDevice.

◆ ActOnVar()

ExprResult SemaOpenACC::ActOnVar ( OpenACCClauseKind  CK,
Expr VarExpr 
)

Called when encountering a 'var' for OpenACC, ensures it is actually a declaration reference to a variable of the correct type.

Definition at line 2475 of file SemaOpenACC.cpp.

References clang::SemaBase::Diag(), clang::ExprError(), clang::Expr::getExprLoc(), clang::Expr::IgnoreParenImpCasts(), clang::Reduction, and clang::UseDevice.

◆ ActOnWhileStmt()

void SemaOpenACC::ActOnWhileStmt ( SourceLocation  WhileLoc)

◆ BuildOpenACCAsteriskSizeExpr()

ExprResult SemaOpenACC::BuildOpenACCAsteriskSizeExpr ( SourceLocation  AsteriskLoc)

◆ CheckCollapseLoopCount()

ExprResult SemaOpenACC::CheckCollapseLoopCount ( Expr LoopCount)

◆ CheckGangClause()

OpenACCClause * SemaOpenACC::CheckGangClause ( OpenACCDirectiveKind  DirKind,
ArrayRef< const OpenACCClause * >  ExistingClauses,
SourceLocation  BeginLoc,
SourceLocation  LParenLoc,
ArrayRef< OpenACCGangKind GangKinds,
ArrayRef< Expr * >  IntExprs,
SourceLocation  EndLoc 
)

◆ CheckGangExpr()

ExprResult SemaOpenACC::CheckGangExpr ( ArrayRef< const OpenACCClause * >  ExistingClauses,
OpenACCDirectiveKind  DK,
OpenACCGangKind  GK,
Expr E 
)

◆ CheckReductionClause()

OpenACCClause * SemaOpenACC::CheckReductionClause ( ArrayRef< const OpenACCClause * >  ExistingClauses,
OpenACCDirectiveKind  DirectiveKind,
SourceLocation  BeginLoc,
SourceLocation  LParenLoc,
OpenACCReductionOperator  ReductionOp,
ArrayRef< Expr * >  Vars,
SourceLocation  EndLoc 
)

◆ CheckReductionVar()

ExprResult SemaOpenACC::CheckReductionVar ( OpenACCDirectiveKind  DirectiveKind,
OpenACCReductionOperator  ReductionOp,
Expr VarExpr 
)

Called while semantically analyzing the reduction clause, ensuring the var is the correct kind of reference.

OpenACC 3.3 section 2.5.15: At a mininmum, the supported data types include ... the numerical data types in C, C++, and Fortran.

If the reduction var is a composite variable, each member of the composite variable must be a supported datatype for the reduction operation.

Definition at line 2228 of file SemaOpenACC.cpp.

References clang::SemaBase::Diag(), clang::ExprError(), clang::Type::getAsRecordDecl(), clang::SemaBase::getASTContext(), clang::ASTContext::getBaseElementType(), clang::ArraySectionExpr::getBaseOriginalType(), clang::Expr::getExprLoc(), clang::Expr::getType(), clang::Expr::IgnoreParenCasts(), and clang::Expr::isInstantiationDependent().

◆ CheckTileSizeExpr()

ExprResult SemaOpenACC::CheckTileSizeExpr ( Expr SizeExpr)

◆ CheckVarIsPointerType()

bool SemaOpenACC::CheckVarIsPointerType ( OpenACCClauseKind  ClauseKind,
Expr VarExpr 
)

◆ getActiveComputeConstructInfo()

ComputeConstructInfo & clang::SemaOpenACC::getActiveComputeConstructInfo ( )
inline

Member Data Documentation

◆ LoopGangClauseOnKernel

struct clang::SemaOpenACC::LoopGangOnKernelTy clang::SemaOpenACC::LoopGangClauseOnKernel

◆ LoopVectorClauseLoc

SourceLocation clang::SemaOpenACC::LoopVectorClauseLoc

If there is a current 'active' loop construct with a 'vector' clause on it (on any sort of construct), this has the source location for it.

This permits us to implement the restriction of no further 'gang', 'vector', or 'worker' clauses.

Definition at line 184 of file SemaOpenACC.h.

Referenced by clang::SemaOpenACC::AssociatedStmtRAII::AssociatedStmtRAII().

◆ LoopWithoutSeqInfo

struct clang::SemaOpenACC::LoopWithoutSeqCheckingInfo clang::SemaOpenACC::LoopWithoutSeqInfo

◆ LoopWorkerClauseLoc

SourceLocation clang::SemaOpenACC::LoopWorkerClauseLoc

If there is a current 'active' loop construct with a 'worker' clause on it (on any sort of construct), this has the source location for it.

This permits us to implement the restriction of no further 'gang' or 'worker' clauses.

Definition at line 179 of file SemaOpenACC.h.

Referenced by clang::SemaOpenACC::AssociatedStmtRAII::AssociatedStmtRAII().


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