clang  12.0.0git
DeclOpenMP.h
Go to the documentation of this file.
1 //===- DeclOpenMP.h - Classes for representing OpenMP directives -*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 ///
9 /// \file
10 /// This file defines OpenMP nodes for declarative directives.
11 ///
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_CLANG_AST_DECLOPENMP_H
15 #define LLVM_CLANG_AST_DECLOPENMP_H
16 
17 #include "clang/AST/ASTContext.h"
18 #include "clang/AST/Decl.h"
19 #include "clang/AST/Expr.h"
21 #include "clang/AST/OpenMPClause.h"
22 #include "clang/AST/Type.h"
23 #include "llvm/ADT/ArrayRef.h"
24 #include "llvm/Support/TrailingObjects.h"
25 
26 namespace clang {
27 
28 /// This is a basic class for representing single OpenMP declarative directive.
29 ///
30 template <typename U> class OMPDeclarativeDirective : public U {
31  friend class ASTDeclReader;
32  friend class ASTDeclWriter;
33 
34  /// Get the clauses storage.
35  MutableArrayRef<OMPClause *> getClauses() {
36  if (!Data)
37  return llvm::None;
38  return Data->getClauses();
39  }
40 
41 protected:
42  /// Data, associated with the directive.
43  OMPChildren *Data = nullptr;
44 
45  /// Build instance of directive.
46  template <typename... Params>
47  OMPDeclarativeDirective(Params &&... P) : U(std::forward<Params>(P)...) {}
48 
49  template <typename T, typename... Params>
50  static T *createDirective(const ASTContext &C, DeclContext *DC,
51  ArrayRef<OMPClause *> Clauses, unsigned NumChildren,
52  Params &&... P) {
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  /*AssociatedStmt=*/nullptr, NumChildren);
57  Inst->Data->setClauses(Clauses);
58  return Inst;
59  }
60 
61  template <typename T, typename... Params>
62  static T *createEmptyDirective(const ASTContext &C, unsigned ID,
63  unsigned NumClauses, unsigned NumChildren,
64  Params &&... P) {
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, /*HasAssociatedStmt=*/false, NumChildren);
69  return Inst;
70  }
71 
72  static size_t size(unsigned NumClauses, unsigned NumChildren) {
73  return OMPChildren::size(NumClauses, /*HasAssociatedStmt=*/false,
74  NumChildren);
75  }
76 
77 public:
78  /// Get number of clauses.
79  unsigned getNumClauses() const {
80  if (!Data)
81  return 0;
82  return Data->getNumClauses();
83  }
84 
85  /// Returns specified clause.
86  ///
87  /// \param I Number of clause.
88  ///
89  OMPClause *getClause(unsigned I) const { return clauses()[I]; }
90 
92  if (!Data)
93  return llvm::None;
94  return Data->getClauses();
95  }
96 };
97 
98 /// This represents '#pragma omp threadprivate ...' directive.
99 /// For example, in the following, both 'a' and 'A::b' are threadprivate:
100 ///
101 /// \code
102 /// int a;
103 /// #pragma omp threadprivate(a)
104 /// struct A {
105 /// static int b;
106 /// #pragma omp threadprivate(b)
107 /// };
108 /// \endcode
109 ///
110 class OMPThreadPrivateDecl final : public OMPDeclarativeDirective<Decl> {
112 
113  virtual void anchor();
114 
115  OMPThreadPrivateDecl(DeclContext *DC = nullptr,
117  : OMPDeclarativeDirective<Decl>(OMPThreadPrivate, DC, L) {}
118 
119  ArrayRef<const Expr *> getVars() const {
120  auto **Storage = reinterpret_cast<Expr **>(Data->getChildren().data());
121  return llvm::makeArrayRef(Storage, Data->getNumChildren());
122  }
123 
124  MutableArrayRef<Expr *> getVars() {
125  auto **Storage = reinterpret_cast<Expr **>(Data->getChildren().data());
126  return llvm::makeMutableArrayRef(Storage, Data->getNumChildren());
127  }
128 
129  void setVars(ArrayRef<Expr *> VL);
130 
131 public:
132  static OMPThreadPrivateDecl *Create(ASTContext &C, DeclContext *DC,
133  SourceLocation L,
134  ArrayRef<Expr *> VL);
135  static OMPThreadPrivateDecl *CreateDeserialized(ASTContext &C,
136  unsigned ID, unsigned N);
137 
140  typedef llvm::iterator_range<varlist_iterator> varlist_range;
141  typedef llvm::iterator_range<varlist_const_iterator> varlist_const_range;
142 
143  unsigned varlist_size() const { return Data->getNumChildren(); }
144  bool varlist_empty() const { return Data->getChildren().empty(); }
145 
148  }
151  }
152  varlist_iterator varlist_begin() { return getVars().begin(); }
153  varlist_iterator varlist_end() { return getVars().end(); }
154  varlist_const_iterator varlist_begin() const { return getVars().begin(); }
155  varlist_const_iterator varlist_end() const { return getVars().end(); }
156 
157  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
158  static bool classofKind(Kind K) { return K == OMPThreadPrivate; }
159 };
160 
161 /// This represents '#pragma omp declare reduction ...' directive.
162 /// For example, in the following, declared reduction 'foo' for types 'int' and
163 /// 'float':
164 ///
165 /// \code
166 /// #pragma omp declare reduction (foo : int,float : omp_out += omp_in) \
167 /// initializer (omp_priv = 0)
168 /// \endcode
169 ///
170 /// Here 'omp_out += omp_in' is a combiner and 'omp_priv = 0' is an initializer.
171 class OMPDeclareReductionDecl final : public ValueDecl, public DeclContext {
172  // This class stores some data in DeclContext::OMPDeclareReductionDeclBits
173  // to save some space. Use the provided accessors to access it.
174 public:
175  enum InitKind {
176  CallInit, // Initialized by function call.
177  DirectInit, // omp_priv(<expr>)
178  CopyInit // omp_priv = <expr>
179  };
180 
181 private:
182  friend class ASTDeclReader;
183  /// Combiner for declare reduction construct.
184  Expr *Combiner = nullptr;
185  /// Initializer for declare reduction construct.
186  Expr *Initializer = nullptr;
187  /// In parameter of the combiner.
188  Expr *In = nullptr;
189  /// Out parameter of the combiner.
190  Expr *Out = nullptr;
191  /// Priv parameter of the initializer.
192  Expr *Priv = nullptr;
193  /// Orig parameter of the initializer.
194  Expr *Orig = nullptr;
195 
196  /// Reference to the previous declare reduction construct in the same
197  /// scope with the same name. Required for proper templates instantiation if
198  /// the declare reduction construct is declared inside compound statement.
199  LazyDeclPtr PrevDeclInScope;
200 
201  void anchor() override;
202 
204  DeclarationName Name, QualType Ty,
205  OMPDeclareReductionDecl *PrevDeclInScope);
206 
207  void setPrevDeclInScope(OMPDeclareReductionDecl *Prev) {
208  PrevDeclInScope = Prev;
209  }
210 
211 public:
212  /// Create declare reduction node.
213  static OMPDeclareReductionDecl *
215  QualType T, OMPDeclareReductionDecl *PrevDeclInScope);
216  /// Create deserialized declare reduction node.
218  unsigned ID);
219 
220  /// Get combiner expression of the declare reduction construct.
221  Expr *getCombiner() { return Combiner; }
222  const Expr *getCombiner() const { return Combiner; }
223  /// Get In variable of the combiner.
224  Expr *getCombinerIn() { return In; }
225  const Expr *getCombinerIn() const { return In; }
226  /// Get Out variable of the combiner.
227  Expr *getCombinerOut() { return Out; }
228  const Expr *getCombinerOut() const { return Out; }
229  /// Set combiner expression for the declare reduction construct.
230  void setCombiner(Expr *E) { Combiner = E; }
231  /// Set combiner In and Out vars.
232  void setCombinerData(Expr *InE, Expr *OutE) {
233  In = InE;
234  Out = OutE;
235  }
236 
237  /// Get initializer expression (if specified) of the declare reduction
238  /// construct.
240  const Expr *getInitializer() const { return Initializer; }
241  /// Get initializer kind.
243  return static_cast<InitKind>(OMPDeclareReductionDeclBits.InitializerKind);
244  }
245  /// Get Orig variable of the initializer.
246  Expr *getInitOrig() { return Orig; }
247  const Expr *getInitOrig() const { return Orig; }
248  /// Get Priv variable of the initializer.
249  Expr *getInitPriv() { return Priv; }
250  const Expr *getInitPriv() const { return Priv; }
251  /// Set initializer expression for the declare reduction construct.
252  void setInitializer(Expr *E, InitKind IK) {
253  Initializer = E;
254  OMPDeclareReductionDeclBits.InitializerKind = IK;
255  }
256  /// Set initializer Orig and Priv vars.
257  void setInitializerData(Expr *OrigE, Expr *PrivE) {
258  Orig = OrigE;
259  Priv = PrivE;
260  }
261 
262  /// Get reference to previous declare reduction construct in the same
263  /// scope with the same name.
266 
267  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
268  static bool classofKind(Kind K) { return K == OMPDeclareReduction; }
270  return static_cast<DeclContext *>(const_cast<OMPDeclareReductionDecl *>(D));
271  }
273  return static_cast<OMPDeclareReductionDecl *>(
274  const_cast<DeclContext *>(DC));
275  }
276 };
277 
278 /// This represents '#pragma omp declare mapper ...' directive. Map clauses are
279 /// allowed to use with this directive. The following example declares a user
280 /// defined mapper for the type 'struct vec'. This example instructs the fields
281 /// 'len' and 'data' should be mapped when mapping instances of 'struct vec'.
282 ///
283 /// \code
284 /// #pragma omp declare mapper(mid: struct vec v) map(v.len, v.data[0:N])
285 /// \endcode
286 class OMPDeclareMapperDecl final : public OMPDeclarativeDirective<ValueDecl>,
287  public DeclContext {
289  friend class ASTDeclReader;
290  friend class ASTDeclWriter;
291 
292  /// Mapper variable, which is 'v' in the example above
293  Expr *MapperVarRef = nullptr;
294 
295  /// Name of the mapper variable
296  DeclarationName VarName;
297 
298  LazyDeclPtr PrevDeclInScope;
299 
300  void anchor() override;
301 
303  QualType Ty, DeclarationName VarName,
304  OMPDeclareMapperDecl *PrevDeclInScope)
305  : OMPDeclarativeDirective<ValueDecl>(OMPDeclareMapper, DC, L, Name, Ty),
306  DeclContext(OMPDeclareMapper), VarName(VarName),
307  PrevDeclInScope(PrevDeclInScope) {}
308 
309  void setPrevDeclInScope(OMPDeclareMapperDecl *Prev) {
310  PrevDeclInScope = Prev;
311  }
312 
313 public:
314  /// Creates declare mapper node.
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  /// Creates deserialized declare mapper node.
321  static OMPDeclareMapperDecl *CreateDeserialized(ASTContext &C, unsigned ID,
322  unsigned N);
323 
326  using clauselist_range = llvm::iterator_range<clauselist_iterator>;
327  using clauselist_const_range =
328  llvm::iterator_range<clauselist_const_iterator>;
329 
330  unsigned clauselist_size() const { return Data->getNumClauses(); }
331  bool clauselist_empty() const { return Data->getClauses().empty(); }
332 
335  }
338  }
342  return Data->getClauses().begin();
343  }
345  return Data->getClauses().end();
346  }
347 
348  /// Get the variable declared in the mapper
349  Expr *getMapperVarRef() { return cast_or_null<Expr>(Data->getChildren()[0]); }
350  const Expr *getMapperVarRef() const {
351  return cast_or_null<Expr>(Data->getChildren()[0]);
352  }
353  /// Set the variable declared in the mapper
354  void setMapperVarRef(Expr *MapperVarRefE) {
355  Data->getChildren()[0] = MapperVarRefE;
356  }
357 
358  /// Get the name of the variable declared in the mapper
359  DeclarationName getVarName() { return VarName; }
360 
361  /// Get reference to previous declare mapper construct in the same
362  /// scope with the same name.
365 
366  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
367  static bool classofKind(Kind K) { return K == OMPDeclareMapper; }
369  return static_cast<DeclContext *>(const_cast<OMPDeclareMapperDecl *>(D));
370  }
372  return static_cast<OMPDeclareMapperDecl *>(const_cast<DeclContext *>(DC));
373  }
374 };
375 
376 /// Pseudo declaration for capturing expressions. Also is used for capturing of
377 /// non-static data members in non-static member functions.
378 ///
379 /// Clang supports capturing of variables only, but OpenMP 4.5 allows to
380 /// privatize non-static members of current class in non-static member
381 /// functions. This pseudo-declaration allows properly handle this kind of
382 /// capture by wrapping captured expression into a variable-like declaration.
383 class OMPCapturedExprDecl final : public VarDecl {
384  friend class ASTDeclReader;
385  void anchor() override;
386 
388  QualType Type, TypeSourceInfo *TInfo,
389  SourceLocation StartLoc)
390  : VarDecl(OMPCapturedExpr, C, DC, StartLoc, StartLoc, Id, Type, TInfo,
391  SC_None) {
392  setImplicit();
393  }
394 
395 public:
398  SourceLocation StartLoc);
399 
401 
402  SourceRange getSourceRange() const override LLVM_READONLY;
403 
404  // Implement isa/cast/dyncast/etc.
405  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
406  static bool classofKind(Kind K) { return K == OMPCapturedExpr; }
407 };
408 
409 /// This represents '#pragma omp requires...' directive.
410 /// For example
411 ///
412 /// \code
413 /// #pragma omp requires unified_address
414 /// \endcode
415 ///
416 class OMPRequiresDecl final : public OMPDeclarativeDirective<Decl> {
418  friend class ASTDeclReader;
419 
420  virtual void anchor();
421 
423  : OMPDeclarativeDirective<Decl>(OMPRequires, DC, L) {}
424 
425 public:
426  /// Create requires node.
429  /// Create deserialized requires node.
430  static OMPRequiresDecl *CreateDeserialized(ASTContext &C, unsigned ID,
431  unsigned N);
432 
435  using clauselist_range = llvm::iterator_range<clauselist_iterator>;
436  using clauselist_const_range = llvm::iterator_range<clauselist_const_iterator>;
437 
438  unsigned clauselist_size() const { return Data->getNumClauses(); }
439  bool clauselist_empty() const { return Data->getClauses().empty(); }
440 
443  }
446  }
450  return Data->getClauses().begin();
451  }
453  return Data->getClauses().end();
454  }
455 
456  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
457  static bool classofKind(Kind K) { return K == OMPRequires; }
458 };
459 
460 /// This represents '#pragma omp allocate ...' directive.
461 /// For example, in the following, the default allocator is used for both 'a'
462 /// and 'A::b':
463 ///
464 /// \code
465 /// int a;
466 /// #pragma omp allocate(a)
467 /// struct A {
468 /// static int b;
469 /// #pragma omp allocate(b)
470 /// };
471 /// \endcode
472 ///
473 class OMPAllocateDecl final : public OMPDeclarativeDirective<Decl> {
475  friend class ASTDeclReader;
476 
477  virtual void anchor();
478 
480  : OMPDeclarativeDirective<Decl>(OMPAllocate, DC, L) {}
481 
482  ArrayRef<const Expr *> getVars() const {
483  auto **Storage = reinterpret_cast<Expr **>(Data->getChildren().data());
484  return llvm::makeArrayRef(Storage, Data->getNumChildren());
485  }
486 
487  MutableArrayRef<Expr *> getVars() {
488  auto **Storage = reinterpret_cast<Expr **>(Data->getChildren().data());
489  return llvm::makeMutableArrayRef(Storage, Data->getNumChildren());
490  }
491 
492  void setVars(ArrayRef<Expr *> VL);
493 
494 public:
495  static OMPAllocateDecl *Create(ASTContext &C, DeclContext *DC,
496  SourceLocation L, ArrayRef<Expr *> VL,
497  ArrayRef<OMPClause *> CL);
498  static OMPAllocateDecl *CreateDeserialized(ASTContext &C, unsigned ID,
499  unsigned NVars, unsigned NClauses);
500 
503  typedef llvm::iterator_range<varlist_iterator> varlist_range;
504  typedef llvm::iterator_range<varlist_const_iterator> varlist_const_range;
507  using clauselist_range = llvm::iterator_range<clauselist_iterator>;
508  using clauselist_const_range = llvm::iterator_range<clauselist_const_iterator>;
509 
510  unsigned varlist_size() const { return Data->getNumChildren(); }
511  bool varlist_empty() const { return Data->getChildren().empty(); }
512  unsigned clauselist_size() const { return Data->getNumClauses(); }
513  bool clauselist_empty() const { return Data->getClauses().empty(); }
514 
517  }
520  }
521  varlist_iterator varlist_begin() { return getVars().begin(); }
522  varlist_iterator varlist_end() { return getVars().end(); }
523  varlist_const_iterator varlist_begin() const { return getVars().begin(); }
524  varlist_const_iterator varlist_end() const { return getVars().end(); }
525 
528  }
531  }
535  return Data->getClauses().begin();
536  }
538  return Data->getClauses().end();
539  }
540 
541  static bool classof(const Decl *D) { return classofKind(D->getKind()); }
542  static bool classofKind(Kind K) { return K == OMPAllocate; }
543 };
544 
545 } // end namespace clang
546 
547 #endif
clauselist_range clauselists()
Definition: DeclOpenMP.h:333
Defines the clang::ASTContext interface.
static bool classof(const Decl *D)
Definition: DeclOpenMP.h:366
static bool classof(const Decl *D)
Definition: DeclOpenMP.h:541
void setImplicit(bool I=true)
Definition: DeclBase.h:564
This is a basic class for representing single OpenMP declarative directive.
Definition: DeclOpenMP.h:30
OMPDeclareMapperDecl * getPrevDeclInScope()
Get reference to previous declare mapper construct in the same scope with the same name.
Definition: DeclOpenMP.cpp:158
unsigned getNumClauses() const
void setInitializerData(Expr *OrigE, Expr *PrivE)
Set initializer Orig and Priv vars.
Definition: DeclOpenMP.h:257
const Expr * getCombiner() const
Definition: DeclOpenMP.h:222
MutableArrayRef< OMPClause * >::iterator clauselist_iterator
Definition: DeclOpenMP.h:433
A (possibly-)qualified type.
Definition: Type.h:661
clauselist_const_range clauselists() const
Definition: DeclOpenMP.h:529
static T * createDirective(const ASTContext &C, DeclContext *DC, ArrayRef< OMPClause * > Clauses, unsigned NumChildren, Params &&... P)
Definition: DeclOpenMP.h:50
varlist_iterator varlist_end()
Definition: DeclOpenMP.h:522
clauselist_iterator clauselist_end()
Definition: DeclOpenMP.h:533
ArrayRef< OMPClause * > clauses() const
Definition: DeclOpenMP.h:91
unsigned getNumClauses() const
Get number of clauses.
Definition: DeclOpenMP.h:79
This represents '#pragma omp allocate ...' directive.
Definition: DeclOpenMP.h:473
C Language Family Type Representation.
unsigned clauselist_size() const
Definition: DeclOpenMP.h:512
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:89
ArrayRef< const OMPClause * >::iterator clauselist_const_iterator
Definition: DeclOpenMP.h:325
clauselist_iterator clauselist_end()
Definition: DeclOpenMP.h:340
StringRef P
clauselist_const_range clauselists() const
Definition: DeclOpenMP.h:444
The base class of the type hierarchy.
Definition: Type.h:1478
static OMPDeclareMapperDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, QualType T, DeclarationName VarName, ArrayRef< OMPClause * > Clauses, OMPDeclareMapperDecl *PrevDeclInScope)
Creates declare mapper node.
Definition: DeclOpenMP.cpp:142
llvm::iterator_range< clauselist_iterator > clauselist_range
Definition: DeclOpenMP.h:507
static OMPDeclareReductionDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, QualType T, OMPDeclareReductionDecl *PrevDeclInScope)
Create declare reduction node.
Definition: DeclOpenMP.cpp:112
static OMPDeclareReductionDecl * castFromDeclContext(const DeclContext *DC)
Definition: DeclOpenMP.h:272
bool clauselist_empty() const
Definition: DeclOpenMP.h:513
static bool classofKind(Kind K)
Definition: DeclOpenMP.h:457
A container of type source information.
Definition: Type.h:6363
clauselist_iterator clauselist_begin()
Definition: DeclOpenMP.h:339
llvm::iterator_range< varlist_const_iterator > varlist_const_range
Definition: DeclOpenMP.h:141
clauselist_const_iterator clauselist_begin() const
Definition: DeclOpenMP.h:534
unsigned getNumChildren() const
Represents a variable declaration or definition.
Definition: Decl.h:834
ArrayRef< const Expr * >::iterator varlist_const_iterator
Definition: DeclOpenMP.h:502
bool clauselist_empty() const
Definition: DeclOpenMP.h:331
void setCombinerData(Expr *InE, Expr *OutE)
Set combiner In and Out vars.
Definition: DeclOpenMP.h:232
static OMPDeclareMapperDecl * CreateDeserialized(ASTContext &C, unsigned ID, unsigned N)
Creates deserialized declare mapper node.
Definition: DeclOpenMP.cpp:150
static bool classofKind(Kind K)
Definition: DeclOpenMP.h:268
static bool classof(const Decl *D)
Definition: DeclOpenMP.h:267
clauselist_range clauselists()
Definition: DeclOpenMP.h:441
clauselist_const_iterator clauselist_end() const
Definition: DeclOpenMP.h:344
One of these records is kept for each identifier that is lexed.
llvm::iterator_range< clauselist_const_iterator > clauselist_const_range
Definition: DeclOpenMP.h:436
Contains data for OpenMP directives: clauses, children expressions/statements (helpers for codegen) a...
static OMPThreadPrivateDecl * CreateDeserialized(ASTContext &C, unsigned ID, unsigned N)
Definition: DeclOpenMP.cpp:38
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:185
varlist_const_range varlists() const
Definition: DeclOpenMP.h:149
friend class DeclContext
Definition: DeclBase.h:248
Definition: Format.h:2835
InitKind getInitializerKind() const
Get initializer kind.
Definition: DeclOpenMP.h:242
static T * createEmptyDirective(const ASTContext &C, unsigned ID, unsigned NumClauses, unsigned NumChildren, Params &&... P)
Definition: DeclOpenMP.h:62
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
Definition: DeclOpenMP.cpp:187
static OMPCapturedExprDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Definition: DeclOpenMP.cpp:181
MutableArrayRef< OMPClause * >::iterator clauselist_iterator
Definition: DeclOpenMP.h:505
static bool classof(const Decl *D)
Definition: DeclOpenMP.h:405
static bool classof(const Decl *D)
Definition: DeclOpenMP.h:157
Expr * getMapperVarRef()
Get the variable declared in the mapper.
Definition: DeclOpenMP.h:349
Expr * getInitializer()
Get initializer expression (if specified) of the declare reduction construct.
Definition: DeclOpenMP.h:239
bool clauselist_empty() const
Definition: DeclOpenMP.h:439
clauselist_const_iterator clauselist_begin() const
Definition: DeclOpenMP.h:449
varlist_const_iterator varlist_begin() const
Definition: DeclOpenMP.h:523
static DeclContext * castToDeclContext(const OMPDeclareMapperDecl *D)
Definition: DeclOpenMP.h:368
ArrayRef< const OMPClause * >::iterator clauselist_const_iterator
Definition: DeclOpenMP.h:434
llvm::iterator_range< varlist_const_iterator > varlist_const_range
Definition: DeclOpenMP.h:504
static bool classofKind(Kind K)
Definition: DeclOpenMP.h:367
unsigned varlist_size() const
Definition: DeclOpenMP.h:510
varlist_const_iterator varlist_begin() const
Definition: DeclOpenMP.h:154
const Expr * getInitPriv() const
Definition: DeclOpenMP.h:250
static OMPThreadPrivateDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, ArrayRef< Expr * > VL)
Definition: DeclOpenMP.cpp:28
DeclarationName getVarName()
Get the name of the variable declared in the mapper.
Definition: DeclOpenMP.h:359
MutableArrayRef< OMPClause * > getClauses()
Get the clauses storage.
static OMPRequiresDecl * CreateDeserialized(ASTContext &C, unsigned ID, unsigned N)
Create deserialized requires node.
Definition: DeclOpenMP.cpp:92
Expr * getCombiner()
Get combiner expression of the declare reduction construct.
Definition: DeclOpenMP.h:221
MutableArrayRef< Expr * >::iterator varlist_iterator
Definition: DeclOpenMP.h:138
clauselist_const_range clauselists() const
Definition: DeclOpenMP.h:336
This represents '#pragma omp requires...' directive.
Definition: DeclOpenMP.h:416
varlist_iterator varlist_begin()
Definition: DeclOpenMP.h:521
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Definition: Decl.h:634
This represents one expression.
Definition: Expr.h:109
const Expr * getCombinerIn() const
Definition: DeclOpenMP.h:225
int Id
Definition: ASTDiff.cpp:191
OMPDeclareReductionDecl * getPrevDeclInScope()
Get reference to previous declare reduction construct in the same scope with the same name.
Definition: DeclOpenMP.cpp:126
const Expr * getCombinerOut() const
Definition: DeclOpenMP.h:228
static bool classof(const Decl *D)
Definition: DeclOpenMP.h:456
MutableArrayRef< Stmt * > getChildren()
Definition: StmtOpenMP.cpp:33
clauselist_range clauselists()
Definition: DeclOpenMP.h:526
Expr * getInitPriv()
Get Priv variable of the initializer.
Definition: DeclOpenMP.h:249
llvm::iterator_range< clauselist_iterator > clauselist_range
Definition: DeclOpenMP.h:326
This file defines OpenMP AST classes for clauses.
static OMPAllocateDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, ArrayRef< Expr * > VL, ArrayRef< OMPClause * > CL)
Definition: DeclOpenMP.cpp:57
static OMPAllocateDecl * CreateDeserialized(ASTContext &C, unsigned ID, unsigned NVars, unsigned NClauses)
Definition: DeclOpenMP.cpp:66
clauselist_const_iterator clauselist_end() const
Definition: DeclOpenMP.h:537
varlist_const_iterator varlist_end() const
Definition: DeclOpenMP.h:524
clauselist_const_iterator clauselist_end() const
Definition: DeclOpenMP.h:452
static bool classofKind(Kind K)
Definition: DeclOpenMP.h:542
OMPDeclarativeDirective(Params &&... P)
Build instance of directive.
Definition: DeclOpenMP.h:47
Encodes a location in the source.
clauselist_iterator clauselist_begin()
Definition: DeclOpenMP.h:532
This represents '#pragma omp declare reduction ...' directive.
Definition: DeclOpenMP.h:171
Pseudo declaration for capturing expressions.
Definition: DeclOpenMP.h:383
varlist_const_range varlists() const
Definition: DeclOpenMP.h:518
varlist_iterator varlist_begin()
Definition: DeclOpenMP.h:152
This is a basic class for representing single OpenMP clause.
Definition: OpenMPClause.h:54
DeclContext(Decl::Kind K)
Definition: DeclBase.cpp:1056
void setInitializer(Expr *E, InitKind IK)
Set initializer expression for the declare reduction construct.
Definition: DeclOpenMP.h:252
void setMapperVarRef(Expr *MapperVarRefE)
Set the variable declared in the mapper.
Definition: DeclOpenMP.h:354
static bool classofKind(Kind K)
Definition: DeclOpenMP.h:406
clauselist_iterator clauselist_begin()
Definition: DeclOpenMP.h:447
static DeclContext * castToDeclContext(const OMPDeclareReductionDecl *D)
Definition: DeclOpenMP.h:269
Expr * getInitOrig()
Get Orig variable of the initializer.
Definition: DeclOpenMP.h:246
static OMPCapturedExprDecl * Create(ASTContext &C, DeclContext *DC, IdentifierInfo *Id, QualType T, SourceLocation StartLoc)
Definition: DeclOpenMP.cpp:174
Dataflow Directional Tag Classes.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Definition: DeclBase.h:1302
static OMPDeclareMapperDecl * castFromDeclContext(const DeclContext *DC)
Definition: DeclOpenMP.h:371
The name of a declaration.
static size_t size(unsigned NumClauses, unsigned NumChildren)
Definition: DeclOpenMP.h:72
Kind getKind() const
Definition: DeclBase.h:433
varlist_const_iterator varlist_end() const
Definition: DeclOpenMP.h:155
static bool classofKind(Kind K)
Definition: DeclOpenMP.h:158
const Expr * getInitOrig() const
Definition: DeclOpenMP.h:247
MutableArrayRef< Expr * >::iterator varlist_iterator
Definition: DeclOpenMP.h:501
llvm::iterator_range< clauselist_const_iterator > clauselist_const_range
Definition: DeclOpenMP.h:328
void setCombiner(Expr *E)
Set combiner expression for the declare reduction construct.
Definition: DeclOpenMP.h:230
clauselist_const_iterator clauselist_begin() const
Definition: DeclOpenMP.h:341
clauselist_iterator clauselist_end()
Definition: DeclOpenMP.h:448
const Expr * getInitializer() const
Definition: DeclOpenMP.h:240
MutableArrayRef< OMPClause * >::iterator clauselist_iterator
Definition: DeclOpenMP.h:324
ArrayRef< const OMPClause * >::iterator clauselist_const_iterator
Definition: DeclOpenMP.h:506
unsigned clauselist_size() const
Definition: DeclOpenMP.h:330
varlist_iterator varlist_end()
Definition: DeclOpenMP.h:153
static OMPDeclareReductionDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Create deserialized declare reduction node.
Definition: DeclOpenMP.cpp:120
bool varlist_empty() const
Definition: DeclOpenMP.h:511
This represents '#pragma omp declare mapper ...' directive.
Definition: DeclOpenMP.h:286
llvm::iterator_range< clauselist_const_iterator > clauselist_const_range
Definition: DeclOpenMP.h:508
unsigned clauselist_size() const
Definition: DeclOpenMP.h:438
varlist_range varlists()
Definition: DeclOpenMP.h:515
Kind
Lists the kind of concrete classes of Decl.
Definition: DeclBase.h:92
Expr * getCombinerIn()
Get In variable of the combiner.
Definition: DeclOpenMP.h:224
unsigned varlist_size() const
Definition: DeclOpenMP.h:143
OMPChildren * Data
Data, associated with the directive.
Definition: DeclOpenMP.h:43
varlist_range varlists()
Definition: DeclOpenMP.h:146
llvm::iterator_range< varlist_iterator > varlist_range
Definition: DeclOpenMP.h:140
llvm::iterator_range< clauselist_iterator > clauselist_range
Definition: DeclOpenMP.h:435
A trivial tuple used to represent a source range.
OMPDeclareReductionDeclBitfields OMPDeclareReductionDeclBits
Definition: DeclBase.h:1755
static OMPRequiresDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, ArrayRef< OMPClause * > CL)
Create requires node.
Definition: DeclOpenMP.cpp:85
OMPClause * getClause(unsigned I) const
Returns specified clause.
Definition: DeclOpenMP.h:89
llvm::iterator_range< varlist_iterator > varlist_range
Definition: DeclOpenMP.h:503
Expr * getCombinerOut()
Get Out variable of the combiner.
Definition: DeclOpenMP.h:227
ArrayRef< const Expr * >::iterator varlist_const_iterator
Definition: DeclOpenMP.h:139
This represents '#pragma omp threadprivate ...' directive.
Definition: DeclOpenMP.h:110
const Expr * getMapperVarRef() const
Definition: DeclOpenMP.h:350