clang 20.0.0git
|
#include "clang/Sema/SemaOpenACC.h"
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... | |
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 | |
SemaOpenACC (Sema &S) | |
OpenACCClause * | ActOnClause (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) |
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, 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 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 (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. | |
Public Member Functions inherited from clang::SemaBase | |
SemaBase (Sema &S) | |
ASTContext & | getASTContext () const |
DiagnosticsEngine & | getDiagnostics () const |
const LangOptions & | getLangOpts () 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. | |
Additional Inherited Members | |
Public Attributes inherited from clang::SemaBase | |
Sema & | SemaRef |
Definition at line 34 of file SemaOpenACC.h.
using clang::SemaOpenACC::DeviceTypeArgument = std::pair<IdentifierInfo *, SourceLocation> |
Definition at line 46 of file SemaOpenACC.h.
SemaOpenACC::SemaOpenACC | ( | Sema & | S | ) |
Definition at line 1042 of file SemaOpenACC.cpp.
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 1413 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().
StmtResult SemaOpenACC::ActOnAssociatedStmt | ( | SourceLocation | DirectiveLoc, |
OpenACCDirectiveKind | K, | ||
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.
Definition at line 1671 of file SemaOpenACC.cpp.
References clang::SemaBase::Diag(), clang::ActionResult< PtrTy, Compress >::get(), clang::Stmt::getBeginLoc(), clang::ActionResult< PtrTy, Compress >::isUsable(), clang::Kernels, clang::Loop, clang::Parallel, clang::Serial, and clang::StmtError().
Referenced by clang::Parser::ParseOpenACCDirectiveStmt().
OpenACCClause * SemaOpenACC::ActOnClause | ( | ArrayRef< const OpenACCClause * > | ExistingClauses, |
OpenACCParsedClause & | Clause | ||
) |
Called after parsing an OpenACC Clause so that it can be checked.
Definition at line 1069 of file SemaOpenACC.cpp.
References clang::C, clang::SemaBase::Diag(), clang::SemaOpenACC::OpenACCParsedClause::getBeginLoc(), clang::SemaOpenACC::OpenACCParsedClause::getClauseKind(), clang::SemaOpenACC::OpenACCParsedClause::getDirectiveKind(), clang::Invalid, and clang::Result.
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 1211 of file SemaOpenACC.cpp.
References clang::SemaBase::Diag(), clang::Invalid, clang::Kernels, clang::Loop, clang::Parallel, and clang::Serial.
DeclGroupRef SemaOpenACC::ActOnEndDeclDirective | ( | ) |
Called after the directive has been completely parsed, including the declaration group or associated statement.
Definition at line 1710 of file SemaOpenACC.cpp.
StmtResult SemaOpenACC::ActOnEndStmtDirective | ( | OpenACCDirectiveKind | K, |
SourceLocation | StartLoc, | ||
SourceLocation | DirLoc, | ||
SourceLocation | EndLoc, | ||
ArrayRef< OpenACCClause * > | Clauses, | ||
StmtResult | AssocStmt | ||
) |
Called after the directive has been completely parsed, including the declaration group or associated statement.
Definition at line 1632 of file SemaOpenACC.cpp.
References clang::OpenACCComputeConstruct::Create(), clang::OpenACCLoopConstruct::Create(), clang::ActionResult< PtrTy, Compress >::get(), clang::SemaBase::getASTContext(), clang::Invalid, clang::ActionResult< PtrTy, Compress >::isUsable(), clang::Kernels, clang::Loop, clang::Parallel, clang::Serial, clang::StmtEmpty(), and clang::StmtError().
Referenced by clang::Parser::ParseOpenACCDirectiveStmt(), clang::TreeTransform< Derived >::RebuildOpenACCComputeConstruct(), and clang::TreeTransform< Derived >::RebuildOpenACCLoopConstruct().
ExprResult SemaOpenACC::ActOnIntExpr | ( | OpenACCDirectiveKind | DK, |
OpenACCClauseKind | CK, | ||
SourceLocation | Loc, | ||
Expr * | IntExpr | ||
) |
Called when encountering an 'int-expr' for OpenACC, and manages conversions and diagnostics to 'int'.
Definition at line 1233 of file SemaOpenACC.cpp.
References clang::SemaBase::Diag(), clang::ExprError(), clang::ActionResult< PtrTy, Compress >::get(), clang::Decl::getLocation(), clang::Stmt::getSourceRange(), clang::Expr::getType(), clang::Invalid, clang::Type::isEnumeralType(), clang::Type::isIntegerType(), clang::ActionResult< PtrTy, Compress >::isInvalid(), clang::Expr::isTypeDependent(), Loc, clang::ast_matchers::match(), clang::Sema::PerformContextualImplicitConversion(), clang::SemaBase::SemaRef, and clang::T.
Referenced by ActOnArraySectionExpr().
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 1705 of file SemaOpenACC.cpp.
bool SemaOpenACC::ActOnStartStmtDirective | ( | 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 'statement' context.
Definition at line 1627 of file SemaOpenACC.cpp.
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 1361 of file SemaOpenACC.cpp.
References clang::SemaBase::Diag(), clang::ExprError(), clang::Expr::getExprLoc(), clang::Expr::IgnoreParenImpCasts(), and clang::Reduction.
ExprResult SemaOpenACC::CheckReductionVar | ( | 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 1158 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(), and clang::Expr::IgnoreParenCasts().
bool SemaOpenACC::CheckVarIsPointerType | ( | OpenACCClauseKind | ClauseKind, |
Expr * | VarExpr | ||
) |
Called to check the 'var' type is a variable of pointer type, necessary for 'deviceptr' and 'attach' clauses.
Returns true on success.
Definition at line 1331 of file SemaOpenACC.cpp.
References clang::Expr::containsErrors(), clang::SemaBase::Diag(), clang::Expr::getExprLoc(), clang::QualType::getNonReferenceType(), clang::Expr::getType(), clang::QualType::getUnqualifiedType(), clang::Expr::hasPlaceholderType(), clang::Expr::IgnoreParenImpCasts(), clang::Type::isDependentType(), and clang::Type::isPointerType().