clang 19.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/OpenMPKinds.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/Basic/TokenKinds.h"
#include "clang/Parse/ParseDiagnostic.h"
#include "clang/Parse/Parser.h"
#include "clang/Parse/RAIIObjectsForParser.h"
#include "clang/Sema/EnterExpressionEvaluationContext.h"
#include "clang/Sema/Scope.h"
#include "clang/Sema/SemaOpenMP.h"
#include "llvm/ADT/PointerIntPair.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/ADT/UniqueVector.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.
 

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 102 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 4190 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.

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

Definition at line 4286 of file ParseOpenMP.cpp.

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

Referenced by parseMapType().

◆ parseContextScore()

static ExprResult parseContextScore ( Parser P)
static

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

Definition at line 1104 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 718 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 4301 of file ParseOpenMP.cpp.

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

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

◆ parseOpenMPDirectiveKind()

static OpenMPDirectiveKindExWrapper parseOpenMPDirectiveKind ( Parser P)
static

Definition at line 123 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 4449 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().