clang: include/clang/AST/DeclOpenMP.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14#ifndef LLVM_CLANG_AST_DECLOPENMP_H
15#define LLVM_CLANG_AST_DECLOPENMP_H
16
23#include "llvm/ADT/ArrayRef.h"
24#include "llvm/Support/TrailingObjects.h"
25
27
28
29
33
34
37 return {};
39 }
40
41protected:
42
44
45
46 template <typename... Params>
48
49 template <typename T, typename... Params>
52 Params &&... P) {
53 auto *Inst = new (C, DC, size(Clauses.size(), NumChildren))
55 Inst->Data = OMPChildren::Create(Inst + 1, Clauses,
56 nullptr, NumChildren);
57 Inst->Data->setClauses(Clauses);
58 return Inst;
59 }
60
61 template <typename T, typename... Params>
63 unsigned NumClauses, unsigned NumChildren,
64 Params &&... P) {
65 auto *Inst = new (C, ID, size(NumClauses, NumChildren))
66 T(nullptr, std::forward(P)...);
67 Inst->Data = OMPChildren::CreateEmpty(
68 Inst + 1, NumClauses, false, NumChildren);
69 return Inst;
70 }
71
72 static size_t size(unsigned NumClauses, unsigned NumChildren) {
73 return OMPChildren::size(NumClauses, false,
74 NumChildren);
75 }
76
77public:
78
81 return 0;
83 }
84
85
86
87
88
90
93 return {};
95 }
96};
97
98
99
100
101
102
103
104
105
106
107
108
109
112
113 virtual void anchor();
114
118
122 }
123
127 }
128
130
131public:
137
140 typedef llvm::iterator_range<varlist_iterator> varlist_range;
142
145
148 }
151 }
156
159};
160
162 Call,
163 Direct,
164 Copy
165};
166
167
168
169
170
171
172
173
174
175
176
178
179
180
182
183 Expr *Combiner = nullptr;
184
185 Expr *Initializer = nullptr;
186
187 Expr *In = nullptr;
188
189 Expr *Out = nullptr;
190
191 Expr *Priv = nullptr;
192
193 Expr *Orig = nullptr;
194
195
196
197
199
200 void anchor() override;
201
205
207 PrevDeclInScope = Prev;
208 }
209
210public:
211
215
218
219
222
225
228
230
232 In = InE;
233 Out = OutE;
234 }
235
236
237
240
244 }
245
248
251
255 }
256
258 Orig = OrigE;
259 Priv = PrivE;
260 }
261
262
263
266
271 }
275 }
276};
277
278
279
280
281
282
283
284
285
291
292
293 Expr *MapperVarRef = nullptr;
294
295
297
299
300 void anchor() override;
301
306 DeclContext(OMPDeclareMapper), VarName(VarName),
307 PrevDeclInScope(PrevDeclInScope) {}
308
310 PrevDeclInScope = Prev;
311 }
312
313public:
314
315 static OMPDeclareMapperDecl *Create(ASTContext &C, DeclContext *DC,
316 SourceLocation L, DeclarationName Name,
317 QualType T, DeclarationName VarName,
318 ArrayRef<OMPClause *> Clauses,
319 OMPDeclareMapperDecl *PrevDeclInScope);
320
322 GlobalDeclID ID, unsigned N);
323
328 llvm::iterator_range<clauselist_const_iterator>;
329
332
335 }
338 }
343 }
346 }
347
348
352 }
353
356 }
357
358
360
361
362
365
370 }
373 }
374};
375
376
377
378
379
380
381
382
385 void anchor() override;
386
390 : VarDecl(OMPCapturedExpr, C, DC, StartLoc, StartLoc, Id, Type, TInfo,
393 }
394
395public:
399
402
404
405
408};
409
410
411
412
413
414
415
416
420
421 virtual void anchor();
422
425
426public:
427
430
432 unsigned N);
433
438
441
444 }
447 }
452 }
455 }
456
459};
460
461
462
463
464
465
466
467
468
469
470
471
472
473
477
478 virtual void anchor();
479
482
486 }
487
488 MutableArrayRef<Expr *> getVars() {
489 auto **Storage = reinterpret_cast<Expr **>(Data->getChildren().data());
491 }
492
493 void setVars(ArrayRef<Expr *> VL);
494
495public:
496 static OMPAllocateDecl *Create(ASTContext &C, DeclContext *DC,
497 SourceLocation L, ArrayRef<Expr *> VL,
498 ArrayRef<OMPClause *> CL);
500 unsigned NVars, unsigned NClauses);
501
504 typedef llvm::iterator_range<varlist_iterator> varlist_range;
510
515
518 }
521 }
526
529 }
532 }
537 }
540 }
541
544};
545
546}
547
548#endif
Defines the clang::ASTContext interface.
enum clang::sema::@1726::IndirectLocalPathEntry::EntryKind Kind
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 ...
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
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.
This represents '#pragma omp allocate ...' directive.
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
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)
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...
unsigned getNumClauses() const
unsigned getNumChildren() const
MutableArrayRef< OMPClause * > getClauses()
Get the clauses storage.
MutableArrayRef< Stmt * > getChildren()
This is a basic class for representing single OpenMP clause.
This is a basic class for representing single OpenMP declarative directive.
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.
OMPClause * getClause(unsigned I) const
Returns specified clause.
OMPChildren * Data
Data, associated with the directive.
static size_t size(unsigned NumClauses, unsigned NumChildren)
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()
DeclarationName getVarName()
Get the name of the variable declared in the mapper.
static DeclContext * castToDeclContext(const OMPDeclareMapperDecl *D)
clauselist_const_range clauselists() const
MutableArrayRef< OMPClause * >::iterator clauselist_iterator
static OMPDeclareMapperDecl * castFromDeclContext(const DeclContext *DC)
static bool classofKind(Kind K)
bool clauselist_empty() const
llvm::iterator_range< clauselist_const_iterator > clauselist_const_range
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
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()
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
This represents '#pragma omp threadprivate ...' directive.
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 ...
Represents a variable declaration or definition.
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',...
OMPDeclareReductionInitKind
const FunctionProtoType * T