14#ifndef LLVM_CLANG_AST_DECLOPENMP_H
15#define LLVM_CLANG_AST_DECLOPENMP_H
23#include "llvm/ADT/ArrayRef.h"
24#include "llvm/Support/TrailingObjects.h"
38 return Data->getClauses();
46 template <
typename... Params>
49 template <
typename T,
typename... Params>
53 auto *Inst =
new (
C, DC,
size(Clauses.size(), NumChildren))
54 T(DC, std::forward<Params>(P)...);
55 Inst->Data = OMPChildren::Create(Inst + 1, Clauses,
56 nullptr, NumChildren);
57 Inst->Data->setClauses(Clauses);
61 template <
typename T,
typename... Params>
63 unsigned NumClauses,
unsigned NumChildren,
65 auto *Inst =
new (
C, ID,
size(NumClauses, NumChildren))
66 T(
nullptr, std::forward<Params>(P)...);
67 Inst->Data = OMPChildren::CreateEmpty(
68 Inst + 1, NumClauses,
false, NumChildren);
72 static size_t size(
unsigned NumClauses,
unsigned NumChildren) {
73 return OMPChildren::size(NumClauses,
false,
82 return Data->getNumClauses();
94 return Data->getClauses();
113 LLVM_DECLARE_VIRTUAL_ANCHOR_FUNCTION();
120 auto **Storage =
reinterpret_cast<Expr **
>(
Data->getChildren().data());
121 return {Storage,
Data->getNumChildren()};
125 auto **Storage =
reinterpret_cast<Expr **
>(
Data->getChildren().data());
126 return {Storage,
Data->getNumChildren()};
183 Expr *Combiner =
nullptr;
185 Expr *Initializer =
nullptr;
191 Expr *Priv =
nullptr;
193 Expr *Orig =
nullptr;
200 void anchor()
override;
204 OMPDeclareReductionDecl *PrevDeclInScope);
206 void setPrevDeclInScope(OMPDeclareReductionDecl *Prev) {
207 PrevDeclInScope = Prev;
270 return static_cast<DeclContext *
>(
const_cast<OMPDeclareReductionDecl *
>(D));
273 return static_cast<OMPDeclareReductionDecl *
>(
293 Expr *MapperVarRef =
nullptr;
300 void anchor()
override;
304 OMPDeclareMapperDecl *PrevDeclInScope)
307 PrevDeclInScope(PrevDeclInScope) {}
310 PrevDeclInScope = Prev;
316 SourceLocation L, DeclarationName Name,
317 QualType T, DeclarationName VarName,
319 OMPDeclareMapperDecl *PrevDeclInScope);
322 GlobalDeclID ID,
unsigned N);
328 llvm::iterator_range<clauselist_const_iterator>;
342 return Data->getClauses().begin();
345 return Data->getClauses().end();
351 return cast_or_null<Expr>(
Data->getChildren()[0]);
355 Data->getChildren()[0] = MapperVarRefE;
369 return static_cast<DeclContext *
>(
const_cast<OMPDeclareMapperDecl *
>(D));
372 return static_cast<OMPDeclareMapperDecl *
>(
const_cast<DeclContext *
>(DC));
383class OMPCapturedExprDecl final :
public VarDecl {
385 void anchor()
override;
390 :
VarDecl(OMPCapturedExpr,
C, DC, StartLoc, StartLoc, Id,
Type, TInfo,
421 LLVM_DECLARE_VIRTUAL_ANCHOR_FUNCTION();
451 return Data->getClauses().begin();
454 return Data->getClauses().end();
478 LLVM_DECLARE_VIRTUAL_ANCHOR_FUNCTION();
484 auto **Storage =
reinterpret_cast<Expr **
>(
Data->getChildren().data());
485 return {Storage,
Data->getNumChildren()};
488 MutableArrayRef<Expr *> getVars() {
489 auto **
Storage =
reinterpret_cast<Expr **
>(
Data->getChildren().data());
493 void setVars(ArrayRef<Expr *> VL);
497 SourceLocation L, ArrayRef<Expr *> VL,
498 ArrayRef<OMPClause *> CL);
500 unsigned NVars,
unsigned NClauses);
536 return Data->getClauses().begin();
539 return Data->getClauses().end();
Defines the clang::ASTContext interface.
This file defines OpenMP AST classes for clauses.
C Language Family Type Representation.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
DeclContext(Decl::Kind K)
OMPDeclareReductionDeclBitfields OMPDeclareReductionDeclBits
Decl - This represents one declaration (or definition), e.g.
Kind
Lists the kind of concrete classes of Decl.
void setImplicit(bool I=true)
The name of a declaration.
This represents one expression.
One of these records is kept for each identifier that is lexed.
llvm::iterator_range< clauselist_iterator > clauselist_range
clauselist_iterator clauselist_end()
static OMPAllocateDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID, unsigned NVars, unsigned NClauses)
MutableArrayRef< OMPClause * >::iterator clauselist_iterator
clauselist_iterator clauselist_begin()
static bool classofKind(Kind K)
bool varlist_empty() const
clauselist_const_iterator clauselist_begin() const
friend class ASTDeclReader
ArrayRef< const OMPClause * >::iterator clauselist_const_iterator
bool clauselist_empty() const
varlist_const_iterator varlist_end() const
varlist_iterator varlist_begin()
llvm::iterator_range< clauselist_const_iterator > clauselist_const_range
MutableArrayRef< Expr * >::iterator varlist_iterator
llvm::iterator_range< varlist_iterator > varlist_range
static bool classof(const Decl *D)
varlist_const_iterator varlist_begin() const
varlist_const_range varlist() const
unsigned varlist_size() const
clauselist_const_iterator clauselist_end() const
clauselist_const_range clauselists() const
clauselist_range clauselists()
unsigned clauselist_size() const
ArrayRef< constExpr * >::iterator varlist_const_iterator
llvm::iterator_range< varlist_const_iterator > varlist_const_range
varlist_iterator varlist_end()
Pseudo declaration for capturing expressions.
static bool classof(const Decl *D)
friend class ASTDeclReader
static bool classofKind(Kind K)
static OMPCapturedExprDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
Contains data for OpenMP directives: clauses, children expressions/statements (helpers for codegen) a...
This is a basic class for representing single OpenMP clause.
static T * createEmptyDirective(const ASTContext &C, GlobalDeclID ID, unsigned NumClauses, unsigned NumChildren, Params &&... P)
OMPDeclarativeDirective(Params &&... P)
Build instance of directive.
unsigned getNumClauses() const
Get number of clauses.
friend class ASTDeclReader
OMPClause * getClause(unsigned I) const
Returns specified clause.
OMPChildren * Data
Data, associated with the directive.
static size_t size(unsigned NumClauses, unsigned NumChildren)
friend class ASTDeclWriter
static T * createDirective(const ASTContext &C, DeclContext *DC, ArrayRef< OMPClause * > Clauses, unsigned NumChildren, Params &&... P)
ArrayRef< OMPClause * > clauses() const
This represents 'pragma omp declare mapper ...' directive.
static OMPDeclareMapperDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID, unsigned N)
Creates deserialized declare mapper node.
ArrayRef< const OMPClause * >::iterator clauselist_const_iterator
const Expr * getMapperVarRef() const
clauselist_const_iterator clauselist_begin() const
void setMapperVarRef(Expr *MapperVarRefE)
Set the variable declared in the mapper.
clauselist_const_iterator clauselist_end() const
OMPDeclareMapperDecl * getPrevDeclInScope()
Get reference to previous declare mapper construct in the same scope with the same name.
unsigned clauselist_size() const
clauselist_iterator clauselist_begin()
clauselist_range clauselists()
friend class ASTDeclReader
DeclarationName getVarName()
Get the name of the variable declared in the mapper.
static DeclContext * castToDeclContext(const OMPDeclareMapperDecl *D)
clauselist_const_range clauselists() const
llvm::iterator_range< clauselist_const_iterator > clauselist_const_range
MutableArrayRef< OMPClause * >::iterator clauselist_iterator
static OMPDeclareMapperDecl * castFromDeclContext(const DeclContext *DC)
friend class ASTDeclWriter
static bool classofKind(Kind K)
bool clauselist_empty() const
Expr * getMapperVarRef()
Get the variable declared in the mapper.
llvm::iterator_range< clauselist_iterator > clauselist_range
static bool classof(const Decl *D)
clauselist_iterator clauselist_end()
This represents 'pragma omp declare reduction ...' directive.
Expr * getInitializer()
Get initializer expression (if specified) of the declare reduction construct.
void setInitializerData(Expr *OrigE, Expr *PrivE)
Set initializer Orig and Priv vars.
void setInitializer(Expr *E, OMPDeclareReductionInitKind IK)
Set initializer expression for the declare reduction construct.
Expr * getInitPriv()
Get Priv variable of the initializer.
const Expr * getCombinerIn() const
Expr * getCombinerOut()
Get Out variable of the combiner.
const Expr * getCombiner() const
void setCombiner(Expr *E)
Set combiner expression for the declare reduction construct.
Expr * getCombinerIn()
Get In variable of the combiner.
const Expr * getInitOrig() const
friend class ASTDeclReader
Expr * getCombiner()
Get combiner expression of the declare reduction construct.
static bool classofKind(Kind K)
void setCombinerData(Expr *InE, Expr *OutE)
Set combiner In and Out vars.
static DeclContext * castToDeclContext(const OMPDeclareReductionDecl *D)
const Expr * getInitializer() const
OMPDeclareReductionDecl * getPrevDeclInScope()
Get reference to previous declare reduction construct in the same scope with the same name.
Expr * getInitOrig()
Get Orig variable of the initializer.
static OMPDeclareReductionDecl * castFromDeclContext(const DeclContext *DC)
OMPDeclareReductionInitKind getInitializerKind() const
Get initializer kind.
static bool classof(const Decl *D)
const Expr * getInitPriv() const
const Expr * getCombinerOut() const
static OMPDeclareReductionDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID)
Create deserialized declare reduction node.
This represents 'pragma omp requires...' directive.
static OMPRequiresDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID, unsigned N)
Create deserialized requires node.
clauselist_iterator clauselist_begin()
ArrayRef< const OMPClause * >::iterator clauselist_const_iterator
MutableArrayRef< OMPClause * >::iterator clauselist_iterator
clauselist_range clauselists()
friend class ASTDeclReader
clauselist_const_range clauselists() const
bool clauselist_empty() const
clauselist_const_iterator clauselist_begin() const
llvm::iterator_range< clauselist_iterator > clauselist_range
llvm::iterator_range< clauselist_const_iterator > clauselist_const_range
static bool classof(const Decl *D)
unsigned clauselist_size() const
clauselist_iterator clauselist_end()
static bool classofKind(Kind K)
clauselist_const_iterator clauselist_end() const
static OMPThreadPrivateDecl * CreateDeserialized(ASTContext &C, GlobalDeclID ID, unsigned N)
MutableArrayRef< Expr * >::iterator varlist_iterator
varlist_const_iterator varlist_begin() const
unsigned varlist_size() const
llvm::iterator_range< varlist_iterator > varlist_range
ArrayRef< constExpr * >::iterator varlist_const_iterator
varlist_const_range varlist() const
varlist_const_iterator varlist_end() const
bool varlist_empty() const
varlist_iterator varlist_end()
static bool classof(const Decl *D)
static bool classofKind(Kind K)
friend class OMPDeclarativeDirective< Decl >
varlist_iterator varlist_begin()
llvm::iterator_range< varlist_const_iterator > varlist_const_range
A (possibly-)qualified type.
Encodes a location in the source.
A trivial tuple used to represent a source range.
A container of type source information.
The base class of the type hierarchy.
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
ValueDecl(Kind DK, DeclContext *DC, SourceLocation L, DeclarationName N, QualType T)
VarDecl(Kind DK, ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass SC)
The JSON file list parser is used to communicate input to InstallAPI.
@ Create
'create' clause, allowed on Compute and Combined constructs, plus 'data', 'enter data',...
LazyOffsetPtr< Decl, GlobalDeclID, &ExternalASTSource::GetExternalDecl > LazyDeclPtr
A lazy pointer to a declaration.
OMPDeclareReductionInitKind
const FunctionProtoType * T