clang  12.0.0git
Classes | Macros | Enumerations | Functions
SemaOpenMP.cpp File Reference

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

#include "TreeTransform.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/ASTMutationListener.h"
#include "clang/AST/CXXInheritance.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/DeclOpenMP.h"
#include "clang/AST/OpenMPClause.h"
#include "clang/AST/StmtCXX.h"
#include "clang/AST/StmtOpenMP.h"
#include "clang/AST/StmtVisitor.h"
#include "clang/AST/TypeOrdering.h"
#include "clang/Basic/DiagnosticSema.h"
#include "clang/Basic/OpenMPKinds.h"
#include "clang/Basic/PartialDiagnostic.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/Sema/Initialization.h"
#include "clang/Sema/Lookup.h"
#include "clang/Sema/Scope.h"
#include "clang/Sema/ScopeInfo.h"
#include "clang/Sema/SemaInternal.h"
#include "llvm/ADT/IndexedMap.h"
#include "llvm/ADT/PointerEmbeddedInt.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Frontend/OpenMP/OMPConstants.h"
#include <set>
Include dependency graph for SemaOpenMP.cpp:

Go to the source code of this file.

Classes

struct  Kind2Unsigned
 

Macros

#define DSAStack   static_cast<DSAStackTy *>(VarDataSharingAttributesStack)
 

Enumerations

enum  DefaultDataSharingAttributes
 Default data sharing attributes, which can be applied to directive. More...
 
enum  FunctionEmissionStatus
 Status of the function emission on the host/device. More...
 

Functions

static const ExprcheckMapClauseExpressionBase (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. More...
 
static const ExprgetExprAsWritten (const Expr *E)
 
static ExprgetExprAsWritten (Expr *E)
 
static const ValueDeclgetCanonicalDecl (const ValueDecl *D)
 
static ValueDeclgetCanonicalDecl (ValueDecl *D)
 
static VarDeclbuildVarDecl (Sema &SemaRef, SourceLocation Loc, QualType Type, StringRef Name, const AttrVec *Attrs=nullptr, DeclRefExpr *OrigRef=nullptr)
 Build a variable declaration for OpenMP loop iteration variable. More...
 
static DeclRefExprbuildDeclRefExpr (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 std::pair< ValueDecl *, boolgetPrivateItem (Sema &S, Expr *&RefExpr, SourceLocation &ELoc, SourceRange &ERange, bool AllowArraySection=false)
 
static void checkReductionClauses (Sema &S, DSAStackTy *Stack, ArrayRef< OMPClause * > Clauses)
 Check consistency of the reduction clauses. More...
 
static void checkAllocateClauses (Sema &S, DSAStackTy *Stack, ArrayRef< OMPClause * > Clauses)
 
static DeclRefExprbuildCapture (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 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, SourceRange SR)
 
static OpenMPMapClauseKind getMapClauseKindFromModifier (OpenMPDefaultmapClauseModifier M, bool IsAggregateOrDeclareTarget)
 
static OMPCapturedExprDeclbuildCaptureDecl (Sema &S, IdentifierInfo *Id, Expr *CaptureExpr, bool WithInit, bool AsExpression)
 
static ExprResult buildCapture (Sema &S, Expr *CaptureExpr, DeclRefExpr *&Ref)
 
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, SourceLocation StartLoc)
 
static bool checkIfClauses (Sema &S, OpenMPDirectiveKind Kind, ArrayRef< OMPClause * > Clauses, ArrayRef< OpenMPDirectiveKind > AllowedNameModifiers)
 
static void setPrototype (Sema &S, FunctionDecl *FD, FunctionDecl *FDWithProto, QualType NewType)
 
static bool checkOpenMPIterationSpace (OpenMPDirectiveKind DKind, Stmt *S, Sema &SemaRef, DSAStackTy &DSA, unsigned CurrentNestedLoopCount, unsigned NestedLoopCount, unsigned TotalNestedLoopCount, Expr *CollapseLoopCountExpr, Expr *OrderedLoopCountExpr, Sema::VarsWithInheritedDSAType &VarsWithImplicitDSA, llvm::MutableArrayRef< LoopIterationSpace > ResultIterSpaces, llvm::MapVector< const Expr *, DeclRefExpr * > &Captures)
 Called on a for stmt to check and extract its iteration space for further processing (such as collapsing). More...
 
static ExprResult buildCounterInit (Sema &SemaRef, Scope *S, SourceLocation Loc, ExprResult VarRef, ExprResult Start, bool IsNonRectangularLB, llvm::MapVector< const Expr *, DeclRefExpr * > &Captures)
 Build 'VarRef = Start. More...
 
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'. More...
 
static ExprResult widenIterationCount (unsigned Bits, Expr *E, Sema &SemaRef)
 Convert integer expression E to make it have at least Bits bits. More...
 
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. More...
 
static StmtbuildPreInits (ASTContext &Context, MutableArrayRef< Decl * > PreInits)
 Build preinits statement for the given declarations. More...
 
static StmtbuildPreInits (ASTContext &Context, const llvm::MapVector< const Expr *, DeclRefExpr * > &Captures)
 Build preinits statement for the given declarations. More...
 
static ExprbuildPostUpdate (Sema &S, ArrayRef< Expr * > PostUpdates)
 Build postupdate expression for the given list of postupdates expressions. More...
 
static unsigned checkOpenMPLoop (OpenMPDirectiveKind DKind, Expr *CollapseLoopCountExpr, Expr *OrderedLoopCountExpr, Stmt *AStmt, Sema &SemaRef, DSAStackTy &DSA, Sema::VarsWithInheritedDSAType &VarsWithImplicitDSA, OMPLoopDirective::HelperExprs &Built)
 Called on a for stmt to check itself and nested loops (if any). More...
 
static ExprgetCollapseNumberExpr (ArrayRef< OMPClause * > Clauses)
 
static ExprgetOrderedNumberExpr (ArrayRef< OMPClause * > Clauses)
 
static bool checkSimdlenSafelenSpecified (Sema &S, const ArrayRef< OMPClause * > Clauses)
 
static bool checkDetachMergeableClauses (Sema &S, ArrayRef< OMPClause * > Clauses)
 detach and mergeable clauses are mutially exclusive, check for it. More...
 
static bool hasClauses (ArrayRef< OMPClause * > Clauses, const OpenMPClauseKind K)
 Check for existence of a map clause in the list of clauses. More...
 
template<typename... Params>
static bool hasClauses (ArrayRef< OMPClause * > Clauses, const OpenMPClauseKind K, const Params... ClauseTypes)
 
static bool checkGrainsizeNumTasksClauses (Sema &S, ArrayRef< OMPClause * > Clauses)
 
static bool checkReductionClauseWithNogroup (Sema &S, ArrayRef< OMPClause * > Clauses)
 
static OpenMPDirectiveKind getOpenMPCaptureRegionForClause (OpenMPDirectiveKind DKind, OpenMPClauseKind CKind, unsigned OpenMPVersion, 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 bool findOMPAllocatorHandleT (Sema &S, SourceLocation Loc, DSAStackTy *Stack)
 Tries to find omp_allocator_handle_t type. More...
 
static std::string getListOfPossibleValues (OpenMPClauseKind K, unsigned First, unsigned Last, ArrayRef< unsigned > Exclude=llvm::None)
 
static bool checkScheduleModifiers (Sema &S, OpenMPScheduleClauseModifier M1, OpenMPScheduleClauseModifier M2, SourceLocation M1Loc, SourceLocation M2Loc)
 
template<typename T , typename U >
static T filterLookupForUDReductionAndMapper (SmallVectorImpl< U > &Lookups, const llvm::function_ref< T(ValueDecl *)> Gen)
 
static NamedDeclfindAcceptableDecl (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 OMPArraySectionExpr *OASE, bool &SingleElement, SmallVectorImpl< llvm::APSInt > &ArraySizes)
 
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. More...
 
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. More...
 
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 ExprResult buildUserDefinedMapperRef (Sema &SemaRef, Scope *S, CXXScopeSpec &MapperIdScopeSpec, const DeclarationNameInfo &MapperId, QualType Type, Expr *UnresolvedMapper)
 
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, bool IsMapTypeImplicit=false)
 
static bool findOMPEventHandleT (Sema &S, SourceLocation Loc, DSAStackTy *Stack)
 Tries to find omp_event_handle_t type. More...
 
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. More...
 

Detailed Description

This file implements semantic analysis for OpenMP directives and clauses.

Definition in file SemaOpenMP.cpp.

Macro Definition Documentation

◆ DSAStack

#define DSAStack   static_cast<DSAStackTy *>(VarDataSharingAttributesStack)

Definition at line 1874 of file SemaOpenMP.cpp.

Enumeration Type Documentation

◆ DefaultDataSharingAttributes

Default data sharing attributes, which can be applied to directive.

Definition at line 56 of file SemaOpenMP.cpp.

◆ FunctionEmissionStatus

Status of the function emission on the host/device.

Definition at line 1893 of file SemaOpenMP.cpp.

Function Documentation

◆ actOnOMPReductionKindClause()

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

◆ applyOMPAllocateAttribute()

static void applyOMPAllocateAttribute ( Sema S,
VarDecl VD,
OMPAllocateDeclAttr::AllocatorTypeTy  AllocatorKind,
Expr Allocator,
SourceRange  SR 
)
static

Definition at line 3098 of file SemaOpenMP.cpp.

◆ argumentDependentLookup()

static void argumentDependentLookup ( Sema SemaRef,
const DeclarationNameInfo Id,
SourceLocation  Loc,
QualType  Ty,
SmallVectorImpl< UnresolvedSet< 8 >> &  Lookups 
)
static

◆ buildCapture() [1/2]

static DeclRefExpr * buildCapture ( Sema S,
ValueDecl D,
Expr CaptureExpr,
bool  WithInit 
)
static

◆ buildCapture() [2/2]

static ExprResult buildCapture ( Sema S,
Expr CaptureExpr,
DeclRefExpr *&  Ref 
)
static

Definition at line 4308 of file SemaOpenMP.cpp.

◆ buildCaptureDecl()

static OMPCapturedExprDecl* buildCaptureDecl ( Sema S,
IdentifierInfo Id,
Expr CaptureExpr,
bool  WithInit,
bool  AsExpression 
)
static

Definition at line 4266 of file SemaOpenMP.cpp.

◆ buildCounterInit()

static ExprResult buildCounterInit ( Sema SemaRef,
Scope S,
SourceLocation  Loc,
ExprResult  VarRef,
ExprResult  Start,
bool  IsNonRectangularLB,
llvm::MapVector< const Expr *, DeclRefExpr * > &  Captures 
)
static

Build 'VarRef = Start.

Definition at line 8120 of file SemaOpenMP.cpp.

Referenced by checkOpenMPLoop().

◆ buildCounterUpdate()

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 
)
static

Build 'VarRef = Start + Iter * Step'.

Definition at line 8144 of file SemaOpenMP.cpp.

Referenced by checkOpenMPLoop().

◆ buildDeclareReductionRef()

static 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 14813 of file SemaOpenMP.cpp.

◆ buildDeclRefExpr()

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

◆ buildPostUpdate()

static Expr* buildPostUpdate ( Sema S,
ArrayRef< Expr * >  PostUpdates 
)
static

◆ buildPreInits() [1/2]

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

◆ buildPreInits() [2/2]

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

Build preinits statement for the given declarations.

Definition at line 8258 of file SemaOpenMP.cpp.

◆ buildUserDefinedMapperRef()

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

Definition at line 17533 of file SemaOpenMP.cpp.

Referenced by checkMappableExpressionList().

◆ buildVarDecl()

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

◆ checkAllocateClauses()

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

Definition at line 5014 of file SemaOpenMP.cpp.

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

◆ checkArrayExpressionDoesNotReferToUnitySize()

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

◆ checkArrayExpressionDoesNotReferToWholeSize()

static 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 16825 of file SemaOpenMP.cpp.

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

Referenced by checkMapConflicts().

◆ checkCancelRegion()

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

Definition at line 4578 of file SemaOpenMP.cpp.

References clang::Sema::Diag().

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

◆ checkDeclInTargetContext()

static void checkDeclInTargetContext ( SourceLocation  SL,
SourceRange  SR,
Sema SemaRef,
Decl D 
)
static

◆ checkDetachMergeableClauses()

static bool checkDetachMergeableClauses ( Sema S,
ArrayRef< OMPClause * >  Clauses 
)
static

detach and mergeable clauses are mutially exclusive, check for it.

Definition at line 9457 of file SemaOpenMP.cpp.

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

◆ checkGrainsizeNumTasksClauses()

static bool checkGrainsizeNumTasksClauses ( Sema S,
ArrayRef< OMPClause * >  Clauses 
)
static

◆ checkIfClauses()

static bool checkIfClauses ( Sema S,
OpenMPDirectiveKind  Kind,
ArrayRef< OMPClause * >  Clauses,
ArrayRef< OpenMPDirectiveKind AllowedNameModifiers 
)
static

Definition at line 4847 of file SemaOpenMP.cpp.

◆ checkMapClauseExpressionBase()

static 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 17255 of file SemaOpenMP.cpp.

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

Referenced by checkMappableExpressionList().

◆ checkMapConflicts()

static bool checkMapConflicts ( Sema SemaRef,
DSAStackTy *  DSAS,
const ValueDecl VD,
const Expr E,
bool  CurrentRegionOnly,
OMPClauseMappableExprCommon::MappableExprComponentListRef  CurComponents,
OpenMPClauseKind  CKind 
)
static

◆ checkMappableExpressionList()

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,
bool  IsMapTypeImplicit = false 
)
static

Definition at line 17673 of file SemaOpenMP.cpp.

References buildUserDefinedMapperRef(), checkMapClauseExpressionBase(), checkMapConflicts(), checkTypeMappable(), clang::Expr::containsUnexpandedParameterPack(), clang::ASTContext::DeclarationNames, clang::Sema::Diag(), clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::IdentifierTable::get(), clang::Type::getAsArrayTypeUnsafe(), OMPClauseMappableExprCommon::MappableComponent::getAssociatedDeclaration(), clang::Sema::getASTContext(), clang::OMPArraySectionExpr::getBaseOriginalType(), clang::QualType::getCanonicalType(), clang::Sema::getCurScope(), clang::Expr::getExprLoc(), clang::Sema::getLangOpts(), clang::DeclarationNameInfo::getName(), clang::getOpenMPSimpleClauseTypeName(), clang::Type::getPointeeType(), clang::Stmt::getSourceRange(), clang::Expr::getType(), clang::ASTContext::Idents, clang::Expr::IgnoreParenCasts(), clang::Expr::IgnoreParenLValueCasts(), clang::Expr::IgnoreParens(), clang::Decl::isCanonicalDecl(), clang::DeclarationName::isEmpty(), clang::Expr::isInstantiationDependent(), clang::ActionResult< PtrTy, CompressInvalid >::isInvalid(), clang::Expr::isLValue(), clang::isOpenMPPrivate(), clang::isOpenMPTargetExecutionDirective(), clang::Expr::isTypeDependent(), clang::SourceLocation::isValid(), clang::Expr::isValueDependent(), clang::Sema::LangOpts, reportOriginalDsa(), clang::DeclarationNameInfo::setLoc(), and clang::DeclarationNameInfo::setName().

Referenced by clang::Sema::ActOnOpenMPFromClause(), clang::Sema::ActOnOpenMPMapClause(), and clang::Sema::ActOnOpenMPToClause().

◆ checkNestingOfRegions()

static bool checkNestingOfRegions ( Sema SemaRef,
const DSAStackTy *  Stack,
OpenMPDirectiveKind  CurrentRegion,
const DeclarationNameInfo CurrentName,
OpenMPDirectiveKind  CancelRegion,
SourceLocation  StartLoc 
)
static

Definition at line 4594 of file SemaOpenMP.cpp.

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

◆ checkOMPArraySectionConstantForReduction()

static bool checkOMPArraySectionConstantForReduction ( ASTContext Context,
const OMPArraySectionExpr OASE,
bool SingleElement,
SmallVectorImpl< llvm::APSInt > &  ArraySizes 
)
static

Definition at line 15024 of file SemaOpenMP.cpp.

◆ checkOpenMPIterationSpace()

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

Called on a for stmt to check and extract its iteration space for further processing (such as collapsing).

Definition at line 7945 of file SemaOpenMP.cpp.

Referenced by checkOpenMPLoop().

◆ checkOpenMPLoop()

static unsigned checkOpenMPLoop ( OpenMPDirectiveKind  DKind,
Expr CollapseLoopCountExpr,
Expr OrderedLoopCountExpr,
Stmt AStmt,
Sema SemaRef,
DSAStackTy &  DSA,
Sema::VarsWithInheritedDSAType VarsWithImplicitDSA,
OMPLoopDirective::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 8293 of file SemaOpenMP.cpp.

References clang::Sema::AA_Converting, clang::Sema::ActOnConditionalOp(), clang::Sema::ActOnFinishFullExpr(), clang::Sema::ActOnIntegerConstant(), clang::Sema::AddInitializerToDecl(), clang::Sema::BuildBinOp(), buildCounterInit(), buildCounterUpdate(), buildDeclRefExpr(), buildPreInits(), buildVarDecl(), clang::OMPLoopDirective::HelperExprs::CalcLastIteration, checkOpenMPIterationSpace(), clang::OMPLoopDirective::HelperExprs::clear(), clang::OMPLoopDirective::DistCombinedHelperExprs::Cond, clang::OMPLoopDirective::HelperExprs::Cond, clang::Sema::Context, clang::OMPLoopDirective::HelperExprs::Counters, clang::Sema::CurContext, clang::OMPLoopDirective::HelperExprs::DependentCounters, clang::OMPLoopDirective::HelperExprs::DependentInits, clang::Sema::Diag(), clang::OMPLoopDirective::HelperExprs::DistCombinedFields, clang::OMPLoopDirective::DistCombinedHelperExprs::DistCond, clang::OMPLoopDirective::HelperExprs::DistInc, clang::OMPLoopDirective::DistCombinedHelperExprs::EUB, clang::OMPLoopDirective::HelperExprs::EUB, clang::Expr::EvaluateAsInt(), clang::OMPLoopDirective::HelperExprs::Finals, clang::OMPLoopDirective::HelperExprs::FinalsConditions, fitsInto(), clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::Sema::getASTContext(), 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::Expr::getType(), clang::ValueDecl::getType(), clang::Type::hasSignedIntegerRepresentation(), clang::Type::hasUnsignedIntegerRepresentation(), clang::Stmt::IgnoreContainers(), clang::Expr::IgnoreImpCasts(), clang::OMPLoopDirective::HelperExprs::IL, clang::OMPLoopDirective::HelperExprs::Inc, clang::OMPLoopDirective::DistCombinedHelperExprs::Init, clang::OMPLoopDirective::HelperExprs::Init, clang::OMPLoopDirective::HelperExprs::Inits, clang::DeclContext::isDependentContext(), clang::Expr::isIntegerConstantExpr(), clang::isOpenMPDistributeDirective(), clang::isOpenMPLoopBoundSharingDirective(), clang::isOpenMPTaskLoopDirective(), clang::isOpenMPWorksharingDirective(), clang::ActionResult< PtrTy, CompressInvalid >::isUsable(), clang::Expr::isValueDependent(), clang::OMPLoopDirective::HelperExprs::IterationVarRef, clang::Sema::LangOpts, clang::OMPLoopDirective::HelperExprs::LastIteration, clang::OMPLoopDirective::DistCombinedHelperExprs::LB, clang::OMPLoopDirective::HelperExprs::LB, max(), clang::OMPLoopDirective::DistCombinedHelperExprs::NLB, clang::OMPLoopDirective::HelperExprs::NLB, clang::OMPLoopDirective::DistCombinedHelperExprs::NUB, clang::OMPLoopDirective::HelperExprs::NUB, clang::OMPLoopDirective::HelperExprs::NumIterations, clang::OMPLoopDirective::DistCombinedHelperExprs::ParForInDistCond, clang::Sema::PerformImplicitConversion(), clang::OMPLoopDirective::HelperExprs::PreCond, clang::OMPLoopDirective::HelperExprs::PreInits, clang::OMPLoopDirective::HelperExprs::PrevEUB, clang::OMPLoopDirective::HelperExprs::PrevLB, clang::OMPLoopDirective::HelperExprs::PrevUB, clang::OMPLoopDirective::HelperExprs::PrivateCounters, clang::OMPLoopDirective::HelperExprs::ST, clang::OMPLoopDirective::tryToFindNextInnerLoop(), clang::OMPLoopDirective::DistCombinedHelperExprs::UB, clang::OMPLoopDirective::HelperExprs::UB, clang::diff::Update, clang::OMPLoopDirective::HelperExprs::Updates, clang::Expr::EvalResult::Val, and widenIterationCount().

Referenced by clang::Sema::ActOnOpenMPDistributeDirective(), clang::Sema::ActOnOpenMPDistributeParallelForDirective(), clang::Sema::ActOnOpenMPDistributeParallelForSimdDirective(), clang::Sema::ActOnOpenMPDistributeSimdDirective(), clang::Sema::ActOnOpenMPForDirective(), clang::Sema::ActOnOpenMPForSimdDirective(), clang::Sema::ActOnOpenMPMasterTaskLoopDirective(), clang::Sema::ActOnOpenMPMasterTaskLoopSimdDirective(), clang::Sema::ActOnOpenMPParallelForDirective(), clang::Sema::ActOnOpenMPParallelForSimdDirective(), clang::Sema::ActOnOpenMPParallelMasterTaskLoopDirective(), clang::Sema::ActOnOpenMPParallelMasterTaskLoopSimdDirective(), clang::Sema::ActOnOpenMPSimdDirective(), clang::Sema::ActOnOpenMPTargetParallelForDirective(), clang::Sema::ActOnOpenMPTargetParallelForSimdDirective(), clang::Sema::ActOnOpenMPTargetSimdDirective(), clang::Sema::ActOnOpenMPTargetTeamsDistributeDirective(), clang::Sema::ActOnOpenMPTargetTeamsDistributeParallelForDirective(), clang::Sema::ActOnOpenMPTargetTeamsDistributeParallelForSimdDirective(), clang::Sema::ActOnOpenMPTargetTeamsDistributeSimdDirective(), clang::Sema::ActOnOpenMPTaskLoopDirective(), clang::Sema::ActOnOpenMPTaskLoopSimdDirective(), clang::Sema::ActOnOpenMPTeamsDistributeDirective(), clang::Sema::ActOnOpenMPTeamsDistributeParallelForDirective(), clang::Sema::ActOnOpenMPTeamsDistributeParallelForSimdDirective(), and clang::Sema::ActOnOpenMPTeamsDistributeSimdDirective().

◆ checkOrderedOrderSpecified()

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

Definition at line 4397 of file SemaOpenMP.cpp.

◆ checkPreviousOMPAllocateAttribute()

static bool checkPreviousOMPAllocateAttribute ( Sema S,
DSAStackTy *  Stack,
Expr RefExpr,
VarDecl VD,
OMPAllocateDeclAttr::AllocatorTypeTy  AllocatorKind,
Expr Allocator 
)
static

Definition at line 3047 of file SemaOpenMP.cpp.

◆ checkReductionClauses()

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

Check consistency of the reduction clauses.

Definition at line 2523 of file SemaOpenMP.cpp.

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

◆ checkReductionClauseWithNogroup()

static bool checkReductionClauseWithNogroup ( Sema S,
ArrayRef< OMPClause * >  Clauses 
)
static

◆ checkScheduleModifiers()

static bool checkScheduleModifiers ( Sema S,
OpenMPScheduleClauseModifier  M1,
OpenMPScheduleClauseModifier  M2,
SourceLocation  M1Loc,
SourceLocation  M2Loc 
)
static

Definition at line 13456 of file SemaOpenMP.cpp.

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

◆ checkSimdlenSafelenSpecified()

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

◆ checkTypeMappable()

static bool checkTypeMappable ( SourceLocation  SL,
SourceRange  SR,
Sema SemaRef,
DSAStackTy *  Stack,
QualType  QTy,
bool  FullCheck = true 
)
static

Definition at line 16808 of file SemaOpenMP.cpp.

Referenced by checkMappableExpressionList().

◆ checkValueDeclInTarget()

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

Definition at line 18866 of file SemaOpenMP.cpp.

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

◆ filterLookupForUDReductionAndMapper()

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

Definition at line 14727 of file SemaOpenMP.cpp.

◆ findAcceptableDecl()

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

Definition at line 14738 of file SemaOpenMP.cpp.

References clang::LookupResult::isVisible(), and clang::Decl::redecls().

Referenced by argumentDependentLookup().

◆ findOMPAllocatorHandleT()

static bool findOMPAllocatorHandleT ( Sema S,
SourceLocation  Loc,
DSAStackTy *  Stack 
)
static

Tries to find omp_allocator_handle_t type.

Definition at line 13010 of file SemaOpenMP.cpp.

Referenced by clang::Sema::ActOnOpenMPAllocatorClause(), and clang::Sema::ActOnOpenMPUsesAllocatorClause().

◆ findOMPAlloctraitT()

static bool findOMPAlloctraitT ( Sema S,
SourceLocation  Loc,
DSAStackTy *  Stack 
)
static

Tries to find omp_alloctrait_t type.

Definition at line 19412 of file SemaOpenMP.cpp.

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

◆ findOMPDependT()

static bool findOMPDependT ( Sema S,
SourceLocation  Loc,
DSAStackTy *  Stack,
bool  Diagnose = true 
)
static

Tries to find omp_depend_t. type.

Definition at line 16462 of file SemaOpenMP.cpp.

Referenced by clang::Sema::ActOnOpenMPDependClause(), and clang::Sema::ActOnOpenMPDepobjClause().

◆ findOMPEventHandleT()

static bool findOMPEventHandleT ( Sema S,
SourceLocation  Loc,
DSAStackTy *  Stack 
)
static

Tries to find omp_event_handle_t type.

Definition at line 18532 of file SemaOpenMP.cpp.

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

◆ FinishOpenMPLinearClause()

static bool FinishOpenMPLinearClause ( OMPLinearClause Clause,
DeclRefExpr IV,
Expr NumIterations,
Sema SemaRef,
Scope S,
DSAStackTy *  Stack 
)
static

◆ fitsInto()

static 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 8236 of file SemaOpenMP.cpp.

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

Referenced by checkOpenMPLoop().

◆ getAllocatorKind()

static OMPAllocateDeclAttr::AllocatorTypeTy getAllocatorKind ( Sema S,
DSAStackTy *  Stack,
Expr Allocator 
)
static

Definition at line 3024 of file SemaOpenMP.cpp.

◆ getCanonicalDecl() [1/2]

static const ValueDecl* getCanonicalDecl ( const ValueDecl D)
static

◆ getCanonicalDecl() [2/2]

static ValueDecl* getCanonicalDecl ( ValueDecl D)
static

Definition at line 1146 of file SemaOpenMP.cpp.

References getCanonicalDecl().

◆ getCollapseNumberExpr()

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

◆ getExprAsWritten() [1/2]

static const Expr* getExprAsWritten ( const Expr E)
static

Definition at line 1110 of file SemaOpenMP.cpp.

References clang::Expr::IgnoreParens().

Referenced by getCanonicalDecl(), and getExprAsWritten().

◆ getExprAsWritten() [2/2]

static Expr* getExprAsWritten ( Expr E)
static

Definition at line 1125 of file SemaOpenMP.cpp.

References getExprAsWritten().

◆ getListOfPossibleValues()

static std::string getListOfPossibleValues ( OpenMPClauseKind  K,
unsigned  First,
unsigned  Last,
ArrayRef< unsigned >  Exclude = llvm::None 
)
static

◆ getMapClauseKindFromModifier()

static OpenMPMapClauseKind getMapClauseKindFromModifier ( OpenMPDefaultmapClauseModifier  M,
bool  IsAggregateOrDeclareTarget 
)
static

◆ getOpenMPCaptureRegionForClause()

static OpenMPDirectiveKind getOpenMPCaptureRegionForClause ( OpenMPDirectiveKind  DKind,
OpenMPClauseKind  CKind,
unsigned  OpenMPVersion,
OpenMPDirectiveKind  NameModifier = OMPD_unknown 
)
static

◆ getOrderedNumberExpr()

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

◆ getPrivateItem()

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

◆ getVariableCategoryFromDecl()

static OpenMPDefaultmapClauseKind getVariableCategoryFromDecl ( const LangOptions LO,
const ValueDecl VD 
)
static

◆ hasClauses() [1/2]

static bool hasClauses ( ArrayRef< OMPClause * >  Clauses,
const OpenMPClauseKind  K 
)
static

◆ hasClauses() [2/2]

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

Definition at line 10596 of file SemaOpenMP.cpp.

References hasClauses().

◆ isConstNotMutableType()

static bool isConstNotMutableType ( Sema SemaRef,
QualType  Type,
bool  AcceptIfMutable = true,
bool IsClassType = nullptr 
)
static

Definition at line 1553 of file SemaOpenMP.cpp.

◆ isNonNegativeIntegerValue()

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

◆ isOpenMPDeviceDelayedContext()

static bool isOpenMPDeviceDelayedContext ( Sema S)
static

Definition at line 1884 of file SemaOpenMP.cpp.

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

◆ rejectConstNotMutableType()

static bool rejectConstNotMutableType ( Sema SemaRef,
const ValueDecl D,
QualType  Type,
OpenMPClauseKind  CKind,
SourceLocation  ELoc,
bool  AcceptIfMutable = true,
bool  ListItemNotVar = false 
)
static

◆ reportOriginalDsa()

static void reportOriginalDsa ( Sema SemaRef,
const DSAStackTy *  Stack,
const ValueDecl D,
const DSAStackTy::DSAVarData &  DVar,
bool  IsLoopIterVar = false 
)
static

◆ setPrototype()

static void setPrototype ( Sema S,
FunctionDecl FD,
FunctionDecl FDWithProto,
QualType  NewType 
)
static

Definition at line 5975 of file SemaOpenMP.cpp.

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

◆ widenIterationCount()

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

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

Definition at line 8220 of file SemaOpenMP.cpp.

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

Referenced by checkOpenMPLoop().