clang 24.0.0git
SemaOpenMP.cpp File Reference

This file implements semantic analysis for OpenMP directives and clauses. More...

#include "clang/Sema/SemaOpenMP.h"
#include "clang/AST/ASTConsumer.h"
#include "TreeTransform.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/ASTMutationListener.h"
#include "clang/AST/Attr.h"
#include "clang/AST/CXXInheritance.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/DeclOpenMP.h"
#include "clang/AST/DynamicRecursiveASTVisitor.h"
#include "clang/AST/OpenMPClause.h"
#include "clang/AST/RecursiveASTVisitor.h"
#include "clang/AST/Stmt.h"
#include "clang/AST/StmtCXX.h"
#include "clang/AST/StmtOpenMP.h"
#include "clang/AST/StmtVisitor.h"
#include "clang/Basic/DiagnosticSema.h"
#include "clang/Basic/OpenMPKinds.h"
#include "clang/Basic/PartialDiagnostic.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/Sema/EnterExpressionEvaluationContext.h"
#include "clang/Sema/Initialization.h"
#include "clang/Sema/Lookup.h"
#include "clang/Sema/ParsedAttr.h"
#include "clang/Sema/Scope.h"
#include "clang/Sema/ScopeInfo.h"
#include "clang/Sema/Sema.h"
#include "llvm/ADT/IndexedMap.h"
#include "llvm/ADT/PointerEmbeddedInt.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/Sequence.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Frontend/OpenMP/OMPAssume.h"
#include "llvm/Frontend/OpenMP/OMPConstants.h"
#include "llvm/Frontend/OpenMP/OMPVersion.h"
#include "llvm/IR/Assumptions.h"
#include <limits>
#include <optional>
#include "clang/AST/StmtNodes.inc"

Go to the source code of this file.

Classes

struct  Kind2Unsigned
class  ForVarDeclFinder
 Look for variables declared in the body parts of a for-loop nest. More...
class  NestedLoopCounterVisitor
 Counts the total number of OpenMP canonical nested loops, including the outermost loop (the original loop). More...
class  GlobalDeclRefChecker
 This class visits every VarDecl that the initializer references and adds OMPDeclareTargetDeclAttr to each of them. More...

Macros

#define DSAStack   static_cast<DSAStackTy *>(VarDataSharingAttributesStack)
#define STMT(CLASS, PARENT)
#define ABSTRACT_STMT(CLASS)
#define COMMON_OMP_LOOP_TRANSFORMATION(CLASS, PARENT)
#define OMPCANONICALLOOPNESTTRANSFORMATIONDIRECTIVE(CLASS, PARENT)
#define OMPCANONICALLOOPSEQUENCETRANSFORMATIONDIRECTIVE(CLASS, PARENT)

Enumerations

enum class  OMPAdjustArgsVal { Known , Dependent , Invalid }

Functions

static const Expr * checkMapClauseExpressionBase (Sema &SemaRef, Expr *E, OMPClauseMappableExprCommon::MappableExprComponentList &CurComponents, OpenMPClauseKind CKind, OpenMPDirectiveKind DKind, bool NoDiagnose)
 Return the expression of the base of the mappable expression or null if it cannot be determined and do all the necessary checks to see if the expression is valid as a standalone mappable expression.
static std::string getOpenMPClauseNameForDiag (OpenMPClauseKind C)
static const Expr * getExprAsWritten (const Expr *E)
static Expr * getExprAsWritten (Expr *E)
static const ValueDecl * getCanonicalDecl (const ValueDecl *D)
static ValueDecl * getCanonicalDecl (ValueDecl *D)
static VarDecl * buildVarDecl (Sema &SemaRef, SourceLocation Loc, QualType Type, StringRef Name, const AttrVec *Attrs=nullptr, DeclRefExpr *OrigRef=nullptr)
 Build a variable declaration for OpenMP loop iteration variable.
static DeclRefExpr * buildDeclRefExpr (Sema &S, VarDecl *D, QualType Ty, SourceLocation Loc, bool RefersToCapture=false)
static bool isConstNotMutableType (Sema &SemaRef, QualType Type, bool AcceptIfMutable=true, bool *IsClassType=nullptr)
static bool rejectConstNotMutableType (Sema &SemaRef, const ValueDecl *D, QualType Type, OpenMPClauseKind CKind, SourceLocation ELoc, bool AcceptIfMutable=true, bool ListItemNotVar=false)
static bool isOpenMPDeviceDelayedContext (Sema &S)
static OpenMPDefaultmapClauseKind getVariableCategoryFromDecl (const LangOptions &LO, const ValueDecl *VD)
static OMPCapturedExprDecl * buildCaptureDecl (Sema &S, IdentifierInfo *Id, Expr *CaptureExpr, bool WithInit, DeclContext *CurContext, bool AsExpression)
static std::pair< ValueDecl *, bool > getPrivateItem (Sema &S, Expr *&RefExpr, SourceLocation &ELoc, SourceRange &ERange, bool AllowArraySection=false, bool AllowAssumedSizeArray=false, StringRef DiagType="")
static void checkReductionClauses (Sema &S, DSAStackTy *Stack, ArrayRef< OMPClause * > Clauses)
 Check consistency of the reduction clauses.
static void checkAllocateClauses (Sema &S, DSAStackTy *Stack, ArrayRef< OMPClause * > Clauses)
static DeclRefExpr * buildCapture (Sema &S, ValueDecl *D, Expr *CaptureExpr, bool WithInit)
static void reportOriginalDsa (Sema &SemaRef, const DSAStackTy *Stack, const ValueDecl *D, const DSAStackTy::DSAVarData &DVar, bool IsLoopIterVar=false)
static bool FinishOpenMPLinearClause (OMPLinearClause &Clause, DeclRefExpr *IV, Expr *NumIterations, Sema &SemaRef, Scope *S, DSAStackTy *Stack)
static bool finishLinearClauses (Sema &SemaRef, ArrayRef< OMPClause * > Clauses, OMPLoopBasedDirective::HelperExprs &B, DSAStackTy *Stack)
static OMPAllocateDeclAttr::AllocatorTypeTy getAllocatorKind (Sema &S, DSAStackTy *Stack, Expr *Allocator)
static bool checkPreviousOMPAllocateAttribute (Sema &S, DSAStackTy *Stack, Expr *RefExpr, VarDecl *VD, OMPAllocateDeclAttr::AllocatorTypeTy AllocatorKind, Expr *Allocator)
static void applyOMPAllocateAttribute (Sema &S, VarDecl *VD, OMPAllocateDeclAttr::AllocatorTypeTy AllocatorKind, Expr *Allocator, Expr *Alignment, SourceRange SR)
static bool checkDecompositionCaptureConflict (Sema &SemaRef, OpenMPDirectiveKind DKind, llvm::SmallDenseMap< const DecompositionDecl *, std::pair< bool, SourceLocation >, 4 > &SeenDecompositions, const ValueDecl *D, SourceLocation ELoc, OpenMPClauseKind ClauseKind)
 Check if bindings from the same structured binding have conflicting capture kinds (by-ref vs by-copy).
static bool checkClausesForDecompositionConflicts (Sema &SemaRef, OpenMPDirectiveKind DKind, ArrayRef< OMPClause * > Clauses, Stmt *Body=nullptr)
 Helper to check all clauses in a directive for structured binding capture conflicts.
static bool checkOriginalVarMappedButOnlyBindingsUsed (Sema &SemaRef, ArrayRef< OMPClause * > Clauses, Stmt *Body)
 Check if original variable is explicitly mapped but only bindings are used.
static OpenMPMapClauseKind getMapClauseKindFromModifier (OpenMPDefaultmapClauseModifier M, bool IsAggregateOrDeclareTarget, bool HasConstQualifier)
static bool hasNoMutableFields (const CXXRecordDecl *RD)
static bool hasConstQualifiedMappingType (QualType T)
static void handleDeclareVariantConstructTrait (DSAStackTy *Stack, OpenMPDirectiveKind DKind, bool ScopeEntry)
static SmallVector< SemaOpenMP::CapturedParamNameType > getParallelRegionParams (Sema &SemaRef, bool LoopBoundSharing)
static SmallVector< SemaOpenMP::CapturedParamNameType > getTeamsRegionParams (Sema &SemaRef)
static SmallVector< SemaOpenMP::CapturedParamNameType > getTaskRegionParams (Sema &SemaRef)
static SmallVector< SemaOpenMP::CapturedParamNameType > getTargetRegionParams (Sema &SemaRef)
static SmallVector< SemaOpenMP::CapturedParamNameType > getUnknownRegionParams (Sema &SemaRef)
static SmallVector< SemaOpenMP::CapturedParamNameType > getTaskloopRegionParams (Sema &SemaRef)
static void processCapturedRegions (Sema &SemaRef, OpenMPDirectiveKind DKind, Scope *CurScope, SourceLocation Loc)
static ExprResult buildCapture (Sema &S, Expr *CaptureExpr, DeclRefExpr *&Ref, StringRef Name)
static bool checkOrderedOrderSpecified (Sema &S, const ArrayRef< OMPClause * > Clauses)
static bool checkCancelRegion (Sema &SemaRef, OpenMPDirectiveKind CurrentRegion, OpenMPDirectiveKind CancelRegion, SourceLocation StartLoc)
static bool checkNestingOfRegions (Sema &SemaRef, const DSAStackTy *Stack, OpenMPDirectiveKind CurrentRegion, const DeclarationNameInfo &CurrentName, OpenMPDirectiveKind CancelRegion, OpenMPBindClauseKind BindKind, SourceLocation StartLoc)
static bool checkIfClauses (Sema &S, OpenMPDirectiveKind Kind, ArrayRef< OMPClause * > Clauses, ArrayRef< OpenMPDirectiveKind > AllowedNameModifiers)
static QualType getIntTypeForBitwidthOrBitInt (ASTContext &C, unsigned Bits, bool Signed)
 Like ASTContext::getIntTypeForBitwidth, but falls back to a _BitInt type when no standard integer type has the requested width.
static VarDecl * precomputeExpr (Sema &Actions, SmallVectorImpl< Stmt * > &BodyStmts, Expr *E, StringRef Name)
static CapturedStmt * buildDistanceFunc (Sema &Actions, QualType LogicalTy, BinaryOperator::Opcode Rel, Expr *StartExpr, Expr *StopExpr, Expr *StepExpr)
 Create a closure that computes the number of iterations of a loop.
static CapturedStmt * buildLoopVarFunc (Sema &Actions, QualType LoopVarTy, QualType LogicalTy, DeclRefExpr *StartExpr, Expr *Step, bool Deref)
 Create a closure that computes the loop variable from the logical iteration number.
static ExprResult buildUserDefinedMapperRef (Sema &SemaRef, Scope *S, CXXScopeSpec &MapperIdScopeSpec, const DeclarationNameInfo &MapperId, QualType Type, Expr *UnresolvedMapper, SourceLocation ItemLoc)
static void processImplicitMapsWithDefaultMappers (Sema &S, DSAStackTy *Stack, SmallVectorImpl< OMPClause * > &Clauses)
 Perform DFS through the structure/class data members trying to find member(s) with user-defined 'default' mapper and generate implicit map clauses for such members with the found 'default' mapper.
static bool teamsLoopCanBeParallelFor (Stmt *AStmt, Sema &SemaRef)
static void setPrototype (Sema &S, FunctionDecl *FD, FunctionDecl *FDWithProto, QualType NewType)
static bool checkPreferTypeArgs (SemaOpenMP &S, const OMPInteropInfo &Info)
 Validate prefer_type fr() and attr() arguments in an OMPInteropInfo.
static OMPAdjustArgsVal checkOMPAdjustArgsValue (SemaOpenMP &S, Expr *E, bool StrictlyPositive, llvm::APSInt &Result)
 Check one 'adjust_args' integer expression for the constant property plus either the positive or the non-negative property (OpenMP 6.0 [5.2.1]).
static bool checkOMPAdjustArgsBound (SemaOpenMP &S, const OMPAdjustArgsItem::Bound &Bound)
 Check one bound of a parameter range 'lb:ub' (OpenMP 6.0 [5.2.1]).
static bool checkOMPAdjustArgsRange (SemaOpenMP &S, const OMPAdjustArgsItem &Range)
static SourceLocation getOMPAdjustArgsItemLoc (const OMPAdjustArgsItem &Item, SourceLocation FallbackLoc)
static CapturedStmt * setBranchProtectedScope (Sema &SemaRef, OpenMPDirectiveKind DKind, Stmt *AStmt)
static bool checkOpenMPIterationSpace (OpenMPDirectiveKind DKind, Stmt *S, Sema &SemaRef, DSAStackTy &DSA, unsigned CurrentNestedLoopCount, unsigned NestedLoopCount, unsigned TotalNestedLoopCount, Expr *CollapseLoopCountExpr, Expr *OrderedLoopCountExpr, SemaOpenMP::VarsWithInheritedDSAType &VarsWithImplicitDSA, llvm::MutableArrayRef< LoopIterationSpace > ResultIterSpaces, llvm::MapVector< const Expr *, DeclRefExpr * > &Captures, const llvm::SmallPtrSetImpl< const Decl * > &CollapsedLoopVarDecls, llvm::SmallPtrSetImpl< const Decl * > &CollapsedLoopInductionVars)
 Called on a for stmt to check and extract its iteration space for further processing (such as collapsing).
static ExprResult buildCounterInit (Sema &SemaRef, Scope *S, SourceLocation Loc, ExprResult VarRef, ExprResult Start, bool IsNonRectangularLB, llvm::MapVector< const Expr *, DeclRefExpr * > &Captures)
 Build 'VarRef = Start.
static ExprResult buildCounterUpdate (Sema &SemaRef, Scope *S, SourceLocation Loc, ExprResult VarRef, ExprResult Start, ExprResult Iter, ExprResult Step, bool Subtract, bool IsNonRectangularLB, llvm::MapVector< const Expr *, DeclRefExpr * > *Captures=nullptr)
 Build 'VarRef = Start + Iter * Step'.
static ExprResult widenIterationCount (unsigned Bits, Expr *E, Sema &SemaRef)
 Convert integer expression E to make it have at least Bits bits.
static bool fitsInto (unsigned Bits, bool Signed, const Expr *E, Sema &SemaRef)
 Check if the given expression E is a constant integer that fits into Bits bits.
static Stmt * buildPreInits (ASTContext &Context, MutableArrayRef< Decl * > PreInits)
 Build preinits statement for the given declarations.
static void appendFlattenedStmtList (SmallVectorImpl< Stmt * > &TargetList, Stmt *Item)
 Append the Item or the content of a CompoundStmt to the list TargetList.
static Stmt * buildPreInits (ASTContext &Context, const llvm::MapVector< const Expr *, DeclRefExpr * > &Captures)
 Build preinits statement for the given declarations.
static Stmt * buildPreInits (ASTContext &Context, ArrayRef< Stmt * > PreInits)
 Build pre-init statement for the given statements.
static Expr * buildPostUpdate (Sema &S, ArrayRef< Expr * > PostUpdates)
 Build postupdate expression for the given list of postupdates expressions.
static unsigned checkOpenMPLoop (OpenMPDirectiveKind DKind, Expr *CollapseLoopCountExpr, Expr *OrderedLoopCountExpr, Stmt *AStmt, Sema &SemaRef, DSAStackTy &DSA, SemaOpenMP::VarsWithInheritedDSAType &VarsWithImplicitDSA, OMPLoopBasedDirective::HelperExprs &Built)
 Called on a for stmt to check itself and nested loops (if any).
static Expr * getCollapseNumberExpr (ArrayRef< OMPClause * > Clauses)
static Expr * getOrderedNumberExpr (ArrayRef< OMPClause * > Clauses)
static bool checkSimdlenSafelenSpecified (Sema &S, const ArrayRef< OMPClause * > Clauses)
static bool checkSectionsDirective (Sema &SemaRef, OpenMPDirectiveKind DKind, Stmt *AStmt, DSAStackTy *Stack)
static Expr * getDirectCallExpr (Expr *E)
static bool checkGenericLoopLastprivate (Sema &S, ArrayRef< OMPClause * > Clauses, OpenMPDirectiveKind K, DSAStackTy *Stack)
static bool validateMultidimClauseExprs (SemaBase &SemaRef, OpenMPClauseKind ClauseKind, SourceLocation ClauseBeginLoc, ArrayRef< const Expr * > ClauseVarList, const Expr *DimsModifierExpr, const OMPXBareClause *BareClause=nullptr)
 Check the number of expressions specified in a multidimensional clause and return whether an error was encountered.
template<typename ClauseT>
static bool validateMultidimClauseExprs (SemaBase &SemaRef, const ClauseT *Clause, const OMPXBareClause *BareClause)
 Check the number of expressions specified in a multidimensional clause and return whether an error was encountered.
static bool validateMultidimClauses (SemaBase &SemaRef, ArrayRef< OMPClause * > Clauses, bool MayHaveBareClause=false)
 Check the number of expressions specified in clauses that can contain multidimensional values, e.g., num_teams and thread_limit.
static bool checkMutuallyExclusiveClauses (Sema &S, ArrayRef< OMPClause * > Clauses, ArrayRef< OpenMPClauseKind > MutuallyExclusiveClauses)
 Find and diagnose mutually exclusive clause kinds.
static bool hasClauses (ArrayRef< OMPClause * > Clauses, const OpenMPClauseKind K)
 Check for existence of a map clause in the list of clauses.
template<typename... Params>
static bool hasClauses (ArrayRef< OMPClause * > Clauses, const OpenMPClauseKind K, const Params... ClauseTypes)
static bool isClauseMappable (ArrayRef< OMPClause * > Clauses)
 Check if the variables in the mapping clause are externally visible.
static bool checkReductionClauseWithNogroup (Sema &S, ArrayRef< OMPClause * > Clauses)
static void updatePreInits (OMPLoopTransformationDirective *Transform, SmallVectorImpl< Stmt * > &PreInits)
 Updates OriginalInits by checking Transform against loop transformation directives and appending their pre-inits if a match is found.
static void addLoopPreInits (ASTContext &Context, OMPLoopBasedDirective::HelperExprs &LoopHelper, Stmt *LoopStmt, ArrayRef< Stmt * > OriginalInit, SmallVectorImpl< Stmt * > &PreInits)
 Add preinit statements that need to be propagated from the selected loop.
static void collectLoopStmts (Stmt *AStmt, MutableArrayRef< Stmt * > LoopStmts, bool RelaxNestForPeeledTransformation=false)
 Collect the loop statements (ForStmt or CXXRangeForStmt) of the affected loop of a construct.
static void appendStmtsBeforeNestedLoop (Stmt *LoopStmt, SmallVectorImpl< Stmt * > &BodyParts)
 A non-innermost affected loop generated by a nested loop transformation (e.g.
static Expr * makeFloorIVRef (Sema &SemaRef, ArrayRef< VarDecl * > FloorIndVars, int I, QualType IVTy, DeclRefExpr *OrigCntVar)
 Build and return a DeclRefExpr for the floor induction variable using the SemaRef and the provided parameters.
static OpenMPDirectiveKind getOpenMPCaptureRegionForClause (OpenMPDirectiveKind DKind, OpenMPClauseKind CKind, llvm::omp::Version OMPVersion, OpenMPDirectiveKind NameModifier=OMPD_unknown)
static bool isNonNegativeIntegerValue (Expr *&ValExpr, Sema &SemaRef, OpenMPClauseKind CKind, bool StrictlyPositive, bool BuildCapture=false, OpenMPDirectiveKind DKind=OMPD_unknown, OpenMPDirectiveKind *CaptureRegion=nullptr, Stmt **HelperValStmt=nullptr)
static std::string getListOfPossibleValues (OpenMPClauseKind K, unsigned First, unsigned Last, ArrayRef< unsigned > Exclude={})
static bool findOMPAllocatorHandleT (Sema &S, SourceLocation Loc, DSAStackTy *Stack)
 Tries to find omp_allocator_handle_t type.
static OMPClause * createTransparentClause (Sema &SemaRef, ASTContext &Ctx, Expr *ImpexTypeArg, Stmt *HelperValStmt, OpenMPDirectiveKind CaptureRegion, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
static bool checkScheduleModifiers (Sema &S, OpenMPScheduleClauseModifier M1, OpenMPScheduleClauseModifier M2, SourceLocation M1Loc, SourceLocation M2Loc)
static bool isValidInteropVariable (Sema &SemaRef, Expr *InteropVarExpr, SourceLocation VarLoc, OpenMPClauseKind Kind)
template<typename T, typename U>
static T filterLookupForUDReductionAndMapper (SmallVectorImpl< U > &Lookups, const llvm::function_ref< T(ValueDecl *)> Gen)
static NamedDecl * findAcceptableDecl (Sema &SemaRef, NamedDecl *D)
static void argumentDependentLookup (Sema &SemaRef, const DeclarationNameInfo &Id, SourceLocation Loc, QualType Ty, SmallVectorImpl< UnresolvedSet< 8 > > &Lookups)
static ExprResult buildDeclareReductionRef (Sema &SemaRef, SourceLocation Loc, SourceRange Range, Scope *S, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, QualType Ty, CXXCastPath &BasePath, Expr *UnresolvedReduction)
static bool checkOMPArraySectionConstantForReduction (ASTContext &Context, const ArraySectionExpr *OASE, bool &SingleElement, SmallVectorImpl< llvm::APSInt > &ArraySizes)
static BinaryOperatorKind getRelatedCompoundReductionOp (BinaryOperatorKind BOK)
static bool actOnOMPReductionKindClause (Sema &S, DSAStackTy *Stack, OpenMPClauseKind ClauseKind, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions, ReductionData &RD)
static bool findOMPDependT (Sema &S, SourceLocation Loc, DSAStackTy *Stack, bool Diagnose=true)
 Tries to find omp_depend_t. type.
static DoacrossDataInfoTy ProcessOpenMPDoacrossClauseCommon (Sema &SemaRef, bool IsSource, ArrayRef< Expr * > VarList, DSAStackTy *Stack, SourceLocation EndLoc)
static bool checkTypeMappable (SourceLocation SL, SourceRange SR, Sema &SemaRef, DSAStackTy *Stack, QualType QTy, bool FullCheck=true)
static bool checkArrayExpressionDoesNotReferToWholeSize (Sema &SemaRef, const Expr *E, QualType BaseQTy)
 Return true if it can be proven that the provided array expression (array section or array subscript) does NOT specify the whole size of the array whose base type is BaseQTy.
static bool checkArrayExpressionDoesNotReferToUnitySize (Sema &SemaRef, const Expr *E, QualType BaseQTy)
static bool checkMapConflicts (Sema &SemaRef, DSAStackTy *DSAS, const ValueDecl *VD, const Expr *E, bool CurrentRegionOnly, OMPClauseMappableExprCommon::MappableExprComponentListRef CurComponents, OpenMPClauseKind CKind)
static DeclRefExpr * buildImplicitMap (Sema &S, QualType BaseType, DSAStackTy *Stack, SmallVectorImpl< OMPClause * > &Maps)
static ExprResult buildImplicitMapper (Sema &S, QualType BaseType, DSAStackTy *Stack)
static bool hasUserDefinedMapper (Sema &SemaRef, Scope *S, CXXScopeSpec &MapperIdScopeSpec, const DeclarationNameInfo &MapperId, QualType Type)
static bool isImplicitMapperNeeded (Sema &S, DSAStackTy *Stack, QualType CanonType, const Expr *E)
static void checkMappableExpressionList (Sema &SemaRef, DSAStackTy *DSAS, OpenMPClauseKind CKind, MappableVarListInfo &MVLI, SourceLocation StartLoc, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo MapperId, ArrayRef< Expr * > UnresolvedMappers, OpenMPMapClauseKind MapType=OMPC_MAP_unknown, ArrayRef< OpenMPMapModifierKind > Modifiers={}, bool IsMapTypeImplicit=false, bool NoDiagnose=false)
static bool findOMPEventHandleT (Sema &S, SourceLocation Loc, DSAStackTy *Stack)
 Tries to find omp_event_handle_t type.
static void checkDeclInTargetContext (SourceLocation SL, SourceRange SR, Sema &SemaRef, Decl *D)
static bool checkValueDeclInTarget (SourceLocation SL, SourceRange SR, Sema &SemaRef, DSAStackTy *Stack, ValueDecl *VD)
static bool findOMPAlloctraitT (Sema &S, SourceLocation Loc, DSAStackTy *Stack)
 Tries to find omp_alloctrait_t type.
static void checkOMPAssumeAttr (Sema &S, SourceLocation Loc, StringRef AssumptionStr)
 Check if AssumptionStr is a known assumption and warn if not.

Detailed Description

This file implements semantic analysis for OpenMP directives and clauses.

Definition in file SemaOpenMP.cpp.

Macro Definition Documentation

◆ ABSTRACT_STMT

#define ABSTRACT_STMT ( CLASS)

◆ COMMON_OMP_LOOP_TRANSFORMATION

#define COMMON_OMP_LOOP_TRANSFORMATION ( CLASS,
PARENT )
Value:
case Stmt::CLASS##Class: \
appendFlattenedStmtList(PreInits, \
static_cast<const CLASS *>(Dir)->getPreInits()); \
break;

◆ DSAStack

#define DSAStack   static_cast<DSAStackTy *>(VarDataSharingAttributesStack)

Definition at line 2105 of file SemaOpenMP.cpp.

Referenced by clang::SemaOpenMP::ActOnOpenMPAlignedClause(), clang::SemaOpenMP::ActOnOpenMPAllocateClause(), clang::SemaOpenMP::ActOnOpenMPAllocateDirective(), clang::SemaOpenMP::ActOnOpenMPAllocatorClause(), clang::SemaOpenMP::ActOnOpenMPAtomicDirective(), clang::SemaOpenMP::ActOnOpenMPCall(), clang::SemaOpenMP::ActOnOpenMPCancelDirective(), clang::SemaOpenMP::ActOnOpenMPCancellationPointDirective(), clang::SemaOpenMP::ActOnOpenMPCopyinClause(), clang::SemaOpenMP::ActOnOpenMPCopyprivateClause(), clang::SemaOpenMP::ActOnOpenMPCriticalDirective(), clang::SemaOpenMP::ActOnOpenMPDeclareMapperDirective(), clang::SemaOpenMP::ActOnOpenMPDeclareMapperDirectiveVarDecl(), clang::SemaOpenMP::ActOnOpenMPDefaultClause(), clang::SemaOpenMP::ActOnOpenMPDefaultmapClause(), clang::SemaOpenMP::ActOnOpenMPDependClause(), clang::SemaOpenMP::ActOnOpenMPDepobjClause(), clang::SemaOpenMP::ActOnOpenMPDestroyClause(), clang::SemaOpenMP::ActOnOpenMPDetachClause(), clang::SemaOpenMP::ActOnOpenMPDeviceClause(), clang::SemaOpenMP::ActOnOpenMPDistributeDirective(), clang::SemaOpenMP::ActOnOpenMPDistributeParallelForDirective(), clang::SemaOpenMP::ActOnOpenMPDistributeParallelForSimdDirective(), clang::SemaOpenMP::ActOnOpenMPDistributeSimdDirective(), clang::SemaOpenMP::ActOnOpenMPDistScheduleClause(), clang::SemaOpenMP::ActOnOpenMPDoacrossClause(), clang::SemaOpenMP::ActOnOpenMPDynGroupprivateClause(), clang::SemaOpenMP::ActOnOpenMPExclusiveClause(), clang::SemaOpenMP::ActOnOpenMPExecutableDirective(), clang::SemaOpenMP::ActOnOpenMPFilterClause(), clang::SemaOpenMP::ActOnOpenMPFinalClause(), clang::SemaOpenMP::ActOnOpenMPFirstprivateClause(), clang::SemaOpenMP::ActOnOpenMPForDirective(), clang::SemaOpenMP::ActOnOpenMPForSimdDirective(), clang::SemaOpenMP::ActOnOpenMPFromClause(), clang::SemaOpenMP::ActOnOpenMPGenericLoopDirective(), clang::SemaOpenMP::ActOnOpenMPGrainsizeClause(), clang::SemaOpenMP::ActOnOpenMPHasDeviceAddrClause(), clang::SemaOpenMP::ActOnOpenMPIdExpression(), clang::SemaOpenMP::ActOnOpenMPIfClause(), clang::SemaOpenMP::ActOnOpenMPInclusiveClause(), clang::SemaOpenMP::ActOnOpenMPInReductionClause(), clang::SemaOpenMP::ActOnOpenMPIsDevicePtrClause(), clang::SemaOpenMP::ActOnOpenMPIteratorVarDecl(), clang::SemaOpenMP::ActOnOpenMPLastprivateClause(), clang::SemaOpenMP::ActOnOpenMPLinearClause(), clang::SemaOpenMP::ActOnOpenMPLoopInitialization(), clang::SemaOpenMP::ActOnOpenMPMapClause(), clang::SemaOpenMP::ActOnOpenMPMaskedTaskLoopDirective(), clang::SemaOpenMP::ActOnOpenMPMaskedTaskLoopSimdDirective(), clang::SemaOpenMP::ActOnOpenMPMasterTaskLoopDirective(), clang::SemaOpenMP::ActOnOpenMPMasterTaskLoopSimdDirective(), clang::SemaOpenMP::ActOnOpenMPMessageClause(), clang::SemaOpenMP::ActOnOpenMPNocontextClause(), clang::SemaOpenMP::ActOnOpenMPNontemporalClause(), clang::SemaOpenMP::ActOnOpenMPNovariantsClause(), clang::SemaOpenMP::ActOnOpenMPNowaitClause(), clang::SemaOpenMP::ActOnOpenMPNumTasksClause(), clang::SemaOpenMP::ActOnOpenMPNumTeamsClause(), clang::SemaOpenMP::ActOnOpenMPNumThreadsClause(), clang::SemaOpenMP::ActOnOpenMPOrderClause(), clang::SemaOpenMP::ActOnOpenMPOrderedClause(), clang::SemaOpenMP::ActOnOpenMPOrderedDirective(), clang::SemaOpenMP::ActOnOpenMPParallelDirective(), clang::SemaOpenMP::ActOnOpenMPParallelForDirective(), clang::SemaOpenMP::ActOnOpenMPParallelForSimdDirective(), clang::SemaOpenMP::ActOnOpenMPParallelGenericLoopDirective(), clang::SemaOpenMP::ActOnOpenMPParallelMaskedDirective(), clang::SemaOpenMP::ActOnOpenMPParallelMaskedTaskLoopDirective(), clang::SemaOpenMP::ActOnOpenMPParallelMaskedTaskLoopSimdDirective(), clang::SemaOpenMP::ActOnOpenMPParallelMasterDirective(), clang::SemaOpenMP::ActOnOpenMPParallelMasterTaskLoopDirective(), clang::SemaOpenMP::ActOnOpenMPParallelMasterTaskLoopSimdDirective(), clang::SemaOpenMP::ActOnOpenMPParallelSectionsDirective(), clang::SemaOpenMP::ActOnOpenMPPriorityClause(), clang::SemaOpenMP::ActOnOpenMPPrivateClause(), clang::SemaOpenMP::ActOnOpenMPReductionClause(), clang::SemaOpenMP::ActOnOpenMPRegionEnd(), clang::SemaOpenMP::ActOnOpenMPRegionStart(), clang::SemaOpenMP::ActOnOpenMPRequiresDirective(), clang::SemaOpenMP::ActOnOpenMPScanDirective(), clang::SemaOpenMP::ActOnOpenMPScheduleClause(), clang::SemaOpenMP::ActOnOpenMPSectionDirective(), clang::SemaOpenMP::ActOnOpenMPSectionsDirective(), clang::SemaOpenMP::ActOnOpenMPSharedClause(), clang::SemaOpenMP::ActOnOpenMPSimdDirective(), clang::SemaOpenMP::ActOnOpenMPTargetDirective(), clang::SemaOpenMP::ActOnOpenMPTargetParallelDirective(), clang::SemaOpenMP::ActOnOpenMPTargetParallelForDirective(), clang::SemaOpenMP::ActOnOpenMPTargetParallelForSimdDirective(), clang::SemaOpenMP::ActOnOpenMPTargetParallelGenericLoopDirective(), clang::SemaOpenMP::ActOnOpenMPTargetSimdDirective(), clang::SemaOpenMP::ActOnOpenMPTargetTeamsDistributeDirective(), clang::SemaOpenMP::ActOnOpenMPTargetTeamsDistributeParallelForDirective(), clang::SemaOpenMP::ActOnOpenMPTargetTeamsDistributeParallelForSimdDirective(), clang::SemaOpenMP::ActOnOpenMPTargetTeamsDistributeSimdDirective(), clang::SemaOpenMP::ActOnOpenMPTargetTeamsGenericLoopDirective(), clang::SemaOpenMP::ActOnOpenMPTaskDirective(), clang::SemaOpenMP::ActOnOpenMPTaskgroupDirective(), clang::SemaOpenMP::ActOnOpenMPTaskLoopDirective(), clang::SemaOpenMP::ActOnOpenMPTaskLoopSimdDirective(), clang::SemaOpenMP::ActOnOpenMPTaskReductionClause(), clang::SemaOpenMP::ActOnOpenMPTeamsDirective(), clang::SemaOpenMP::ActOnOpenMPTeamsDistributeDirective(), clang::SemaOpenMP::ActOnOpenMPTeamsDistributeParallelForDirective(), clang::SemaOpenMP::ActOnOpenMPTeamsDistributeParallelForSimdDirective(), clang::SemaOpenMP::ActOnOpenMPTeamsDistributeSimdDirective(), clang::SemaOpenMP::ActOnOpenMPTeamsGenericLoopDirective(), clang::SemaOpenMP::ActOnOpenMPThreadLimitClause(), clang::SemaOpenMP::ActOnOpenMPToClause(), clang::SemaOpenMP::ActOnOpenMPTransparentClause(), clang::SemaOpenMP::ActOnOpenMPUntiedClause(), clang::SemaOpenMP::ActOnOpenMPUseDeviceAddrClause(), clang::SemaOpenMP::ActOnOpenMPUseDevicePtrClause(), clang::SemaOpenMP::ActOnOpenMPUsesAllocatorClause(), clang::SemaOpenMP::ActOnOpenMPXDynCGroupMemClause(), clang::SemaOpenMP::addRequiresDecl(), clang::SemaOpenMP::checkDeclIsAllowedInOpenMPTarget(), clang::SemaOpenMP::CheckOMPGroupPrivateDecl(), clang::SemaOpenMP::CheckOMPRequiresDecl(), clang::SemaOpenMP::CheckOMPThreadPrivateDecl(), clang::SemaOpenMP::EndOpenMPClause(), clang::SemaOpenMP::EndOpenMPDSABlock(), clang::SemaOpenMP::getOpenMPDeclareMapperVarName(), clang::SemaOpenMP::getRequiresDecls(), clang::SemaOpenMP::isInOpenMPTargetExecutionDirective(), clang::SemaOpenMP::isInOpenMPTaskUntiedContext(), clang::SemaOpenMP::isOpenMPCapturedByRef(), clang::SemaOpenMP::isOpenMPCapturedDecl(), clang::SemaOpenMP::isOpenMPDeclareMapperVarDeclAllowed(), clang::SemaOpenMP::isOpenMPGlobalCapturedDecl(), clang::SemaOpenMP::isOpenMPPrivateDecl(), clang::SemaOpenMP::isOpenMPRebuildMemberExpr(), clang::SemaOpenMP::isOpenMPTargetCapturedDecl(), clang::SemaOpenMP::setOpenMPCaptureKind(), clang::SemaOpenMP::StartOpenMPClause(), clang::SemaOpenMP::startOpenMPCXXRangeFor(), clang::SemaOpenMP::StartOpenMPDSABlock(), clang::SemaOpenMP::startOpenMPLoop(), clang::SemaOpenMP::tryCaptureOpenMPLambdas(), and clang::SemaOpenMP::VerifyPositiveIntegerConstantInClause().

◆ OMPCANONICALLOOPNESTTRANSFORMATIONDIRECTIVE

#define OMPCANONICALLOOPNESTTRANSFORMATIONDIRECTIVE ( CLASS,
PARENT )
Value:
#define COMMON_OMP_LOOP_TRANSFORMATION(CLASS, PARENT)

◆ OMPCANONICALLOOPSEQUENCETRANSFORMATIONDIRECTIVE

#define OMPCANONICALLOOPSEQUENCETRANSFORMATIONDIRECTIVE ( CLASS,
PARENT )
Value:

◆ STMT

#define STMT ( CLASS,
PARENT )

Enumeration Type Documentation

◆ OMPAdjustArgsVal

enum class OMPAdjustArgsVal
strong
Enumerator
Known 
Dependent 
Invalid 

Definition at line 8303 of file SemaOpenMP.cpp.

Function Documentation

◆ actOnOMPReductionKindClause()

bool actOnOMPReductionKindClause ( Sema & S,
DSAStackTy * Stack,
OpenMPClauseKind ClauseKind,
ArrayRef< Expr * > VarList,
SourceLocation StartLoc,
SourceLocation LParenLoc,
SourceLocation ColonLoc,
SourceLocation EndLoc,
CXXScopeSpec & ReductionIdScopeSpec,
const DeclarationNameInfo & ReductionId,
ArrayRef< Expr * > UnresolvedReductions,
ReductionData & RD )
static

Definition at line 22123 of file SemaOpenMP.cpp.

References clang::Sema::ActOnFinishFullExpr(), clang::Sema::ActOnIntegerConstant(), clang::Sema::ActOnUninitializedDecl(), clang::Sema::AddInitializerToDecl(), clang::Sema::BuildBinOp(), buildCapture(), clang::Sema::BuildCStyleCastExpr(), buildDeclareReductionRef(), buildDeclRefExpr(), buildVarDecl(), clang::VarDecl::CallInit, clang::cast(), checkOMPArraySectionConstantForReduction(), clang::Sema::Context, clang::CallExpr::Create(), clang::FloatingLiteral::Create(), clang::ImplicitCastExpr::Create(), clang::IntegerLiteral::Create(), clang::Sema::CreateBuiltinArraySubscriptExpr(), clang::Sema::CreateBuiltinBinOp(), clang::Sema::CreateBuiltinUnaryOp(), clang::InitializationKind::CreateCopy(), clang::Sema::CurContext, clang::Sema::CurFPFeatureOverrides(), clang::VarDecl::DeclarationOnly, clang::Sema::DefaultFunctionArrayLvalueConversion(), clang::Sema::DefaultLvalueConversion(), clang::SemaBase::Diag(), clang::Dim, clang::ActionResult< PtrTy, Compress >::get(), clang::ActionResult< PtrTy, Compress >::getAs(), clang::Type::getAs(), clang::DeclarationName::getAsIdentifierInfo(), clang::Decl::getAttrs(), clang::ArraySectionExpr::getBaseOriginalType(), clang::SourceRange::getBegin(), clang::CXXScopeSpec::getBeginLoc(), clang::DeclarationNameInfo::getBeginLoc(), clang::DeclarationName::getCXXOverloadedOperator(), clang::DeclRefExpr::getDecl(), clang::DeclarationNameInfo::getEndLoc(), clang::Expr::getExprLoc(), clang::VarDecl::getInit(), clang::VarDecl::getInitStyle(), clang::Sema::getLangOpts(), clang::DeclarationNameInfo::getLoc(), clang::Decl::getLocation(), clang::DeclarationNameInfo::getName(), clang::NamedDecl::getName(), clang::QualType::getNonReferenceType(), getOpenMPClauseNameForDiag(), clang::Type::getPointeeType(), getPrivateItem(), getRelatedCompoundReductionOp(), clang::ASTContext::getSizeType(), clang::Expr::getType(), clang::ValueDecl::getType(), clang::Expr::getValueKind(), clang::ASTContext::getVariableArrayType(), clang::Decl::hasAttr(), clang::Decl::hasAttrs(), clang::VarDecl::hasInit(), clang::Type::hasSignedIntegerRepresentation(), clang::Sema::IgnoredValueConversions(), clang::Expr::IgnoreParens(), clang::Init, clang::InitializedEntity::InitializeTemporary(), clang::isa(), clang::Type::isAnyComplexType(), clang::Type::isArithmeticType(), clang::DeclContext::isDependentContext(), clang::Type::isFloatingType(), clang::Type::isIntegerType(), clang::ActionResult< PtrTy, Compress >::isInvalid(), clang::Decl::isInvalidDecl(), clang::SemaOpenMP::isOpenMPCapturedDecl(), clang::isOpenMPParallelDirective(), clang::isOpenMPSimdDirective(), clang::isOpenMPTargetExecutionDirective(), clang::isOpenMPTaskingDirective(), clang::isOpenMPTeamsDirective(), clang::isOpenMPWorksharingDirective(), clang::Type::isPointerType(), clang::Type::isRealFloatingType(), clang::Type::isRecordType(), clang::Type::isReferenceType(), clang::Type::isScalarType(), clang::ActionResult< PtrTy, Compress >::isUnset(), clang::ActionResult< PtrTy, Compress >::isUsable(), clang::CXXScopeSpec::isValid(), clang::Type::isVariablyModifiedType(), clang::Sema::LangOpts, clang::Normal, clang::NUM_OVERLOADED_OPERATORS, clang::OK_Ordinary, clang::OO_None, clang::Sema::OpenMP(), clang::Stmt::Profile(), rejectConstNotMutableType(), reportOriginalDsa(), clang::Sema::RequireCompleteType(), clang::Seq, clang::SourceRange::setBegin(), clang::SourceRange::setEnd(), clang::VarDecl::setInit(), clang::VarDecl::setInitStyle(), clang::Sema::targetDiag(), clang::VK_LValue, and clang::VK_PRValue.

Referenced by clang::SemaOpenMP::ActOnOpenMPInReductionClause(), clang::SemaOpenMP::ActOnOpenMPReductionClause(), and clang::SemaOpenMP::ActOnOpenMPTaskReductionClause().

◆ addLoopPreInits()

◆ appendFlattenedStmtList()

void appendFlattenedStmtList ( SmallVectorImpl< Stmt * > & TargetList,
Stmt * Item )
static

Append the Item or the content of a CompoundStmt to the list TargetList.

A CompoundStmt is used as container in case multiple statements need to be stored in lieu of using an explicit list. Flattening is necessary because contained DeclStmts need to be visible after the execution of the list. Used for OpenMP pre-init declarations/statements.

Definition at line 10693 of file SemaOpenMP.cpp.

Referenced by buildPreInits(), and checkOpenMPLoop().

◆ appendStmtsBeforeNestedLoop()

void appendStmtsBeforeNestedLoop ( Stmt * LoopStmt,
SmallVectorImpl< Stmt * > & BodyParts )
static

A non-innermost affected loop generated by a nested loop transformation (e.g.

omp reverse) computes the user counter in statements ahead of the next loop. A construct that rebuilds the nest only keeps the innermost body, so it must re-emit these statements in the matching loop.

Definition at line 15926 of file SemaOpenMP.cpp.

References clang::cast(), and clang::isa().

Referenced by clang::SemaOpenMP::ActOnOpenMPStripeDirective(), and clang::SemaOpenMP::ActOnOpenMPTileDirective().

◆ applyOMPAllocateAttribute()

◆ argumentDependentLookup()

◆ buildCapture() [1/2]

◆ buildCapture() [2/2]

◆ buildCaptureDecl()

◆ buildCounterInit()

◆ buildCounterUpdate()

◆ buildDeclareReductionRef()

ExprResult buildDeclareReductionRef ( Sema & SemaRef,
SourceLocation Loc,
SourceRange Range,
Scope * S,
CXXScopeSpec & ReductionIdScopeSpec,
const DeclarationNameInfo & ReductionId,
QualType Ty,
CXXCastPath & BasePath,
Expr * UnresolvedReduction )
static

Definition at line 21817 of file SemaOpenMP.cpp.

References clang::UnresolvedSetImpl::addDecl(), clang::UnresolvedSetImpl::append(), clang::Sema::AR_inaccessible, argumentDependentLookup(), clang::LookupResult::begin(), clang::UnresolvedSetImpl::begin(), clang::Sema::BuildBasePathArray(), clang::Sema::BuildDeclRefExpr(), clang::Type::castAsRecordDecl(), clang::Sema::CheckBaseClassAccess(), clang::LookupResult::clear(), clang::Type::containsUnexpandedParameterPack(), clang::Sema::Context, clang::UnresolvedLookupExpr::Create(), clang::Sema::CurContext, clang::SemaBase::Diag(), clang::LookupResult::empty(), clang::LookupResult::end(), clang::UnresolvedSetImpl::end(), clang::ExprEmpty(), clang::ExprError(), filterLookupForUDReductionAndMapper(), clang::CXXBasePaths::front(), clang::Sema::getASTContext(), clang::ASTContext::getCanonicalType(), clang::Sema::getLangOpts(), clang::QualType::getNonReferenceType(), clang::Scope::getParent(), clang::LookupResult::getRepresentativeDecl(), clang::ValueDecl::getType(), clang::QualType::getUnqualifiedType(), clang::CXXScopeSpec::getWithLocInContext(), clang::ASTContext::hasSameType(), clang::CXXBasePaths::isAmbiguous(), clang::Sema::isCompleteType(), clang::Scope::isDeclScope(), clang::DeclContext::isDependentContext(), clang::Type::isDependentType(), clang::Sema::IsDerivedFrom(), clang::Type::isInstantiationDependentType(), clang::CXXScopeSpec::isInvalid(), clang::Decl::isInvalidDecl(), clang::QualType::isMoreQualifiedThan(), clang::Type::isRecordType(), clang::CXXScopeSpec::isSet(), clang::Sema::LookupOMPReductionName, clang::Sema::LookupParsedName(), clang::Sema::LookupQualifiedName(), clang::Set, clang::LookupResult::suppressDiagnostics(), and clang::VK_LValue.

Referenced by actOnOMPReductionKindClause().

◆ buildDeclRefExpr()

DeclRefExpr * buildDeclRefExpr ( Sema & S,
VarDecl * D,
QualType Ty,
SourceLocation Loc,
bool RefersToCapture = false )
static

◆ buildDistanceFunc()

CapturedStmt * buildDistanceFunc ( Sema & Actions,
QualType LogicalTy,
BinaryOperator::Opcode Rel,
Expr * StartExpr,
Expr * StopExpr,
Expr * StepExpr )
static

Create a closure that computes the number of iterations of a loop.

Parameters
ActionsThe Sema object.
LogicalTyType for the logical iteration number.
RelComparison operator of the loop condition.
StartExprValue of the loop counter at the first iteration.
StopExprExpression the loop counter is compared against in the loop condition.
StepExprAmount of increment after each iteration.
Returns
Closure (CapturedStmt) of the distance calculation.

Definition at line 6058 of file SemaOpenMP.cpp.

References clang::Sema::ActOnCapturedRegionEnd(), clang::Sema::ActOnCapturedRegionStart(), clang::Sema::ActOnCompoundStmt(), clang::Sema::ActOnConditionalOp(), clang::AssertSuccess(), clang::Sema::BuildBinOp(), clang::Sema::BuildCStyleCastExpr(), clang::Sema::BuildDeclRefExpr(), buildDeclRefExpr(), clang::Sema::BuildUnaryOp(), clang::cast(), clang::CR_Default, clang::IntegerLiteral::Create(), clang::Sema::CurContext, clang::Sema::getASTContext(), clang::Sema::getCurScope(), clang::ASTContext::getIntWidth(), clang::ASTContext::getLValueReferenceType(), clang::CapturedDecl::getParam(), clang::ASTContext::getTrivialTypeSourceInfo(), clang::ValueDecl::getType(), precomputeExpr(), clang::VK_LValue, and clang::Zero.

Referenced by clang::SemaOpenMP::ActOnOpenMPCanonicalLoop().

◆ buildImplicitMap()

◆ buildImplicitMapper()

◆ buildLoopVarFunc()

CapturedStmt * buildLoopVarFunc ( Sema & Actions,
QualType LoopVarTy,
QualType LogicalTy,
DeclRefExpr * StartExpr,
Expr * Step,
bool Deref )
static

Create a closure that computes the loop variable from the logical iteration number.

Parameters
ActionsThe Sema object.
LoopVarTyType for the loop variable used for result value.
LogicalTyType for the logical iteration number.
StartExprValue of the loop counter at the first iteration.
StepAmount of increment after each iteration.
DerefWhether the loop variable is a dereference of the loop counter variable.
Returns
Closure (CapturedStmt) of the loop value calculation.

Definition at line 6206 of file SemaOpenMP.cpp.

References clang::Sema::ActOnCapturedRegionEnd(), clang::Sema::ActOnCapturedRegionStart(), clang::AssertSuccess(), clang::Sema::BuildBinOp(), clang::Sema::BuildDeclRefExpr(), clang::Sema::BuildUnaryOp(), clang::cast(), clang::CR_Default, clang::Sema::CurContext, clang::ExplicitByVal, clang::Sema::getASTContext(), clang::Sema::getCurScope(), clang::DeclRefExpr::getDecl(), clang::ASTContext::getLValueReferenceType(), clang::Invalid, clang::sema::Skip, clang::Sema::tryCaptureVariable(), and clang::VK_LValue.

Referenced by clang::SemaOpenMP::ActOnOpenMPCanonicalLoop().

◆ buildPostUpdate()

◆ buildPreInits() [1/3]

Stmt * buildPreInits ( ASTContext & Context,
ArrayRef< Stmt * > PreInits )
static

Build pre-init statement for the given statements.

Definition at line 10719 of file SemaOpenMP.cpp.

References appendFlattenedStmtList(), and clang::CompoundStmt::Create().

◆ buildPreInits() [2/3]

Stmt * buildPreInits ( ASTContext & Context,
const llvm::MapVector< const Expr *, DeclRefExpr * > & Captures )
static

Build preinits statement for the given declarations.

Definition at line 10707 of file SemaOpenMP.cpp.

References buildPreInits().

◆ buildPreInits() [3/3]

Stmt * buildPreInits ( ASTContext & Context,
MutableArrayRef< Decl * > PreInits )
static

Build preinits statement for the given declarations.

Definition at line 10676 of file SemaOpenMP.cpp.

References clang::DeclGroupRef::Create().

Referenced by clang::SemaOpenMP::ActOnOpenMPDeviceClause(), clang::SemaOpenMP::ActOnOpenMPDistScheduleClause(), clang::SemaOpenMP::ActOnOpenMPDynGroupprivateClause(), clang::SemaOpenMP::ActOnOpenMPFilterClause(), clang::SemaOpenMP::ActOnOpenMPFinalClause(), clang::SemaOpenMP::ActOnOpenMPFirstprivateClause(), clang::SemaOpenMP::ActOnOpenMPFlattenDirective(), clang::SemaOpenMP::ActOnOpenMPFuseDirective(), clang::SemaOpenMP::ActOnOpenMPIfClause(), clang::SemaOpenMP::ActOnOpenMPInReductionClause(), clang::SemaOpenMP::ActOnOpenMPInterchangeDirective(), clang::SemaOpenMP::ActOnOpenMPLastprivateClause(), clang::SemaOpenMP::ActOnOpenMPLinearClause(), clang::SemaOpenMP::ActOnOpenMPMessageClause(), clang::SemaOpenMP::ActOnOpenMPNocontextClause(), clang::SemaOpenMP::ActOnOpenMPNovariantsClause(), clang::SemaOpenMP::ActOnOpenMPNumTeamsClause(), clang::SemaOpenMP::ActOnOpenMPNumThreadsClause(), clang::SemaOpenMP::ActOnOpenMPReductionClause(), clang::SemaOpenMP::ActOnOpenMPReverseDirective(), clang::SemaOpenMP::ActOnOpenMPScheduleClause(), clang::SemaOpenMP::ActOnOpenMPSplitDirective(), clang::SemaOpenMP::ActOnOpenMPStripeDirective(), clang::SemaOpenMP::ActOnOpenMPTaskReductionClause(), clang::SemaOpenMP::ActOnOpenMPThreadLimitClause(), clang::SemaOpenMP::ActOnOpenMPTileDirective(), clang::SemaOpenMP::ActOnOpenMPTransparentClause(), clang::SemaOpenMP::ActOnOpenMPUnrollDirective(), clang::SemaOpenMP::ActOnOpenMPXDynCGroupMemClause(), buildPreInits(), checkOpenMPLoop(), and isNonNegativeIntegerValue().

◆ buildUserDefinedMapperRef()

ExprResult buildUserDefinedMapperRef ( Sema & SemaRef,
Scope * S,
CXXScopeSpec & MapperIdScopeSpec,
const DeclarationNameInfo & MapperId,
QualType Type,
Expr * UnresolvedMapper,
SourceLocation ItemLoc )
static

Definition at line 24889 of file SemaOpenMP.cpp.

References clang::UnresolvedSetImpl::append(), clang::Sema::AR_inaccessible, argumentDependentLookup(), clang::LookupResult::begin(), clang::UnresolvedSetImpl::begin(), clang::Sema::BuildDeclRefExpr(), clang::cast(), clang::Sema::CheckBaseClassAccess(), clang::LookupResult::clear(), clang::Type::containsUnexpandedParameterPack(), clang::Sema::Context, clang::UnresolvedLookupExpr::Create(), clang::Sema::CurContext, clang::SemaBase::Diag(), clang::LookupResult::end(), clang::UnresolvedSetImpl::end(), clang::ExprEmpty(), clang::ExprError(), filterLookupForUDReductionAndMapper(), clang::CXXBasePaths::front(), clang::Type::getAsArrayTypeUnsafe(), clang::DeclarationNameInfo::getAsString(), clang::Sema::getASTContext(), clang::ASTContext::getCanonicalType(), clang::QualType::getCanonicalType(), clang::ArrayType::getElementType(), clang::Sema::getLangOpts(), clang::DeclarationNameInfo::getLoc(), clang::DeclarationNameInfo::getName(), clang::Scope::getParent(), clang::LookupResult::getRepresentativeDecl(), clang::ValueDecl::getType(), clang::QualType::getUnqualifiedType(), clang::CXXScopeSpec::getWithLocInContext(), clang::ASTContext::hasSameType(), clang::CXXBasePaths::isAmbiguous(), clang::Type::isArrayType(), clang::Scope::isDeclScope(), clang::DeclContext::isDependentContext(), clang::Type::isDependentType(), clang::Sema::IsDerivedFrom(), clang::Type::isInstantiationDependentType(), clang::CXXScopeSpec::isInvalid(), clang::Decl::isInvalidDecl(), clang::CXXScopeSpec::isSet(), clang::Type::isStructureOrClassType(), clang::Type::isUnionType(), clang::Sema::LookupOMPMapperName, clang::Sema::LookupParsedName(), clang::Set, clang::LookupResult::suppressDiagnostics(), and clang::VK_LValue.

Referenced by processImplicitMapsWithDefaultMappers().

◆ buildVarDecl()

VarDecl * buildVarDecl ( Sema & SemaRef,
SourceLocation Loc,
QualType Type,
StringRef Name,
const AttrVec * Attrs = nullptr,
DeclRefExpr * OrigRef = nullptr )
static

◆ checkAllocateClauses()

◆ checkArrayExpressionDoesNotReferToUnitySize()

bool checkArrayExpressionDoesNotReferToUnitySize ( Sema & SemaRef,
const Expr * E,
QualType BaseQTy )
static

◆ checkArrayExpressionDoesNotReferToWholeSize()

bool checkArrayExpressionDoesNotReferToWholeSize ( Sema & SemaRef,
const Expr * E,
QualType BaseQTy )
static

Return true if it can be proven that the provided array expression (array section or array subscript) does NOT specify the whole size of the array whose base type is BaseQTy.

Definition at line 24091 of file SemaOpenMP.cpp.

References clang::Expr::EvaluateAsInt(), clang::Sema::getASTContext(), clang::QualType::getTypePtr(), clang::isa(), and clang::Type::isPointerType().

Referenced by checkMapConflicts().

◆ checkCancelRegion()

bool checkCancelRegion ( Sema & SemaRef,
OpenMPDirectiveKind CurrentRegion,
OpenMPDirectiveKind CancelRegion,
SourceLocation StartLoc )
static

◆ checkClausesForDecompositionConflicts()

bool checkClausesForDecompositionConflicts ( Sema & SemaRef,
OpenMPDirectiveKind DKind,
ArrayRef< OMPClause * > Clauses,
Stmt * Body = nullptr )
static

Helper to check all clauses in a directive for structured binding capture conflicts.

Returns true if an error was found. If Body is provided and the directive has default(shared), bindings used in the body but not listed in explicit clauses are treated as implicit shared (by-reference).

Definition at line 4028 of file SemaOpenMP.cpp.

References clang::C, clang::cast(), checkDecompositionCaptureConflict(), and clang::DeclRefExpr::getDecl().

Referenced by clang::SemaOpenMP::ActOnOpenMPParallelDirective(), clang::SemaOpenMP::ActOnOpenMPTargetDirective(), clang::SemaOpenMP::ActOnOpenMPTargetParallelDirective(), clang::SemaOpenMP::ActOnOpenMPTargetParallelForDirective(), clang::SemaOpenMP::ActOnOpenMPTargetParallelForSimdDirective(), clang::SemaOpenMP::ActOnOpenMPTargetParallelGenericLoopDirective(), clang::SemaOpenMP::ActOnOpenMPTargetSimdDirective(), clang::SemaOpenMP::ActOnOpenMPTargetTeamsDirective(), clang::SemaOpenMP::ActOnOpenMPTargetTeamsDistributeDirective(), clang::SemaOpenMP::ActOnOpenMPTargetTeamsDistributeParallelForDirective(), clang::SemaOpenMP::ActOnOpenMPTargetTeamsDistributeParallelForSimdDirective(), clang::SemaOpenMP::ActOnOpenMPTargetTeamsDistributeSimdDirective(), clang::SemaOpenMP::ActOnOpenMPTargetTeamsGenericLoopDirective(), clang::SemaOpenMP::ActOnOpenMPTaskDirective(), clang::SemaOpenMP::ActOnOpenMPTeamsDirective(), clang::SemaOpenMP::ActOnOpenMPTeamsDistributeDirective(), clang::SemaOpenMP::ActOnOpenMPTeamsDistributeParallelForDirective(), clang::SemaOpenMP::ActOnOpenMPTeamsDistributeParallelForSimdDirective(), clang::SemaOpenMP::ActOnOpenMPTeamsDistributeSimdDirective(), and clang::SemaOpenMP::ActOnOpenMPTeamsGenericLoopDirective().

◆ checkDeclInTargetContext()

◆ checkDecompositionCaptureConflict()

bool checkDecompositionCaptureConflict ( Sema & SemaRef,
OpenMPDirectiveKind DKind,
llvm::SmallDenseMap< const DecompositionDecl *, std::pair< bool, SourceLocation >, 4 > & SeenDecompositions,
const ValueDecl * D,
SourceLocation ELoc,
OpenMPClauseKind ClauseKind )
static

Check if bindings from the same structured binding have conflicting capture kinds (by-ref vs by-copy).

Bindings share the underlying DecompositionDecl storage, so mixing by-ref and by-copy clauses on different bindings from the same decomposition is not representable. For example: map(a) creates by-ref, firstprivate(b) creates by-copy.

Definition at line 3980 of file SemaOpenMP.cpp.

References clang::SemaBase::Diag().

Referenced by checkClausesForDecompositionConflicts().

◆ checkGenericLoopLastprivate()

◆ checkIfClauses()

◆ checkMapClauseExpressionBase()

const Expr * checkMapClauseExpressionBase ( Sema & SemaRef,
Expr * E,
OMPClauseMappableExprCommon::MappableExprComponentList & CurComponents,
OpenMPClauseKind CKind,
OpenMPDirectiveKind DKind,
bool NoDiagnose )
static

Return the expression of the base of the mappable expression or null if it cannot be determined and do all the necessary checks to see if the expression is valid as a standalone mappable expression.

In the process, record all the components of the expression.

Definition at line 24608 of file SemaOpenMP.cpp.

References clang::SemaBase::Diag(), clang::Expr::getExprLoc(), clang::Sema::getLangOpts(), clang::ArraySectionExpr::getLength(), clang::Stmt::getSourceRange(), and clang::Expr::IgnoreParens().

Referenced by clang::SemaOpenMP::ActOnOpenMPUseDeviceAddrClause().

◆ checkMapConflicts()

◆ checkMappableExpressionList()

void checkMappableExpressionList ( Sema & SemaRef,
DSAStackTy * DSAS,
OpenMPClauseKind CKind,
MappableVarListInfo & MVLI,
SourceLocation StartLoc,
CXXScopeSpec & MapperIdScopeSpec,
DeclarationNameInfo MapperId,
ArrayRef< Expr * > UnresolvedMappers,
OpenMPMapClauseKind MapType = OMPC_MAP_unknown,
ArrayRef< OpenMPMapModifierKind > Modifiers = {},
bool IsMapTypeImplicit = false,
bool NoDiagnose = false )
static

◆ checkMutuallyExclusiveClauses()

◆ checkNestingOfRegions()

◆ checkOMPAdjustArgsBound()

bool checkOMPAdjustArgsBound ( SemaOpenMP & S,
const OMPAdjustArgsItem::Bound & Bound )
static

Check one bound of a parameter range 'lb:ub' (OpenMP 6.0 [5.2.1]).

A plain bound has the positive property, checked via checkOMPAdjustArgsValue. An 'omp_num_args' bound's logical_offset has the non-negative property instead, so it is checked with a different lower bound.

Definition at line 8333 of file SemaOpenMP.cpp.

References checkOMPAdjustArgsValue(), clang::OMPAdjustArgsItem::Bound::E, clang::OMPAdjustArgsItem::Bound::Expression, Invalid, clang::OMPAdjustArgsItem::Bound::Kind, clang::OMPAdjustArgsItem::Bound::NumArgs, and clang::OMPAdjustArgsItem::Bound::Omitted.

Referenced by checkOMPAdjustArgsRange().

◆ checkOMPAdjustArgsRange()

bool checkOMPAdjustArgsRange ( SemaOpenMP & S,
const OMPAdjustArgsItem & Range )
static

◆ checkOMPAdjustArgsValue()

OMPAdjustArgsVal checkOMPAdjustArgsValue ( SemaOpenMP & S,
Expr * E,
bool StrictlyPositive,
llvm::APSInt & Result )
static

◆ checkOMPArraySectionConstantForReduction()

◆ checkOMPAssumeAttr()

void checkOMPAssumeAttr ( Sema & S,
SourceLocation Loc,
StringRef AssumptionStr )
static

Check if AssumptionStr is a known assumption and warn if not.

Definition at line 28563 of file SemaOpenMP.cpp.

References clang::SemaBase::Diag().

Referenced by clang::SemaOpenMP::handleOMPAssumeAttr().

◆ checkOpenMPIterationSpace()

bool checkOpenMPIterationSpace ( OpenMPDirectiveKind DKind,
Stmt * S,
Sema & SemaRef,
DSAStackTy & DSA,
unsigned CurrentNestedLoopCount,
unsigned NestedLoopCount,
unsigned TotalNestedLoopCount,
Expr * CollapseLoopCountExpr,
Expr * OrderedLoopCountExpr,
SemaOpenMP::VarsWithInheritedDSAType & VarsWithImplicitDSA,
llvm::MutableArrayRef< LoopIterationSpace > ResultIterSpaces,
llvm::MapVector< const Expr *, DeclRefExpr * > & Captures,
const llvm::SmallPtrSetImpl< const Decl * > & CollapsedLoopVarDecls,
llvm::SmallPtrSetImpl< const Decl * > & CollapsedLoopInductionVars )
static

◆ checkOpenMPLoop()

unsigned checkOpenMPLoop ( OpenMPDirectiveKind DKind,
Expr * CollapseLoopCountExpr,
Expr * OrderedLoopCountExpr,
Stmt * AStmt,
Sema & SemaRef,
DSAStackTy & DSA,
SemaOpenMP::VarsWithInheritedDSAType & VarsWithImplicitDSA,
OMPLoopBasedDirective::HelperExprs & Built )
static

Called on a for stmt to check itself and nested loops (if any).

Returns
Returns 0 if one of the collapsed stmts is not canonical for loop, number of collapsed loops otherwise.

Definition at line 10786 of file SemaOpenMP.cpp.

References clang::Sema::ActOnConditionalOp(), clang::Sema::ActOnFinishFullExpr(), clang::Sema::ActOnIntegerConstant(), clang::Sema::AddInitializerToDecl(), appendFlattenedStmtList(), clang::Sema::BuildBinOp(), buildCounterInit(), buildCounterUpdate(), clang::Sema::BuildCStyleCastExpr(), buildDeclRefExpr(), buildPreInits(), buildVarDecl(), clang::C, clang::cast(), checkOpenMPIterationSpace(), clang::Expr::containsErrors(), clang::Sema::Context, clang::Converting, clang::Sema::CurContext, clang::SemaBase::Diag(), clang::Expr::EvaluateAsInt(), clang::ExprError(), fitsInto(), clang::ActionResult< PtrTy, Compress >::get(), clang::Sema::getASTContext(), clang::SourceRange::getBegin(), clang::Stmt::getBeginLoc(), clang::DeclRefExpr::getDecl(), clang::Expr::getExprLoc(), clang::APValue::getInt(), clang::ASTContext::getIntTypeForBitwidth(), clang::Sema::getLangOpts(), clang::CapturedDecl::getNumParams(), clang::CapturedDecl::getParam(), clang::Stmt::getSourceRange(), clang::ASTContext::getTrivialTypeSourceInfo(), clang::Expr::getType(), clang::ValueDecl::getType(), clang::ASTContext::hasSameType(), clang::Type::hasSignedIntegerRepresentation(), clang::Type::hasUnsignedIntegerRepresentation(), clang::Stmt::IgnoreContainers(), clang::Expr::IgnoreImpCasts(), clang::Init, clang::isa(), clang::DeclContext::isDependentContext(), clang::Expr::isInstantiationDependent(), clang::Expr::isIntegerConstantExpr(), clang::isOpenMPCanonicalLoopNestTransformationDirective(), clang::isOpenMPDistributeDirective(), clang::isOpenMPGenericLoopDirective(), clang::isOpenMPLoopBoundSharingDirective(), clang::isOpenMPLoopTransformationDirective(), clang::isOpenMPTaskLoopDirective(), clang::isOpenMPWorksharingDirective(), clang::ActionResult< PtrTy, Compress >::isUsable(), clang::Sema::LangOpts, clang::Loop, clang::DynamicRecursiveASTVisitorBase< IsConst >::TraverseStmt(), clang::Update, clang::Expr::EvalResult::Val, and widenIterationCount().

Referenced by clang::SemaOpenMP::ActOnOpenMPDistributeDirective(), clang::SemaOpenMP::ActOnOpenMPDistributeParallelForDirective(), clang::SemaOpenMP::ActOnOpenMPDistributeParallelForSimdDirective(), clang::SemaOpenMP::ActOnOpenMPDistributeSimdDirective(), clang::SemaOpenMP::ActOnOpenMPForDirective(), clang::SemaOpenMP::ActOnOpenMPForSimdDirective(), clang::SemaOpenMP::ActOnOpenMPGenericLoopDirective(), clang::SemaOpenMP::ActOnOpenMPMaskedTaskLoopDirective(), clang::SemaOpenMP::ActOnOpenMPMaskedTaskLoopSimdDirective(), clang::SemaOpenMP::ActOnOpenMPMasterTaskLoopDirective(), clang::SemaOpenMP::ActOnOpenMPMasterTaskLoopSimdDirective(), clang::SemaOpenMP::ActOnOpenMPParallelForDirective(), clang::SemaOpenMP::ActOnOpenMPParallelForSimdDirective(), clang::SemaOpenMP::ActOnOpenMPParallelGenericLoopDirective(), clang::SemaOpenMP::ActOnOpenMPParallelMaskedTaskLoopDirective(), clang::SemaOpenMP::ActOnOpenMPParallelMaskedTaskLoopSimdDirective(), clang::SemaOpenMP::ActOnOpenMPParallelMasterTaskLoopDirective(), clang::SemaOpenMP::ActOnOpenMPParallelMasterTaskLoopSimdDirective(), clang::SemaOpenMP::ActOnOpenMPSimdDirective(), clang::SemaOpenMP::ActOnOpenMPTargetParallelForDirective(), clang::SemaOpenMP::ActOnOpenMPTargetParallelForSimdDirective(), clang::SemaOpenMP::ActOnOpenMPTargetParallelGenericLoopDirective(), clang::SemaOpenMP::ActOnOpenMPTargetSimdDirective(), clang::SemaOpenMP::ActOnOpenMPTargetTeamsDistributeDirective(), clang::SemaOpenMP::ActOnOpenMPTargetTeamsDistributeParallelForDirective(), clang::SemaOpenMP::ActOnOpenMPTargetTeamsDistributeParallelForSimdDirective(), clang::SemaOpenMP::ActOnOpenMPTargetTeamsDistributeSimdDirective(), clang::SemaOpenMP::ActOnOpenMPTargetTeamsGenericLoopDirective(), clang::SemaOpenMP::ActOnOpenMPTaskLoopDirective(), clang::SemaOpenMP::ActOnOpenMPTaskLoopSimdDirective(), clang::SemaOpenMP::ActOnOpenMPTeamsDistributeDirective(), clang::SemaOpenMP::ActOnOpenMPTeamsDistributeParallelForDirective(), clang::SemaOpenMP::ActOnOpenMPTeamsDistributeParallelForSimdDirective(), clang::SemaOpenMP::ActOnOpenMPTeamsDistributeSimdDirective(), and clang::SemaOpenMP::ActOnOpenMPTeamsGenericLoopDirective().

◆ checkOrderedOrderSpecified()

◆ checkOriginalVarMappedButOnlyBindingsUsed()

◆ checkPreferTypeArgs()

bool checkPreferTypeArgs ( SemaOpenMP & S,
const OMPInteropInfo & Info )
static

◆ checkPreviousOMPAllocateAttribute()

◆ checkReductionClauses()

void checkReductionClauses ( Sema & S,
DSAStackTy * Stack,
ArrayRef< OMPClause * > Clauses )
static

◆ checkReductionClauseWithNogroup()

◆ checkScheduleModifiers()

◆ checkSectionsDirective()

◆ checkSimdlenSafelenSpecified()

bool checkSimdlenSafelenSpecified ( Sema & S,
const ArrayRef< OMPClause * > Clauses )
static

Definition at line 11524 of file SemaOpenMP.cpp.

References clang::cast(), clang::Expr::containsUnexpandedParameterPack(), clang::Sema::Context, clang::SemaBase::Diag(), clang::Expr::EvaluateAsInt(), clang::Expr::getExprLoc(), clang::APValue::getInt(), clang::OMPSafelenClause::getSafelen(), clang::OMPSimdlenClause::getSimdlen(), clang::Stmt::getSourceRange(), clang::Expr::isInstantiationDependent(), clang::Expr::isTypeDependent(), clang::Expr::isValueDependent(), and clang::Expr::EvalResult::Val.

Referenced by clang::SemaOpenMP::ActOnOpenMPDistributeParallelForSimdDirective(), clang::SemaOpenMP::ActOnOpenMPDistributeSimdDirective(), clang::SemaOpenMP::ActOnOpenMPForSimdDirective(), clang::SemaOpenMP::ActOnOpenMPMaskedTaskLoopSimdDirective(), clang::SemaOpenMP::ActOnOpenMPMasterTaskLoopSimdDirective(), clang::SemaOpenMP::ActOnOpenMPParallelForSimdDirective(), clang::SemaOpenMP::ActOnOpenMPParallelMaskedTaskLoopSimdDirective(), clang::SemaOpenMP::ActOnOpenMPParallelMasterTaskLoopSimdDirective(), clang::SemaOpenMP::ActOnOpenMPSimdDirective(), clang::SemaOpenMP::ActOnOpenMPTargetParallelForSimdDirective(), clang::SemaOpenMP::ActOnOpenMPTargetSimdDirective(), clang::SemaOpenMP::ActOnOpenMPTargetTeamsDistributeParallelForSimdDirective(), clang::SemaOpenMP::ActOnOpenMPTargetTeamsDistributeSimdDirective(), clang::SemaOpenMP::ActOnOpenMPTaskLoopSimdDirective(), clang::SemaOpenMP::ActOnOpenMPTeamsDistributeParallelForSimdDirective(), and clang::SemaOpenMP::ActOnOpenMPTeamsDistributeSimdDirective().

◆ checkTypeMappable()

◆ checkValueDeclInTarget()

bool checkValueDeclInTarget ( SourceLocation SL,
SourceRange SR,
Sema & SemaRef,
DSAStackTy * Stack,
ValueDecl * VD )
static

◆ collectLoopStmts()

◆ createTransparentClause()

OMPClause * createTransparentClause ( Sema & SemaRef,
ASTContext & Ctx,
Expr * ImpexTypeArg,
Stmt * HelperValStmt,
OpenMPDirectiveKind CaptureRegion,
SourceLocation StartLoc,
SourceLocation LParenLoc,
SourceLocation EndLoc )
static

◆ filterLookupForUDReductionAndMapper()

template<typename T, typename U>
T filterLookupForUDReductionAndMapper ( SmallVectorImpl< U > & Lookups,
const llvm::function_ref< T(ValueDecl *)> Gen )
static

◆ findAcceptableDecl()

NamedDecl * findAcceptableDecl ( Sema & SemaRef,
NamedDecl * D )
static

◆ findOMPAllocatorHandleT()

◆ findOMPAlloctraitT()

◆ findOMPDependT()

◆ findOMPEventHandleT()

◆ finishLinearClauses()

bool finishLinearClauses ( Sema & SemaRef,
ArrayRef< OMPClause * > Clauses,
OMPLoopBasedDirective::HelperExprs & B,
DSAStackTy * Stack )
static

◆ FinishOpenMPLinearClause()

◆ fitsInto()

bool fitsInto ( unsigned Bits,
bool Signed,
const Expr * E,
Sema & SemaRef )
static

Check if the given expression E is a constant integer that fits into Bits bits.

Definition at line 10666 of file SemaOpenMP.cpp.

References clang::Sema::Context, clang::Expr::getIntegerConstantExpr(), and clang::Signed.

Referenced by clang::SemaOpenMP::ActOnOpenMPFlattenDirective(), and checkOpenMPLoop().

◆ getAllocatorKind()

◆ getCanonicalDecl() [1/2]

const ValueDecl * getCanonicalDecl ( const ValueDecl * D)
static

Definition at line 1326 of file SemaOpenMP.cpp.

References clang::cast(), clang::Decl::getCanonicalDecl(), and getExprAsWritten().

Referenced by getCanonicalDecl().

◆ getCanonicalDecl() [2/2]

ValueDecl * getCanonicalDecl ( ValueDecl * D)
static

Definition at line 1335 of file SemaOpenMP.cpp.

References getCanonicalDecl().

◆ getCollapseNumberExpr()

Expr * getCollapseNumberExpr ( ArrayRef< OMPClause * > Clauses)
static

Definition at line 11508 of file SemaOpenMP.cpp.

Referenced by clang::SemaOpenMP::ActOnOpenMPDistributeDirective(), clang::SemaOpenMP::ActOnOpenMPDistributeParallelForDirective(), clang::SemaOpenMP::ActOnOpenMPDistributeParallelForSimdDirective(), clang::SemaOpenMP::ActOnOpenMPDistributeSimdDirective(), clang::SemaOpenMP::ActOnOpenMPForDirective(), clang::SemaOpenMP::ActOnOpenMPForSimdDirective(), clang::SemaOpenMP::ActOnOpenMPGenericLoopDirective(), clang::SemaOpenMP::ActOnOpenMPMaskedTaskLoopDirective(), clang::SemaOpenMP::ActOnOpenMPMaskedTaskLoopSimdDirective(), clang::SemaOpenMP::ActOnOpenMPMasterTaskLoopDirective(), clang::SemaOpenMP::ActOnOpenMPMasterTaskLoopSimdDirective(), clang::SemaOpenMP::ActOnOpenMPParallelForDirective(), clang::SemaOpenMP::ActOnOpenMPParallelForSimdDirective(), clang::SemaOpenMP::ActOnOpenMPParallelGenericLoopDirective(), clang::SemaOpenMP::ActOnOpenMPParallelMaskedTaskLoopDirective(), clang::SemaOpenMP::ActOnOpenMPParallelMaskedTaskLoopSimdDirective(), clang::SemaOpenMP::ActOnOpenMPParallelMasterTaskLoopDirective(), clang::SemaOpenMP::ActOnOpenMPParallelMasterTaskLoopSimdDirective(), clang::SemaOpenMP::ActOnOpenMPSimdDirective(), clang::SemaOpenMP::ActOnOpenMPTargetParallelForDirective(), clang::SemaOpenMP::ActOnOpenMPTargetParallelForSimdDirective(), clang::SemaOpenMP::ActOnOpenMPTargetParallelGenericLoopDirective(), clang::SemaOpenMP::ActOnOpenMPTargetSimdDirective(), clang::SemaOpenMP::ActOnOpenMPTargetTeamsDistributeDirective(), clang::SemaOpenMP::ActOnOpenMPTargetTeamsDistributeParallelForDirective(), clang::SemaOpenMP::ActOnOpenMPTargetTeamsDistributeParallelForSimdDirective(), clang::SemaOpenMP::ActOnOpenMPTargetTeamsDistributeSimdDirective(), clang::SemaOpenMP::ActOnOpenMPTargetTeamsGenericLoopDirective(), clang::SemaOpenMP::ActOnOpenMPTaskLoopDirective(), clang::SemaOpenMP::ActOnOpenMPTaskLoopSimdDirective(), clang::SemaOpenMP::ActOnOpenMPTeamsDistributeDirective(), clang::SemaOpenMP::ActOnOpenMPTeamsDistributeParallelForDirective(), clang::SemaOpenMP::ActOnOpenMPTeamsDistributeParallelForSimdDirective(), clang::SemaOpenMP::ActOnOpenMPTeamsDistributeSimdDirective(), and clang::SemaOpenMP::ActOnOpenMPTeamsGenericLoopDirective().

◆ getDirectCallExpr()

Expr * getDirectCallExpr ( Expr * E)
static

◆ getExprAsWritten() [1/2]

const Expr * getExprAsWritten ( const Expr * E)
static

Definition at line 1307 of file SemaOpenMP.cpp.

References clang::Expr::IgnoreParens().

Referenced by getCanonicalDecl(), and getExprAsWritten().

◆ getExprAsWritten() [2/2]

Expr * getExprAsWritten ( Expr * E)
static

Definition at line 1322 of file SemaOpenMP.cpp.

References getExprAsWritten().

◆ getIntTypeForBitwidthOrBitInt()

QualType getIntTypeForBitwidthOrBitInt ( ASTContext & C,
unsigned Bits,
bool Signed )
static

Like ASTContext::getIntTypeForBitwidth, but falls back to a _BitInt type when no standard integer type has the requested width.

Definition at line 6027 of file SemaOpenMP.cpp.

References clang::C, clang::QualType::isNull(), and clang::Signed.

Referenced by clang::SemaOpenMP::ActOnOpenMPCanonicalLoop(), and clang::SemaOpenMP::ActOnOpenMPFlattenDirective().

◆ getListOfPossibleValues()

◆ getMapClauseKindFromModifier()

OpenMPMapClauseKind getMapClauseKindFromModifier ( OpenMPDefaultmapClauseModifier M,
bool IsAggregateOrDeclareTarget,
bool HasConstQualifier )
static

◆ getOMPAdjustArgsItemLoc()

◆ getOpenMPCaptureRegionForClause()

◆ getOpenMPClauseNameForDiag()

std::string getOpenMPClauseNameForDiag ( OpenMPClauseKind C)
static

Definition at line 1340 of file SemaOpenMP.cpp.

References clang::C.

Referenced by actOnOMPReductionKindClause(), clang::SemaOpenMP::ActOnOpenMPAlignedClause(), clang::SemaOpenMP::ActOnOpenMPAtClause(), clang::SemaOpenMP::ActOnOpenMPAtomicDefaultMemOrderClause(), clang::SemaOpenMP::ActOnOpenMPAtomicDirective(), clang::SemaOpenMP::ActOnOpenMPBindClause(), clang::SemaOpenMP::ActOnOpenMPCopyinClause(), clang::SemaOpenMP::ActOnOpenMPCopyprivateClause(), clang::SemaOpenMP::ActOnOpenMPDeclareSimdDirective(), clang::SemaOpenMP::ActOnOpenMPDeclareVariantDirective(), clang::SemaOpenMP::ActOnOpenMPDefaultClause(), clang::SemaOpenMP::ActOnOpenMPDefaultmapClause(), clang::SemaOpenMP::ActOnOpenMPDependClause(), clang::SemaOpenMP::ActOnOpenMPDestroyClause(), clang::SemaOpenMP::ActOnOpenMPDetachClause(), clang::SemaOpenMP::ActOnOpenMPDeviceClause(), clang::SemaOpenMP::ActOnOpenMPDistScheduleClause(), clang::SemaOpenMP::ActOnOpenMPDoacrossClause(), clang::SemaOpenMP::ActOnOpenMPErrorDirective(), clang::SemaOpenMP::ActOnOpenMPFirstprivateClause(), clang::SemaOpenMP::ActOnOpenMPFlushDirective(), clang::SemaOpenMP::ActOnOpenMPGrainsizeClause(), clang::SemaOpenMP::ActOnOpenMPHasDeviceAddrClause(), clang::SemaOpenMP::ActOnOpenMPIsDevicePtrClause(), clang::SemaOpenMP::ActOnOpenMPLastprivateClause(), clang::SemaOpenMP::ActOnOpenMPLinearClause(), clang::SemaOpenMP::ActOnOpenMPLoopInitialization(), clang::SemaOpenMP::ActOnOpenMPMessageClause(), clang::SemaOpenMP::ActOnOpenMPNontemporalClause(), clang::SemaOpenMP::ActOnOpenMPNumTasksClause(), clang::SemaOpenMP::ActOnOpenMPOrderClause(), clang::SemaOpenMP::ActOnOpenMPOrderedDirective(), clang::SemaOpenMP::ActOnOpenMPPrivateClause(), clang::SemaOpenMP::ActOnOpenMPProcBindClause(), clang::SemaOpenMP::ActOnOpenMPReductionClause(), clang::SemaOpenMP::ActOnOpenMPRegionEnd(), clang::SemaOpenMP::ActOnOpenMPScheduleClause(), clang::SemaOpenMP::ActOnOpenMPSeverityClause(), clang::SemaOpenMP::ActOnOpenMPSharedClause(), clang::SemaOpenMP::ActOnOpenMPUpdateDependObjectsClause(), checkIfClauses(), checkMutuallyExclusiveClauses(), checkOMPAdjustArgsValue(), clang::SemaOpenMP::CheckOMPRequiresDecl(), checkOrderedOrderSpecified(), checkScheduleModifiers(), isNonNegativeIntegerValue(), rejectConstNotMutableType(), reportOriginalDsa(), and clang::SemaOpenMP::VerifyPositiveIntegerConstantInClause().

◆ getOrderedNumberExpr()

◆ getParallelRegionParams()

SmallVector< SemaOpenMP::CapturedParamNameType > getParallelRegionParams ( Sema & SemaRef,
bool LoopBoundSharing )
static

◆ getPrivateItem()

std::pair< ValueDecl *, bool > getPrivateItem ( Sema & S,
Expr *& RefExpr,
SourceLocation & ELoc,
SourceRange & ERange,
bool AllowArraySection = false,
bool AllowAssumedSizeArray = false,
StringRef DiagType = "" )
static

Definition at line 5774 of file SemaOpenMP.cpp.

References clang::ArraySubscript, clang::Expr::containsUnexpandedParameterPack(), clang::SemaBase::Diag(), clang::ArraySectionExpr::getBaseOriginalType(), getCanonicalDecl(), clang::Sema::getCurrentThisType(), clang::Expr::getExprLoc(), clang::Sema::getLangOpts(), clang::Stmt::getSourceRange(), clang::Expr::IgnoreParenImpCasts(), clang::Expr::IgnoreParens(), clang::isa(), clang::QualType::isNull(), clang::Expr::isTypeDependent(), and clang::Expr::isValueDependent().

Referenced by actOnOMPReductionKindClause(), clang::SemaOpenMP::ActOnOpenMPAlignedClause(), clang::SemaOpenMP::ActOnOpenMPAllocateClause(), clang::SemaOpenMP::ActOnOpenMPCopyprivateClause(), clang::SemaOpenMP::ActOnOpenMPExclusiveClause(), clang::SemaOpenMP::ActOnOpenMPFirstprivateClause(), clang::SemaOpenMP::ActOnOpenMPHasDeviceAddrClause(), clang::SemaOpenMP::ActOnOpenMPInclusiveClause(), clang::SemaOpenMP::ActOnOpenMPInteropDirective(), clang::SemaOpenMP::ActOnOpenMPIsDevicePtrClause(), clang::SemaOpenMP::ActOnOpenMPLastprivateClause(), clang::SemaOpenMP::ActOnOpenMPLinearClause(), clang::SemaOpenMP::ActOnOpenMPNontemporalClause(), clang::SemaOpenMP::ActOnOpenMPPrivateClause(), clang::SemaOpenMP::ActOnOpenMPSharedClause(), clang::SemaOpenMP::ActOnOpenMPUseDeviceAddrClause(), clang::SemaOpenMP::ActOnOpenMPUseDevicePtrClause(), checkAllocateClauses(), checkGenericLoopLastprivate(), checkReductionClauses(), clang::SemaOpenMP::EndOpenMPDSABlock(), FinishOpenMPLinearClause(), getDistributeLastprivateVars(), getTeamsReductionVars(), isValidInteropVariable(), and ProcessOpenMPDoacrossClauseCommon().

◆ getRelatedCompoundReductionOp()

BinaryOperatorKind getRelatedCompoundReductionOp ( BinaryOperatorKind BOK)
static

Definition at line 22109 of file SemaOpenMP.cpp.

Referenced by actOnOMPReductionKindClause().

◆ getTargetRegionParams()

◆ getTaskloopRegionParams()

◆ getTaskRegionParams()

◆ getTeamsRegionParams()

SmallVector< SemaOpenMP::CapturedParamNameType > getTeamsRegionParams ( Sema & SemaRef)
static

Definition at line 4852 of file SemaOpenMP.cpp.

References getParallelRegionParams().

Referenced by processCapturedRegions().

◆ getUnknownRegionParams()

SmallVector< SemaOpenMP::CapturedParamNameType > getUnknownRegionParams ( Sema & SemaRef)
static

Definition at line 4894 of file SemaOpenMP.cpp.

Referenced by processCapturedRegions().

◆ getVariableCategoryFromDecl()

◆ handleDeclareVariantConstructTrait()

◆ hasClauses() [1/2]

◆ hasClauses() [2/2]

template<typename... Params>
bool hasClauses ( ArrayRef< OMPClause * > Clauses,
const OpenMPClauseKind K,
const Params... ClauseTypes )
static

Definition at line 14427 of file SemaOpenMP.cpp.

References hasClauses().

◆ hasConstQualifiedMappingType()

bool hasConstQualifiedMappingType ( QualType T)
static

Definition at line 4224 of file SemaOpenMP.cpp.

References hasNoMutableFields(), and clang::T.

Referenced by clang::SemaOpenMP::ActOnOpenMPMapClause().

◆ hasNoMutableFields()

◆ hasUserDefinedMapper()

◆ isClauseMappable()

bool isClauseMappable ( ArrayRef< OMPClause * > Clauses)
static

Check if the variables in the mapping clause are externally visible.

Definition at line 14433 of file SemaOpenMP.cpp.

References clang::C.

Referenced by clang::SemaOpenMP::ActOnOpenMPTargetUpdateDirective().

◆ isConstNotMutableType()

◆ isImplicitMapperNeeded()

◆ isNonNegativeIntegerValue()

bool isNonNegativeIntegerValue ( Expr *& ValExpr,
Sema & SemaRef,
OpenMPClauseKind CKind,
bool StrictlyPositive,
bool BuildCapture = false,
OpenMPDirectiveKind DKind = OMPD_unknown,
OpenMPDirectiveKind * CaptureRegion = nullptr,
Stmt ** HelperValStmt = nullptr )
static

◆ isOpenMPDeviceDelayedContext()

bool isOpenMPDeviceDelayedContext ( Sema & S)
static

◆ isValidInteropVariable()

◆ makeFloorIVRef()

Expr * makeFloorIVRef ( Sema & SemaRef,
ArrayRef< VarDecl * > FloorIndVars,
int I,
QualType IVTy,
DeclRefExpr * OrigCntVar )
static

Build and return a DeclRefExpr for the floor induction variable using the SemaRef and the provided parameters.

Definition at line 15937 of file SemaOpenMP.cpp.

References buildDeclRefExpr(), and clang::Expr::getExprLoc().

Referenced by clang::SemaOpenMP::ActOnOpenMPStripeDirective(), and clang::SemaOpenMP::ActOnOpenMPTileDirective().

◆ precomputeExpr()

◆ processCapturedRegions()

◆ processImplicitMapsWithDefaultMappers()

void processImplicitMapsWithDefaultMappers ( Sema & S,
DSAStackTy * Stack,
SmallVectorImpl< OMPClause * > & Clauses )
static

Perform DFS through the structure/class data members trying to find member(s) with user-defined 'default' mapper and generate implicit map clauses for such members with the found 'default' mapper.

Definition at line 6444 of file SemaOpenMP.cpp.

References clang::SemaOpenMP::ActOnOpenMPMapClause(), clang::Sema::BuildMemberExpr(), buildUserDefinedMapperRef(), clang::C, clang::cast(), clang::Expr::containsUnexpandedParameterPack(), clang::Sema::Context, clang::ASTContext::DeclarationNames, clang::Sema::DefaultLvalueConversion(), clang::RecordDecl::fields(), clang::ActionResult< PtrTy, Compress >::get(), clang::IdentifierTable::get(), clang::Decl::getAccess(), clang::ArraySectionExpr::getBaseOriginalType(), clang::QualType::getCanonicalType(), clang::Expr::getExprLoc(), clang::DeclarationNameTable::getIdentifier(), clang::Sema::getLangOpts(), clang::Type::getPointeeType(), clang::Expr::getType(), clang::ValueDecl::getType(), clang::ASTContext::Idents, clang::Expr::IgnoreParenImpCasts(), clang::ActionResult< PtrTy, Compress >::isInvalid(), clang::QualType::isNull(), clang::Type::isSpecificBuiltinType(), clang::Type::isStructureOrClassType(), clang::Expr::isTypeDependent(), clang::Type::isUnionType(), clang::Expr::isValueDependent(), clang::DeclAccessPair::make(), clang::OK_Ordinary, clang::Sema::OpenMP(), clang::OpaqueValueExpr::setIsUnique(), clang::DeclarationNameInfo::setLoc(), clang::DeclarationNameInfo::setName(), and clang::VK_LValue.

Referenced by clang::SemaOpenMP::ActOnOpenMPDeclareMapperDirective(), and clang::SemaOpenMP::ActOnOpenMPExecutableDirective().

◆ ProcessOpenMPDoacrossClauseCommon()

◆ rejectConstNotMutableType()

◆ reportOriginalDsa()

◆ setBranchProtectedScope()

CapturedStmt * setBranchProtectedScope ( Sema & SemaRef,
OpenMPDirectiveKind DKind,
Stmt * AStmt )
static

Definition at line 8548 of file SemaOpenMP.cpp.

References clang::cast(), clang::CapturedStmt::getCapturedDecl(), clang::CapturedStmt::getCapturedStmt(), clang::SemaOpenMP::getOpenMPCaptureLevels(), clang::Sema::OpenMP(), clang::Sema::setFunctionHasBranchProtectedScope(), and clang::CapturedDecl::setNothrow().

Referenced by clang::SemaOpenMP::ActOnOpenMPDistributeParallelForDirective(), clang::SemaOpenMP::ActOnOpenMPDistributeParallelForSimdDirective(), clang::SemaOpenMP::ActOnOpenMPDistributeSimdDirective(), clang::SemaOpenMP::ActOnOpenMPForSimdDirective(), clang::SemaOpenMP::ActOnOpenMPGenericLoopDirective(), clang::SemaOpenMP::ActOnOpenMPMaskedTaskLoopSimdDirective(), clang::SemaOpenMP::ActOnOpenMPMasterTaskLoopSimdDirective(), clang::SemaOpenMP::ActOnOpenMPParallelDirective(), clang::SemaOpenMP::ActOnOpenMPParallelForDirective(), clang::SemaOpenMP::ActOnOpenMPParallelForSimdDirective(), clang::SemaOpenMP::ActOnOpenMPParallelGenericLoopDirective(), clang::SemaOpenMP::ActOnOpenMPParallelMaskedDirective(), clang::SemaOpenMP::ActOnOpenMPParallelMaskedTaskLoopDirective(), clang::SemaOpenMP::ActOnOpenMPParallelMaskedTaskLoopSimdDirective(), clang::SemaOpenMP::ActOnOpenMPParallelMasterDirective(), clang::SemaOpenMP::ActOnOpenMPParallelMasterTaskLoopDirective(), clang::SemaOpenMP::ActOnOpenMPParallelMasterTaskLoopSimdDirective(), clang::SemaOpenMP::ActOnOpenMPSimdDirective(), clang::SemaOpenMP::ActOnOpenMPTargetDirective(), clang::SemaOpenMP::ActOnOpenMPTargetEnterDataDirective(), clang::SemaOpenMP::ActOnOpenMPTargetExitDataDirective(), clang::SemaOpenMP::ActOnOpenMPTargetParallelDirective(), clang::SemaOpenMP::ActOnOpenMPTargetParallelForDirective(), clang::SemaOpenMP::ActOnOpenMPTargetParallelForSimdDirective(), clang::SemaOpenMP::ActOnOpenMPTargetParallelGenericLoopDirective(), clang::SemaOpenMP::ActOnOpenMPTargetSimdDirective(), clang::SemaOpenMP::ActOnOpenMPTargetTeamsDirective(), clang::SemaOpenMP::ActOnOpenMPTargetTeamsDistributeDirective(), clang::SemaOpenMP::ActOnOpenMPTargetTeamsDistributeParallelForDirective(), clang::SemaOpenMP::ActOnOpenMPTargetTeamsDistributeParallelForSimdDirective(), clang::SemaOpenMP::ActOnOpenMPTargetTeamsDistributeSimdDirective(), clang::SemaOpenMP::ActOnOpenMPTargetTeamsGenericLoopDirective(), clang::SemaOpenMP::ActOnOpenMPTargetUpdateDirective(), clang::SemaOpenMP::ActOnOpenMPTaskDirective(), clang::SemaOpenMP::ActOnOpenMPTaskLoopSimdDirective(), clang::SemaOpenMP::ActOnOpenMPTeamsDirective(), clang::SemaOpenMP::ActOnOpenMPTeamsDistributeDirective(), clang::SemaOpenMP::ActOnOpenMPTeamsDistributeParallelForDirective(), clang::SemaOpenMP::ActOnOpenMPTeamsDistributeParallelForSimdDirective(), clang::SemaOpenMP::ActOnOpenMPTeamsDistributeSimdDirective(), and clang::SemaOpenMP::ActOnOpenMPTeamsGenericLoopDirective().

◆ setPrototype()

◆ teamsLoopCanBeParallelFor()

bool teamsLoopCanBeParallelFor ( Stmt * AStmt,
Sema & SemaRef )
static

◆ updatePreInits()

void updatePreInits ( OMPLoopTransformationDirective * Transform,
SmallVectorImpl< Stmt * > & PreInits )
static

Updates OriginalInits by checking Transform against loop transformation directives and appending their pre-inits if a match is found.

Definition at line 15537 of file SemaOpenMP.cpp.

References OMPLoopTransformationDirective::getDirective(), and clang::Stmt::getStmtClass().

◆ validateMultidimClauseExprs() [1/2]

template<typename ClauseT>
bool validateMultidimClauseExprs ( SemaBase & SemaRef,
const ClauseT * Clause,
const OMPXBareClause * BareClause )
static

Check the number of expressions specified in a multidimensional clause and return whether an error was encountered.

Definition at line 11873 of file SemaOpenMP.cpp.

References validateMultidimClauseExprs().

◆ validateMultidimClauseExprs() [2/2]

bool validateMultidimClauseExprs ( SemaBase & SemaRef,
OpenMPClauseKind ClauseKind,
SourceLocation ClauseBeginLoc,
ArrayRef< const Expr * > ClauseVarList,
const Expr * DimsModifierExpr,
const OMPXBareClause * BareClause = nullptr )
static

Check the number of expressions specified in a multidimensional clause and return whether an error was encountered.

Definition at line 11828 of file SemaOpenMP.cpp.

References clang::SemaBase::Diag(), clang::Expr::EvaluateKnownConstInt(), clang::SemaBase::getASTContext(), and clang::Expr::isInstantiationDependent().

Referenced by clang::SemaOpenMP::ActOnOpenMPNumThreadsClause(), validateMultidimClauseExprs(), and validateMultidimClauses().

◆ validateMultidimClauses()

bool validateMultidimClauses ( SemaBase & SemaRef,
ArrayRef< OMPClause * > Clauses,
bool MayHaveBareClause = false )
static

◆ widenIterationCount()

ExprResult widenIterationCount ( unsigned Bits,
Expr * E,
Sema & SemaRef )
static

Convert integer expression E to make it have at least Bits bits.

Definition at line 10650 of file SemaOpenMP.cpp.

References clang::C, clang::Sema::Context, clang::Converting, clang::ExprError(), clang::Expr::getType(), and clang::Sema::PerformImplicitConversion().

Referenced by clang::SemaOpenMP::ActOnOpenMPFlattenDirective(), and checkOpenMPLoop().