clang 20.0.0git
Functions
ParseOpenMP.cpp File Reference

This file implements parsing of all OpenMP directives and clauses. More...

#include "clang/AST/ASTContext.h"
#include "clang/AST/OpenMPClause.h"
#include "clang/AST/StmtOpenMP.h"
#include "clang/Basic/DiagnosticParse.h"
#include "clang/Basic/OpenMPKinds.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/Basic/TokenKinds.h"
#include "clang/Parse/Parser.h"
#include "clang/Parse/RAIIObjectsForParser.h"
#include "clang/Sema/EnterExpressionEvaluationContext.h"
#include "clang/Sema/Scope.h"
#include "clang/Sema/SemaAMDGPU.h"
#include "clang/Sema/SemaCodeCompletion.h"
#include "clang/Sema/SemaOpenMP.h"
#include "llvm/ADT/SmallBitVector.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/Frontend/OpenMP/OMPAssume.h"
#include "llvm/Frontend/OpenMP/OMPContext.h"
#include <optional>

Go to the source code of this file.

Functions

static unsigned getOpenMPDirectiveKindEx (StringRef S)
 
static OpenMPDirectiveKindExWrapper parseOpenMPDirectiveKind (Parser &P)
 
static DeclarationName parseOpenMPReductionId (Parser &P)
 
static bool parseDeclareSimdClauses (Parser &P, OMPDeclareSimdDeclAttr::BranchStateTy &BS, ExprResult &SimdLen, SmallVectorImpl< Expr * > &Uniforms, SmallVectorImpl< Expr * > &Aligneds, SmallVectorImpl< Expr * > &Alignments, SmallVectorImpl< Expr * > &Linears, SmallVectorImpl< unsigned > &LinModifiers, SmallVectorImpl< Expr * > &Steps)
 Parses clauses for 'declare simd' directive.
 
static bool checkExtensionProperty (Parser &P, SourceLocation Loc, OMPTraitProperty &TIProperty, OMPTraitSelector &TISelector, llvm::StringMap< SourceLocation > &Seen)
 
static ExprResult parseContextScore (Parser &P)
 Parse optional 'score' '(' <expr> ')' ':'.
 
static std::optional< SimpleClauseData > parseOpenMPSimpleClause (Parser &P, OpenMPClauseKind Kind)
 
static bool ParseReductionId (Parser &P, CXXScopeSpec &ReductionIdScopeSpec, UnqualifiedId &ReductionId)
 
static OpenMPMapModifierKind isMapModifier (Parser &P)
 Checks if the token is a valid map-type-modifier.
 
static OpenMPMapClauseKind isMapType (Parser &P)
 Checks if the token is a valid map-type.
 
static void parseMapType (Parser &P, SemaOpenMP::OpenMPVarListDataTy &Data)
 Parse map-type in map clause.
 
static bool parseStepSize (Parser &P, SemaOpenMP::OpenMPVarListDataTy &Data, OpenMPClauseKind CKind, SourceLocation ELoc)
 Parse step size expression.
 
static ExprResult parseOpenMPAllocateClauseModifiers (Parser &P, OpenMPClauseKind Kind, SemaOpenMP::OpenMPVarListDataTy &Data)
 Parse 'allocate' clause modifiers.
 

Detailed Description

This file implements parsing of all OpenMP directives and clauses.

Definition in file ParseOpenMP.cpp.

Function Documentation

◆ checkExtensionProperty()

static bool checkExtensionProperty ( Parser P,
SourceLocation  Loc,
OMPTraitProperty TIProperty,
OMPTraitSelector TISelector,
llvm::StringMap< SourceLocation > &  Seen 
)
static

◆ getOpenMPDirectiveKindEx()

static unsigned getOpenMPDirectiveKindEx ( StringRef  S)
static

Definition at line 103 of file ParseOpenMP.cpp.

Referenced by parseOpenMPDirectiveKind().

◆ isMapModifier()

static OpenMPMapModifierKind isMapModifier ( Parser P)
static

Checks if the token is a valid map-type-modifier.

FIXME: It will return an OpenMPMapClauseKind if that's what it parses.

Definition at line 4219 of file ParseOpenMP.cpp.

References clang::getOpenMPSimpleClauseType(), clang::Preprocessor::getSpelling(), clang::Token::is(), clang::OMPC_MAP_MODIFIER_unknown, and P.

Referenced by clang::Parser::parseMapTypeModifiers().

◆ isMapType()

static OpenMPMapClauseKind isMapType ( Parser P)
static

Checks if the token is a valid map-type.

If it is not MapType kind, OMPC_MAP_unknown is returned.

Definition at line 4349 of file ParseOpenMP.cpp.

References clang::getOpenMPSimpleClauseType(), clang::Preprocessor::getSpelling(), clang::Token::isOneOf(), clang::OMPC_MAP_unknown, and P.

Referenced by parseMapType(), and clang::Parser::parseMapTypeModifiers().

◆ parseContextScore()

static ExprResult parseContextScore ( Parser P)
static

Parse optional 'score' '(' <expr> ')' ':'.

Definition at line 1107 of file ParseOpenMP.cpp.

References P.

◆ parseDeclareSimdClauses()

static bool parseDeclareSimdClauses ( Parser P,
OMPDeclareSimdDeclAttr::BranchStateTy &  BS,
ExprResult SimdLen,
SmallVectorImpl< Expr * > &  Uniforms,
SmallVectorImpl< Expr * > &  Aligneds,
SmallVectorImpl< Expr * > &  Alignments,
SmallVectorImpl< Expr * > &  Linears,
SmallVectorImpl< unsigned > &  LinModifiers,
SmallVectorImpl< Expr * > &  Steps 
)
static

Parses clauses for 'declare simd' directive.

clause: 'inbranch' | 'notinbranch' 'simdlen' '(' <expr> ')' { 'uniform' '(' <argument_list> ')' } { 'aligned '(' <argument_list> [ ':' <alignment> ] ')' } { 'linear '(' <argument_list> [ ':' <step> ] ')' }

Definition at line 721 of file ParseOpenMP.cpp.

References clang::Data, clang::Token::getEndLoc(), clang::Token::getIdentifierInfo(), clang::Token::getLocation(), clang::IdentifierInfo::getName(), clang::Token::is(), clang::ActionResult< PtrTy, Compress >::isInvalid(), clang::Token::isNot(), clang::ActionResult< PtrTy, Compress >::isUsable(), clang::OMPC_LINEAR_unknown, and P.

◆ parseMapType()

static void parseMapType ( Parser P,
SemaOpenMP::OpenMPVarListDataTy Data 
)
static

Parse map-type in map clause.

map([ [map-type-modifier[,] [map-type-modifier[,] ...] map-type : ] list) where, map-type ::= to | from | tofrom | alloc | release | delete

Definition at line 4367 of file ParseOpenMP.cpp.

References clang::Data, clang::Token::is(), isMapType(), clang::OMPC_MAP_unknown, and P.

Referenced by clang::Parser::ParseOpenMPVarList().

◆ parseOpenMPAllocateClauseModifiers()

static ExprResult parseOpenMPAllocateClauseModifiers ( Parser P,
OpenMPClauseKind  Kind,
SemaOpenMP::OpenMPVarListDataTy Data 
)
static

Parse 'allocate' clause modifiers.

If allocator-modifier exists, return an expression for it and set Data field noting modifier was specified.

Definition at line 4537 of file ParseOpenMP.cpp.

References clang::BalancedDelimiterTracker::consumeClose(), clang::BalancedDelimiterTracker::consumeOpen(), clang::Data, clang::getOpenMPSimpleClauseType(), clang::Preprocessor::getSpelling(), clang::Token::is(), and P.

Referenced by clang::Parser::ParseOpenMPVarList().

◆ parseOpenMPDirectiveKind()

static OpenMPDirectiveKindExWrapper parseOpenMPDirectiveKind ( Parser P)
static

Definition at line 124 of file ParseOpenMP.cpp.

References getOpenMPDirectiveKindEx(), clang::Token::isAnnotation(), and P.

◆ parseOpenMPReductionId()

static DeclarationName parseOpenMPReductionId ( Parser P)
static

◆ parseOpenMPSimpleClause()

static std::optional< SimpleClauseData > parseOpenMPSimpleClause ( Parser P,
OpenMPClauseKind  Kind 
)
static

◆ ParseReductionId()

static bool ParseReductionId ( Parser P,
CXXScopeSpec ReductionIdScopeSpec,
UnqualifiedId ReductionId 
)
static

◆ parseStepSize()

static bool parseStepSize ( Parser P,
SemaOpenMP::OpenMPVarListDataTy Data,
OpenMPClauseKind  CKind,
SourceLocation  ELoc 
)
static

Parse step size expression.

Returns true if parsing is successfull, otherwise returns false.

Definition at line 4515 of file ParseOpenMP.cpp.

References clang::Sema::ActOnFinishFullExpr(), clang::Data, clang::ActionResult< PtrTy, Compress >::get(), clang::Token::isNot(), clang::ActionResult< PtrTy, Compress >::isUsable(), and P.

Referenced by clang::Parser::ParseOpenMPVarList().