Coverage Report

Created: 2020-02-25 14:32

/Users/buildslave/jenkins/workspace/coverage/llvm-project/clang/include/clang/AST/OpenMPClause.h
Line
Count
Source (jump to first uncovered line)
1
//===- OpenMPClause.h - Classes for OpenMP clauses --------------*- 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 AST classes for clauses.
11
/// There are clauses for executable directives, clauses for declarative
12
/// directives and clauses which can be used in both kinds of directives.
13
//
14
//===----------------------------------------------------------------------===//
15
16
#ifndef LLVM_CLANG_AST_OPENMPCLAUSE_H
17
#define LLVM_CLANG_AST_OPENMPCLAUSE_H
18
19
#include "clang/AST/Decl.h"
20
#include "clang/AST/DeclarationName.h"
21
#include "clang/AST/Expr.h"
22
#include "clang/AST/NestedNameSpecifier.h"
23
#include "clang/AST/Stmt.h"
24
#include "clang/AST/StmtIterator.h"
25
#include "clang/Basic/LLVM.h"
26
#include "clang/Basic/OpenMPKinds.h"
27
#include "clang/Basic/SourceLocation.h"
28
#include "llvm/ADT/ArrayRef.h"
29
#include "llvm/ADT/MapVector.h"
30
#include "llvm/ADT/SmallVector.h"
31
#include "llvm/ADT/iterator.h"
32
#include "llvm/ADT/iterator_range.h"
33
#include "llvm/Frontend/OpenMP/OMPConstants.h"
34
#include "llvm/Frontend/OpenMP/OMPContext.h"
35
#include "llvm/Support/Casting.h"
36
#include "llvm/Support/Compiler.h"
37
#include "llvm/Support/TrailingObjects.h"
38
#include <cassert>
39
#include <cstddef>
40
#include <iterator>
41
#include <utility>
42
43
namespace clang {
44
45
class ASTContext;
46
47
//===----------------------------------------------------------------------===//
48
// AST classes for clauses.
49
//===----------------------------------------------------------------------===//
50
51
/// This is a basic class for representing single OpenMP clause.
52
class OMPClause {
53
  /// Starting location of the clause (the clause keyword).
54
  SourceLocation StartLoc;
55
56
  /// Ending location of the clause.
57
  SourceLocation EndLoc;
58
59
  /// Kind of the clause.
60
  OpenMPClauseKind Kind;
61
62
protected:
63
  OMPClause(OpenMPClauseKind K, SourceLocation StartLoc, SourceLocation EndLoc)
64
167k
      : StartLoc(StartLoc), EndLoc(EndLoc), Kind(K) {}
65
66
public:
67
  /// Returns the starting location of the clause.
68
61.9k
  SourceLocation getBeginLoc() const { return StartLoc; }
69
70
  /// Returns the ending location of the clause.
71
57.4k
  SourceLocation getEndLoc() const { return EndLoc; }
72
73
  /// Sets the starting location of the clause.
74
17.5k
  void setLocStart(SourceLocation Loc) { StartLoc = Loc; }
75
76
  /// Sets the ending location of the clause.
77
17.5k
  void setLocEnd(SourceLocation Loc) { EndLoc = Loc; }
78
79
  /// Returns kind of OpenMP clause (private, shared, reduction, etc.).
80
3.22M
  OpenMPClauseKind getClauseKind() const { return Kind; }
81
82
35.6k
  bool isImplicit() const { return StartLoc.isInvalid(); }
83
84
  using child_iterator = StmtIterator;
85
  using const_child_iterator = ConstStmtIterator;
86
  using child_range = llvm::iterator_range<child_iterator>;
87
  using const_child_range = llvm::iterator_range<const_child_iterator>;
88
89
  child_range children();
90
158
  const_child_range children() const {
91
158
    auto Children = const_cast<OMPClause *>(this)->children();
92
158
    return const_child_range(Children.begin(), Children.end());
93
158
  }
94
95
  /// Get the iterator range for the expressions used in the clauses. Used
96
  /// expressions include only the children that must be evaluated at the
97
  /// runtime before entering the construct.
98
  child_range used_children();
99
0
  const_child_range used_children() const {
100
0
    auto Children = const_cast<OMPClause *>(this)->children();
101
0
    return const_child_range(Children.begin(), Children.end());
102
0
  }
103
104
0
  static bool classof(const OMPClause *) { return true; }
105
};
106
107
/// Class that handles pre-initialization statement for some clauses, like
108
/// 'shedule', 'firstprivate' etc.
109
class OMPClauseWithPreInit {
110
  friend class OMPClauseReader;
111
112
  /// Pre-initialization statement for the clause.
113
  Stmt *PreInit = nullptr;
114
115
  /// Region that captures the associated stmt.
116
  OpenMPDirectiveKind CaptureRegion = llvm::omp::OMPD_unknown;
117
118
protected:
119
94.4k
  OMPClauseWithPreInit(const OMPClause *This) {
120
94.4k
    assert(get(This) && "get is not tuned for pre-init.");
121
94.4k
  }
122
123
  /// Set pre-initialization statement for the clause.
124
  void
125
  setPreInitStmt(Stmt *S,
126
94.4k
                 OpenMPDirectiveKind ThisRegion = llvm::omp::OMPD_unknown) {
127
94.4k
    PreInit = S;
128
94.4k
    CaptureRegion = ThisRegion;
129
94.4k
  }
130
131
public:
132
  /// Get pre-initialization statement for the clause.
133
53.0k
  const Stmt *getPreInitStmt() const { return PreInit; }
134
135
  /// Get pre-initialization statement for the clause.
136
19.3k
  Stmt *getPreInitStmt() { return PreInit; }
137
138
  /// Get capture region for the stmt in the clause.
139
48.1k
  OpenMPDirectiveKind getCaptureRegion() const { return CaptureRegion; }
140
141
  static OMPClauseWithPreInit *get(OMPClause *C);
142
  static const OMPClauseWithPreInit *get(const OMPClause *C);
143
};
144
145
/// Class that handles post-update expression for some clauses, like
146
/// 'lastprivate', 'reduction' etc.
147
class OMPClauseWithPostUpdate : public OMPClauseWithPreInit {
148
  friend class OMPClauseReader;
149
150
  /// Post-update expression for the clause.
151
  Expr *PostUpdate = nullptr;
152
153
protected:
154
27.3k
  OMPClauseWithPostUpdate(const OMPClause *This) : OMPClauseWithPreInit(This) {
155
27.3k
    assert(get(This) && "get is not tuned for post-update.");
156
27.3k
  }
157
158
  /// Set pre-initialization statement for the clause.
159
27.3k
  void setPostUpdateExpr(Expr *S) { PostUpdate = S; }
160
161
public:
162
  /// Get post-update expression for the clause.
163
2.61k
  const Expr *getPostUpdateExpr() const { return PostUpdate; }
164
165
  /// Get post-update expression for the clause.
166
1.78k
  Expr *getPostUpdateExpr() { return PostUpdate; }
167
168
  static OMPClauseWithPostUpdate *get(OMPClause *C);
169
  static const OMPClauseWithPostUpdate *get(const OMPClause *C);
170
};
171
172
/// This structure contains most locations needed for by an OMPVarListClause.
173
struct OMPVarListLocTy {
174
  /// Starting location of the clause (the clause keyword).
175
  SourceLocation StartLoc;
176
  /// Location of '('.
177
  SourceLocation LParenLoc;
178
  /// Ending location of the clause.
179
  SourceLocation EndLoc;
180
10.8k
  OMPVarListLocTy() = default;
181
  OMPVarListLocTy(SourceLocation StartLoc, SourceLocation LParenLoc,
182
                  SourceLocation EndLoc)
183
64.0k
      : StartLoc(StartLoc), LParenLoc(LParenLoc), EndLoc(EndLoc) {}
184
};
185
186
/// This represents clauses with the list of variables like 'private',
187
/// 'firstprivate', 'copyin', 'shared', or 'reduction' clauses in the
188
/// '#pragma omp ...' directives.
189
template <class T> class OMPVarListClause : public OMPClause {
190
  friend class OMPClauseReader;
191
192
  /// Location of '('.
193
  SourceLocation LParenLoc;
194
195
  /// Number of variables in the list.
196
  unsigned NumVars;
197
198
protected:
199
  /// Build a clause with \a N variables
200
  ///
201
  /// \param K Kind of the clause.
202
  /// \param StartLoc Starting location of the clause (the clause keyword).
203
  /// \param LParenLoc Location of '('.
204
  /// \param EndLoc Ending location of the clause.
205
  /// \param N Number of the variables in the clause.
206
  OMPVarListClause(OpenMPClauseKind K, SourceLocation StartLoc,
207
                   SourceLocation LParenLoc, SourceLocation EndLoc, unsigned N)
208
120k
      : OMPClause(K, StartLoc, EndLoc), LParenLoc(LParenLoc), NumVars(N) {}
clang::OMPVarListClause<clang::OMPPrivateClause>::OMPVarListClause(clang::OpenMPClauseKind, clang::SourceLocation, clang::SourceLocation, clang::SourceLocation, unsigned int)
Line
Count
Source
208
11.7k
      : OMPClause(K, StartLoc, EndLoc), LParenLoc(LParenLoc), NumVars(N) {}
clang::OMPVarListClause<clang::OMPFirstprivateClause>::OMPVarListClause(clang::OpenMPClauseKind, clang::SourceLocation, clang::SourceLocation, clang::SourceLocation, unsigned int)
Line
Count
Source
208
42.8k
      : OMPClause(K, StartLoc, EndLoc), LParenLoc(LParenLoc), NumVars(N) {}
clang::OMPVarListClause<clang::OMPLastprivateClause>::OMPVarListClause(clang::OpenMPClauseKind, clang::SourceLocation, clang::SourceLocation, clang::SourceLocation, unsigned int)
Line
Count
Source
208
6.20k
      : OMPClause(K, StartLoc, EndLoc), LParenLoc(LParenLoc), NumVars(N) {}
clang::OMPVarListClause<clang::OMPSharedClause>::OMPVarListClause(clang::OpenMPClauseKind, clang::SourceLocation, clang::SourceLocation, clang::SourceLocation, unsigned int)
Line
Count
Source
208
3.20k
      : OMPClause(K, StartLoc, EndLoc), LParenLoc(LParenLoc), NumVars(N) {}
clang::OMPVarListClause<clang::OMPLinearClause>::OMPVarListClause(clang::OpenMPClauseKind, clang::SourceLocation, clang::SourceLocation, clang::SourceLocation, unsigned int)
Line
Count
Source
208
2.93k
      : OMPClause(K, StartLoc, EndLoc), LParenLoc(LParenLoc), NumVars(N) {}
clang::OMPVarListClause<clang::OMPAlignedClause>::OMPVarListClause(clang::OpenMPClauseKind, clang::SourceLocation, clang::SourceLocation, clang::SourceLocation, unsigned int)
Line
Count
Source
208
1.93k
      : OMPClause(K, StartLoc, EndLoc), LParenLoc(LParenLoc), NumVars(N) {}
clang::OMPVarListClause<clang::OMPCopyinClause>::OMPVarListClause(clang::OpenMPClauseKind, clang::SourceLocation, clang::SourceLocation, clang::SourceLocation, unsigned int)
Line
Count
Source
208
471
      : OMPClause(K, StartLoc, EndLoc), LParenLoc(LParenLoc), NumVars(N) {}
clang::OMPVarListClause<clang::OMPCopyprivateClause>::OMPVarListClause(clang::OpenMPClauseKind, clang::SourceLocation, clang::SourceLocation, clang::SourceLocation, unsigned int)
Line
Count
Source
208
162
      : OMPClause(K, StartLoc, EndLoc), LParenLoc(LParenLoc), NumVars(N) {}
clang::OMPVarListClause<clang::OMPReductionClause>::OMPVarListClause(clang::OpenMPClauseKind, clang::SourceLocation, clang::SourceLocation, clang::SourceLocation, unsigned int)
Line
Count
Source
208
14.3k
      : OMPClause(K, StartLoc, EndLoc), LParenLoc(LParenLoc), NumVars(N) {}
clang::OMPVarListClause<clang::OMPTaskReductionClause>::OMPVarListClause(clang::OpenMPClauseKind, clang::SourceLocation, clang::SourceLocation, clang::SourceLocation, unsigned int)
Line
Count
Source
208
2.34k
      : OMPClause(K, StartLoc, EndLoc), LParenLoc(LParenLoc), NumVars(N) {}
clang::OMPVarListClause<clang::OMPInReductionClause>::OMPVarListClause(clang::OpenMPClauseKind, clang::SourceLocation, clang::SourceLocation, clang::SourceLocation, unsigned int)
Line
Count
Source
208
1.47k
      : OMPClause(K, StartLoc, EndLoc), LParenLoc(LParenLoc), NumVars(N) {}
clang::OMPVarListClause<clang::OMPAllocateClause>::OMPVarListClause(clang::OpenMPClauseKind, clang::SourceLocation, clang::SourceLocation, clang::SourceLocation, unsigned int)
Line
Count
Source
208
1.64k
      : OMPClause(K, StartLoc, EndLoc), LParenLoc(LParenLoc), NumVars(N) {}
clang::OMPVarListClause<clang::OMPFlushClause>::OMPVarListClause(clang::OpenMPClauseKind, clang::SourceLocation, clang::SourceLocation, clang::SourceLocation, unsigned int)
Line
Count
Source
208
100
      : OMPClause(K, StartLoc, EndLoc), LParenLoc(LParenLoc), NumVars(N) {}
clang::OMPVarListClause<clang::OMPDependClause>::OMPVarListClause(clang::OpenMPClauseKind, clang::SourceLocation, clang::SourceLocation, clang::SourceLocation, unsigned int)
Line
Count
Source
208
2.75k
      : OMPClause(K, StartLoc, EndLoc), LParenLoc(LParenLoc), NumVars(N) {}
clang::OMPVarListClause<clang::OMPMapClause>::OMPVarListClause(clang::OpenMPClauseKind, clang::SourceLocation, clang::SourceLocation, clang::SourceLocation, unsigned int)
Line
Count
Source
208
22.5k
      : OMPClause(K, StartLoc, EndLoc), LParenLoc(LParenLoc), NumVars(N) {}
clang::OMPVarListClause<clang::OMPToClause>::OMPVarListClause(clang::OpenMPClauseKind, clang::SourceLocation, clang::SourceLocation, clang::SourceLocation, unsigned int)
Line
Count
Source
208
1.15k
      : OMPClause(K, StartLoc, EndLoc), LParenLoc(LParenLoc), NumVars(N) {}
clang::OMPVarListClause<clang::OMPFromClause>::OMPVarListClause(clang::OpenMPClauseKind, clang::SourceLocation, clang::SourceLocation, clang::SourceLocation, unsigned int)
Line
Count
Source
208
474
      : OMPClause(K, StartLoc, EndLoc), LParenLoc(LParenLoc), NumVars(N) {}
clang::OMPVarListClause<clang::OMPUseDevicePtrClause>::OMPVarListClause(clang::OpenMPClauseKind, clang::SourceLocation, clang::SourceLocation, clang::SourceLocation, unsigned int)
Line
Count
Source
208
428
      : OMPClause(K, StartLoc, EndLoc), LParenLoc(LParenLoc), NumVars(N) {}
clang::OMPVarListClause<clang::OMPIsDevicePtrClause>::OMPVarListClause(clang::OpenMPClauseKind, clang::SourceLocation, clang::SourceLocation, clang::SourceLocation, unsigned int)
Line
Count
Source
208
2.72k
      : OMPClause(K, StartLoc, EndLoc), LParenLoc(LParenLoc), NumVars(N) {}
clang::OMPVarListClause<clang::OMPNontemporalClause>::OMPVarListClause(clang::OpenMPClauseKind, clang::SourceLocation, clang::SourceLocation, clang::SourceLocation, unsigned int)
Line
Count
Source
208
504
      : OMPClause(K, StartLoc, EndLoc), LParenLoc(LParenLoc), NumVars(N) {}
209
210
  /// Fetches list of variables associated with this clause.
211
874k
  MutableArrayRef<Expr *> getVarRefs() {
212
874k
    return MutableArrayRef<Expr *>(
213
874k
        static_cast<T *>(this)->template getTrailingObjects<Expr *>(), NumVars);
214
874k
  }
clang::OMPVarListClause<clang::OMPAllocateClause>::getVarRefs()
Line
Count
Source
211
6.75k
  MutableArrayRef<Expr *> getVarRefs() {
212
6.75k
    return MutableArrayRef<Expr *>(
213
6.75k
        static_cast<T *>(this)->template getTrailingObjects<Expr *>(), NumVars);
214
6.75k
  }
clang::OMPVarListClause<clang::OMPPrivateClause>::getVarRefs()
Line
Count
Source
211
85.3k
  MutableArrayRef<Expr *> getVarRefs() {
212
85.3k
    return MutableArrayRef<Expr *>(
213
85.3k
        static_cast<T *>(this)->template getTrailingObjects<Expr *>(), NumVars);
214
85.3k
  }
clang::OMPVarListClause<clang::OMPFirstprivateClause>::getVarRefs()
Line
Count
Source
211
314k
  MutableArrayRef<Expr *> getVarRefs() {
212
314k
    return MutableArrayRef<Expr *>(
213
314k
        static_cast<T *>(this)->template getTrailingObjects<Expr *>(), NumVars);
214
314k
  }
clang::OMPVarListClause<clang::OMPLastprivateClause>::getVarRefs()
Line
Count
Source
211
79.5k
  MutableArrayRef<Expr *> getVarRefs() {
212
79.5k
    return MutableArrayRef<Expr *>(
213
79.5k
        static_cast<T *>(this)->template getTrailingObjects<Expr *>(), NumVars);
214
79.5k
  }
clang::OMPVarListClause<clang::OMPSharedClause>::getVarRefs()
Line
Count
Source
211
6.06k
  MutableArrayRef<Expr *> getVarRefs() {
212
6.06k
    return MutableArrayRef<Expr *>(
213
6.06k
        static_cast<T *>(this)->template getTrailingObjects<Expr *>(), NumVars);
214
6.06k
  }
clang::OMPVarListClause<clang::OMPReductionClause>::getVarRefs()
Line
Count
Source
211
180k
  MutableArrayRef<Expr *> getVarRefs() {
212
180k
    return MutableArrayRef<Expr *>(
213
180k
        static_cast<T *>(this)->template getTrailingObjects<Expr *>(), NumVars);
214
180k
  }
clang::OMPVarListClause<clang::OMPTaskReductionClause>::getVarRefs()
Line
Count
Source
211
26.2k
  MutableArrayRef<Expr *> getVarRefs() {
212
26.2k
    return MutableArrayRef<Expr *>(
213
26.2k
        static_cast<T *>(this)->template getTrailingObjects<Expr *>(), NumVars);
214
26.2k
  }
clang::OMPVarListClause<clang::OMPInReductionClause>::getVarRefs()
Line
Count
Source
211
24.7k
  MutableArrayRef<Expr *> getVarRefs() {
212
24.7k
    return MutableArrayRef<Expr *>(
213
24.7k
        static_cast<T *>(this)->template getTrailingObjects<Expr *>(), NumVars);
214
24.7k
  }
clang::OMPVarListClause<clang::OMPLinearClause>::getVarRefs()
Line
Count
Source
211
76.9k
  MutableArrayRef<Expr *> getVarRefs() {
212
76.9k
    return MutableArrayRef<Expr *>(
213
76.9k
        static_cast<T *>(this)->template getTrailingObjects<Expr *>(), NumVars);
214
76.9k
  }
clang::OMPVarListClause<clang::OMPAlignedClause>::getVarRefs()
Line
Count
Source
211
6.88k
  MutableArrayRef<Expr *> getVarRefs() {
212
6.88k
    return MutableArrayRef<Expr *>(
213
6.88k
        static_cast<T *>(this)->template getTrailingObjects<Expr *>(), NumVars);
214
6.88k
  }
clang::OMPVarListClause<clang::OMPCopyinClause>::getVarRefs()
Line
Count
Source
211
3.37k
  MutableArrayRef<Expr *> getVarRefs() {
212
3.37k
    return MutableArrayRef<Expr *>(
213
3.37k
        static_cast<T *>(this)->template getTrailingObjects<Expr *>(), NumVars);
214
3.37k
  }
clang::OMPVarListClause<clang::OMPCopyprivateClause>::getVarRefs()
Line
Count
Source
211
1.26k
  MutableArrayRef<Expr *> getVarRefs() {
212
1.26k
    return MutableArrayRef<Expr *>(
213
1.26k
        static_cast<T *>(this)->template getTrailingObjects<Expr *>(), NumVars);
214
1.26k
  }
clang::OMPVarListClause<clang::OMPFlushClause>::getVarRefs()
Line
Count
Source
211
128
  MutableArrayRef<Expr *> getVarRefs() {
212
128
    return MutableArrayRef<Expr *>(
213
128
        static_cast<T *>(this)->template getTrailingObjects<Expr *>(), NumVars);
214
128
  }
clang::OMPVarListClause<clang::OMPDependClause>::getVarRefs()
Line
Count
Source
211
5.73k
  MutableArrayRef<Expr *> getVarRefs() {
212
5.73k
    return MutableArrayRef<Expr *>(
213
5.73k
        static_cast<T *>(this)->template getTrailingObjects<Expr *>(), NumVars);
214
5.73k
  }
clang::OMPVarListClause<clang::OMPMapClause>::getVarRefs()
Line
Count
Source
211
43.9k
  MutableArrayRef<Expr *> getVarRefs() {
212
43.9k
    return MutableArrayRef<Expr *>(
213
43.9k
        static_cast<T *>(this)->template getTrailingObjects<Expr *>(), NumVars);
214
43.9k
  }
clang::OMPVarListClause<clang::OMPToClause>::getVarRefs()
Line
Count
Source
211
1.11k
  MutableArrayRef<Expr *> getVarRefs() {
212
1.11k
    return MutableArrayRef<Expr *>(
213
1.11k
        static_cast<T *>(this)->template getTrailingObjects<Expr *>(), NumVars);
214
1.11k
  }
clang::OMPVarListClause<clang::OMPFromClause>::getVarRefs()
Line
Count
Source
211
552
  MutableArrayRef<Expr *> getVarRefs() {
212
552
    return MutableArrayRef<Expr *>(
213
552
        static_cast<T *>(this)->template getTrailingObjects<Expr *>(), NumVars);
214
552
  }
clang::OMPVarListClause<clang::OMPUseDevicePtrClause>::getVarRefs()
Line
Count
Source
211
1.76k
  MutableArrayRef<Expr *> getVarRefs() {
212
1.76k
    return MutableArrayRef<Expr *>(
213
1.76k
        static_cast<T *>(this)->template getTrailingObjects<Expr *>(), NumVars);
214
1.76k
  }
clang::OMPVarListClause<clang::OMPIsDevicePtrClause>::getVarRefs()
Line
Count
Source
211
6.08k
  MutableArrayRef<Expr *> getVarRefs() {
212
6.08k
    return MutableArrayRef<Expr *>(
213
6.08k
        static_cast<T *>(this)->template getTrailingObjects<Expr *>(), NumVars);
214
6.08k
  }
clang::OMPVarListClause<clang::OMPNontemporalClause>::getVarRefs()
Line
Count
Source
211
2.56k
  MutableArrayRef<Expr *> getVarRefs() {
212
2.56k
    return MutableArrayRef<Expr *>(
213
2.56k
        static_cast<T *>(this)->template getTrailingObjects<Expr *>(), NumVars);
214
2.56k
  }
215
216
  /// Sets the list of variables for this clause.
217
120k
  void setVarRefs(ArrayRef<Expr *> VL) {
218
120k
    assert(VL.size() == NumVars &&
219
120k
           "Number of variables is not the same as the preallocated buffer");
220
120k
    std::copy(VL.begin(), VL.end(),
221
120k
              static_cast<T *>(this)->template getTrailingObjects<Expr *>());
222
120k
  }
clang::OMPVarListClause<clang::OMPPrivateClause>::setVarRefs(llvm::ArrayRef<clang::Expr*>)
Line
Count
Source
217
11.7k
  void setVarRefs(ArrayRef<Expr *> VL) {
218
11.7k
    assert(VL.size() == NumVars &&
219
11.7k
           "Number of variables is not the same as the preallocated buffer");
220
11.7k
    std::copy(VL.begin(), VL.end(),
221
11.7k
              static_cast<T *>(this)->template getTrailingObjects<Expr *>());
222
11.7k
  }
clang::OMPVarListClause<clang::OMPFirstprivateClause>::setVarRefs(llvm::ArrayRef<clang::Expr*>)
Line
Count
Source
217
42.8k
  void setVarRefs(ArrayRef<Expr *> VL) {
218
42.8k
    assert(VL.size() == NumVars &&
219
42.8k
           "Number of variables is not the same as the preallocated buffer");
220
42.8k
    std::copy(VL.begin(), VL.end(),
221
42.8k
              static_cast<T *>(this)->template getTrailingObjects<Expr *>());
222
42.8k
  }
clang::OMPVarListClause<clang::OMPLastprivateClause>::setVarRefs(llvm::ArrayRef<clang::Expr*>)
Line
Count
Source
217
6.20k
  void setVarRefs(ArrayRef<Expr *> VL) {
218
6.20k
    assert(VL.size() == NumVars &&
219
6.20k
           "Number of variables is not the same as the preallocated buffer");
220
6.20k
    std::copy(VL.begin(), VL.end(),
221
6.20k
              static_cast<T *>(this)->template getTrailingObjects<Expr *>());
222
6.20k
  }
clang::OMPVarListClause<clang::OMPSharedClause>::setVarRefs(llvm::ArrayRef<clang::Expr*>)
Line
Count
Source
217
3.20k
  void setVarRefs(ArrayRef<Expr *> VL) {
218
3.20k
    assert(VL.size() == NumVars &&
219
3.20k
           "Number of variables is not the same as the preallocated buffer");
220
3.20k
    std::copy(VL.begin(), VL.end(),
221
3.20k
              static_cast<T *>(this)->template getTrailingObjects<Expr *>());
222
3.20k
  }
clang::OMPVarListClause<clang::OMPLinearClause>::setVarRefs(llvm::ArrayRef<clang::Expr*>)
Line
Count
Source
217
2.93k
  void setVarRefs(ArrayRef<Expr *> VL) {
218
2.93k
    assert(VL.size() == NumVars &&
219
2.93k
           "Number of variables is not the same as the preallocated buffer");
220
2.93k
    std::copy(VL.begin(), VL.end(),
221
2.93k
              static_cast<T *>(this)->template getTrailingObjects<Expr *>());
222
2.93k
  }
clang::OMPVarListClause<clang::OMPAlignedClause>::setVarRefs(llvm::ArrayRef<clang::Expr*>)
Line
Count
Source
217
1.93k
  void setVarRefs(ArrayRef<Expr *> VL) {
218
1.93k
    assert(VL.size() == NumVars &&
219
1.93k
           "Number of variables is not the same as the preallocated buffer");
220
1.93k
    std::copy(VL.begin(), VL.end(),
221
1.93k
              static_cast<T *>(this)->template getTrailingObjects<Expr *>());
222
1.93k
  }
clang::OMPVarListClause<clang::OMPCopyinClause>::setVarRefs(llvm::ArrayRef<clang::Expr*>)
Line
Count
Source
217
471
  void setVarRefs(ArrayRef<Expr *> VL) {
218
471
    assert(VL.size() == NumVars &&
219
471
           "Number of variables is not the same as the preallocated buffer");
220
471
    std::copy(VL.begin(), VL.end(),
221
471
              static_cast<T *>(this)->template getTrailingObjects<Expr *>());
222
471
  }
clang::OMPVarListClause<clang::OMPCopyprivateClause>::setVarRefs(llvm::ArrayRef<clang::Expr*>)
Line
Count
Source
217
162
  void setVarRefs(ArrayRef<Expr *> VL) {
218
162
    assert(VL.size() == NumVars &&
219
162
           "Number of variables is not the same as the preallocated buffer");
220
162
    std::copy(VL.begin(), VL.end(),
221
162
              static_cast<T *>(this)->template getTrailingObjects<Expr *>());
222
162
  }
clang::OMPVarListClause<clang::OMPReductionClause>::setVarRefs(llvm::ArrayRef<clang::Expr*>)
Line
Count
Source
217
14.3k
  void setVarRefs(ArrayRef<Expr *> VL) {
218
14.3k
    assert(VL.size() == NumVars &&
219
14.3k
           "Number of variables is not the same as the preallocated buffer");
220
14.3k
    std::copy(VL.begin(), VL.end(),
221
14.3k
              static_cast<T *>(this)->template getTrailingObjects<Expr *>());
222
14.3k
  }
clang::OMPVarListClause<clang::OMPTaskReductionClause>::setVarRefs(llvm::ArrayRef<clang::Expr*>)
Line
Count
Source
217
2.34k
  void setVarRefs(ArrayRef<Expr *> VL) {
218
2.34k
    assert(VL.size() == NumVars &&
219
2.34k
           "Number of variables is not the same as the preallocated buffer");
220
2.34k
    std::copy(VL.begin(), VL.end(),
221
2.34k
              static_cast<T *>(this)->template getTrailingObjects<Expr *>());
222
2.34k
  }
clang::OMPVarListClause<clang::OMPInReductionClause>::setVarRefs(llvm::ArrayRef<clang::Expr*>)
Line
Count
Source
217
1.47k
  void setVarRefs(ArrayRef<Expr *> VL) {
218
1.47k
    assert(VL.size() == NumVars &&
219
1.47k
           "Number of variables is not the same as the preallocated buffer");
220
1.47k
    std::copy(VL.begin(), VL.end(),
221
1.47k
              static_cast<T *>(this)->template getTrailingObjects<Expr *>());
222
1.47k
  }
clang::OMPVarListClause<clang::OMPAllocateClause>::setVarRefs(llvm::ArrayRef<clang::Expr*>)
Line
Count
Source
217
1.64k
  void setVarRefs(ArrayRef<Expr *> VL) {
218
1.64k
    assert(VL.size() == NumVars &&
219
1.64k
           "Number of variables is not the same as the preallocated buffer");
220
1.64k
    std::copy(VL.begin(), VL.end(),
221
1.64k
              static_cast<T *>(this)->template getTrailingObjects<Expr *>());
222
1.64k
  }
clang::OMPVarListClause<clang::OMPFlushClause>::setVarRefs(llvm::ArrayRef<clang::Expr*>)
Line
Count
Source
217
100
  void setVarRefs(ArrayRef<Expr *> VL) {
218
100
    assert(VL.size() == NumVars &&
219
100
           "Number of variables is not the same as the preallocated buffer");
220
100
    std::copy(VL.begin(), VL.end(),
221
100
              static_cast<T *>(this)->template getTrailingObjects<Expr *>());
222
100
  }
clang::OMPVarListClause<clang::OMPDependClause>::setVarRefs(llvm::ArrayRef<clang::Expr*>)
Line
Count
Source
217
2.75k
  void setVarRefs(ArrayRef<Expr *> VL) {
218
2.75k
    assert(VL.size() == NumVars &&
219
2.75k
           "Number of variables is not the same as the preallocated buffer");
220
2.75k
    std::copy(VL.begin(), VL.end(),
221
2.75k
              static_cast<T *>(this)->template getTrailingObjects<Expr *>());
222
2.75k
  }
clang::OMPVarListClause<clang::OMPMapClause>::setVarRefs(llvm::ArrayRef<clang::Expr*>)
Line
Count
Source
217
22.5k
  void setVarRefs(ArrayRef<Expr *> VL) {
218
22.5k
    assert(VL.size() == NumVars &&
219
22.5k
           "Number of variables is not the same as the preallocated buffer");
220
22.5k
    std::copy(VL.begin(), VL.end(),
221
22.5k
              static_cast<T *>(this)->template getTrailingObjects<Expr *>());
222
22.5k
  }
clang::OMPVarListClause<clang::OMPToClause>::setVarRefs(llvm::ArrayRef<clang::Expr*>)
Line
Count
Source
217
1.15k
  void setVarRefs(ArrayRef<Expr *> VL) {
218
1.15k
    assert(VL.size() == NumVars &&
219
1.15k
           "Number of variables is not the same as the preallocated buffer");
220
1.15k
    std::copy(VL.begin(), VL.end(),
221
1.15k
              static_cast<T *>(this)->template getTrailingObjects<Expr *>());
222
1.15k
  }
clang::OMPVarListClause<clang::OMPFromClause>::setVarRefs(llvm::ArrayRef<clang::Expr*>)
Line
Count
Source
217
474
  void setVarRefs(ArrayRef<Expr *> VL) {
218
474
    assert(VL.size() == NumVars &&
219
474
           "Number of variables is not the same as the preallocated buffer");
220
474
    std::copy(VL.begin(), VL.end(),
221
474
              static_cast<T *>(this)->template getTrailingObjects<Expr *>());
222
474
  }
clang::OMPVarListClause<clang::OMPUseDevicePtrClause>::setVarRefs(llvm::ArrayRef<clang::Expr*>)
Line
Count
Source
217
428
  void setVarRefs(ArrayRef<Expr *> VL) {
218
428
    assert(VL.size() == NumVars &&
219
428
           "Number of variables is not the same as the preallocated buffer");
220
428
    std::copy(VL.begin(), VL.end(),
221
428
              static_cast<T *>(this)->template getTrailingObjects<Expr *>());
222
428
  }
clang::OMPVarListClause<clang::OMPIsDevicePtrClause>::setVarRefs(llvm::ArrayRef<clang::Expr*>)
Line
Count
Source
217
2.72k
  void setVarRefs(ArrayRef<Expr *> VL) {
218
2.72k
    assert(VL.size() == NumVars &&
219
2.72k
           "Number of variables is not the same as the preallocated buffer");
220
2.72k
    std::copy(VL.begin(), VL.end(),
221
2.72k
              static_cast<T *>(this)->template getTrailingObjects<Expr *>());
222
2.72k
  }
clang::OMPVarListClause<clang::OMPNontemporalClause>::setVarRefs(llvm::ArrayRef<clang::Expr*>)
Line
Count
Source
217
504
  void setVarRefs(ArrayRef<Expr *> VL) {
218
504
    assert(VL.size() == NumVars &&
219
504
           "Number of variables is not the same as the preallocated buffer");
220
504
    std::copy(VL.begin(), VL.end(),
221
504
              static_cast<T *>(this)->template getTrailingObjects<Expr *>());
222
504
  }
223
224
public:
225
  using varlist_iterator = MutableArrayRef<Expr *>::iterator;
226
  using varlist_const_iterator = ArrayRef<const Expr *>::iterator;
227
  using varlist_range = llvm::iterator_range<varlist_iterator>;
228
  using varlist_const_range = llvm::iterator_range<varlist_const_iterator>;
229
230
1.35M
  unsigned varlist_size() const { return NumVars; }
clang::OMPVarListClause<clang::OMPPrivateClause>::varlist_size() const
Line
Count
Source
230
37.3k
  unsigned varlist_size() const { return NumVars; }
clang::OMPVarListClause<clang::OMPFirstprivateClause>::varlist_size() const
Line
Count
Source
230
312k
  unsigned varlist_size() const { return NumVars; }
clang::OMPVarListClause<clang::OMPLastprivateClause>::varlist_size() const
Line
Count
Source
230
99.5k
  unsigned varlist_size() const { return NumVars; }
clang::OMPVarListClause<clang::OMPReductionClause>::varlist_size() const
Line
Count
Source
230
303k
  unsigned varlist_size() const { return NumVars; }
clang::OMPVarListClause<clang::OMPTaskReductionClause>::varlist_size() const
Line
Count
Source
230
41.4k
  unsigned varlist_size() const { return NumVars; }
clang::OMPVarListClause<clang::OMPInReductionClause>::varlist_size() const
Line
Count
Source
230
57.9k
  unsigned varlist_size() const { return NumVars; }
clang::OMPVarListClause<clang::OMPLinearClause>::varlist_size() const
Line
Count
Source
230
210k
  unsigned varlist_size() const { return NumVars; }
clang::OMPVarListClause<clang::OMPCopyinClause>::varlist_size() const
Line
Count
Source
230
4.75k
  unsigned varlist_size() const { return NumVars; }
clang::OMPVarListClause<clang::OMPCopyprivateClause>::varlist_size() const
Line
Count
Source
230
1.73k
  unsigned varlist_size() const { return NumVars; }
clang::OMPVarListClause<clang::OMPMapClause>::varlist_size() const
Line
Count
Source
230
248k
  unsigned varlist_size() const { return NumVars; }
clang::OMPVarListClause<clang::OMPToClause>::varlist_size() const
Line
Count
Source
230
10.1k
  unsigned varlist_size() const { return NumVars; }
clang::OMPVarListClause<clang::OMPFromClause>::varlist_size() const
Line
Count
Source
230
4.74k
  unsigned varlist_size() const { return NumVars; }
clang::OMPVarListClause<clang::OMPUseDevicePtrClause>::varlist_size() const
Line
Count
Source
230
4.99k
  unsigned varlist_size() const { return NumVars; }
clang::OMPVarListClause<clang::OMPIsDevicePtrClause>::varlist_size() const
Line
Count
Source
230
14.8k
  unsigned varlist_size() const { return NumVars; }
clang::OMPVarListClause<clang::OMPNontemporalClause>::varlist_size() const
Line
Count
Source
230
1.19k
  unsigned varlist_size() const { return NumVars; }
clang::OMPVarListClause<clang::OMPSharedClause>::varlist_size() const
Line
Count
Source
230
1.61k
  unsigned varlist_size() const { return NumVars; }
clang::OMPVarListClause<clang::OMPAlignedClause>::varlist_size() const
Line
Count
Source
230
956
  unsigned varlist_size() const { return NumVars; }
clang::OMPVarListClause<clang::OMPFlushClause>::varlist_size() const
Line
Count
Source
230
50
  unsigned varlist_size() const { return NumVars; }
clang::OMPVarListClause<clang::OMPDependClause>::varlist_size() const
Line
Count
Source
230
1.48k
  unsigned varlist_size() const { return NumVars; }
clang::OMPVarListClause<clang::OMPAllocateClause>::varlist_size() const
Line
Count
Source
230
1.13k
  unsigned varlist_size() const { return NumVars; }
231
12.5k
  bool varlist_empty() const { return NumVars == 0; }
clang::OMPVarListClause<clang::OMPAllocateClause>::varlist_empty() const
Line
Count
Source
231
788
  bool varlist_empty() const { return NumVars == 0; }
clang::OMPVarListClause<clang::OMPPrivateClause>::varlist_empty() const
Line
Count
Source
231
2.66k
  bool varlist_empty() const { return NumVars == 0; }
clang::OMPVarListClause<clang::OMPFirstprivateClause>::varlist_empty() const
Line
Count
Source
231
1.09k
  bool varlist_empty() const { return NumVars == 0; }
clang::OMPVarListClause<clang::OMPLastprivateClause>::varlist_empty() const
Line
Count
Source
231
500
  bool varlist_empty() const { return NumVars == 0; }
clang::OMPVarListClause<clang::OMPSharedClause>::varlist_empty() const
Line
Count
Source
231
762
  bool varlist_empty() const { return NumVars == 0; }
clang::OMPVarListClause<clang::OMPReductionClause>::varlist_empty() const
Line
Count
Source
231
1.47k
  bool varlist_empty() const { return NumVars == 0; }
clang::OMPVarListClause<clang::OMPTaskReductionClause>::varlist_empty() const
Line
Count
Source
231
216
  bool varlist_empty() const { return NumVars == 0; }
clang::OMPVarListClause<clang::OMPInReductionClause>::varlist_empty() const
Line
Count
Source
231
124
  bool varlist_empty() const { return NumVars == 0; }
clang::OMPVarListClause<clang::OMPLinearClause>::varlist_empty() const
Line
Count
Source
231
417
  bool varlist_empty() const { return NumVars == 0; }
clang::OMPVarListClause<clang::OMPAlignedClause>::varlist_empty() const
Line
Count
Source
231
408
  bool varlist_empty() const { return NumVars == 0; }
clang::OMPVarListClause<clang::OMPCopyinClause>::varlist_empty() const
Line
Count
Source
231
152
  bool varlist_empty() const { return NumVars == 0; }
clang::OMPVarListClause<clang::OMPCopyprivateClause>::varlist_empty() const
Line
Count
Source
231
32
  bool varlist_empty() const { return NumVars == 0; }
clang::OMPVarListClause<clang::OMPFlushClause>::varlist_empty() const
Line
Count
Source
231
16
  bool varlist_empty() const { return NumVars == 0; }
clang::OMPVarListClause<clang::OMPDependClause>::varlist_empty() const
Line
Count
Source
231
447
  bool varlist_empty() const { return NumVars == 0; }
clang::OMPVarListClause<clang::OMPMapClause>::varlist_empty() const
Line
Count
Source
231
2.15k
  bool varlist_empty() const { return NumVars == 0; }
clang::OMPVarListClause<clang::OMPToClause>::varlist_empty() const
Line
Count
Source
231
46
  bool varlist_empty() const { return NumVars == 0; }
clang::OMPVarListClause<clang::OMPFromClause>::varlist_empty() const
Line
Count
Source
231
44
  bool varlist_empty() const { return NumVars == 0; }
clang::OMPVarListClause<clang::OMPUseDevicePtrClause>::varlist_empty() const
Line
Count
Source
231
20
  bool varlist_empty() const { return NumVars == 0; }
clang::OMPVarListClause<clang::OMPIsDevicePtrClause>::varlist_empty() const
Line
Count
Source
231
1.16k
  bool varlist_empty() const { return NumVars == 0; }
clang::OMPVarListClause<clang::OMPNontemporalClause>::varlist_empty() const
Line
Count
Source
231
56
  bool varlist_empty() const { return NumVars == 0; }
232
233
46.4k
  varlist_range varlists() {
234
46.4k
    return varlist_range(varlist_begin(), varlist_end());
235
46.4k
  }
clang::OMPVarListClause<clang::OMPPrivateClause>::varlists()
Line
Count
Source
233
4.72k
  varlist_range varlists() {
234
4.72k
    return varlist_range(varlist_begin(), varlist_end());
235
4.72k
  }
clang::OMPVarListClause<clang::OMPFirstprivateClause>::varlists()
Line
Count
Source
233
4.52k
  varlist_range varlists() {
234
4.52k
    return varlist_range(varlist_begin(), varlist_end());
235
4.52k
  }
clang::OMPVarListClause<clang::OMPLastprivateClause>::varlists()
Line
Count
Source
233
7.59k
  varlist_range varlists() {
234
7.59k
    return varlist_range(varlist_begin(), varlist_end());
235
7.59k
  }
clang::OMPVarListClause<clang::OMPSharedClause>::varlists()
Line
Count
Source
233
1.28k
  varlist_range varlists() {
234
1.28k
    return varlist_range(varlist_begin(), varlist_end());
235
1.28k
  }
clang::OMPVarListClause<clang::OMPReductionClause>::varlists()
Line
Count
Source
233
10.0k
  varlist_range varlists() {
234
10.0k
    return varlist_range(varlist_begin(), varlist_end());
235
10.0k
  }
clang::OMPVarListClause<clang::OMPLinearClause>::varlists()
Line
Count
Source
233
2.85k
  varlist_range varlists() {
234
2.85k
    return varlist_range(varlist_begin(), varlist_end());
235
2.85k
  }
clang::OMPVarListClause<clang::OMPAlignedClause>::varlists()
Line
Count
Source
233
712
  varlist_range varlists() {
234
712
    return varlist_range(varlist_begin(), varlist_end());
235
712
  }
clang::OMPVarListClause<clang::OMPCopyinClause>::varlists()
Line
Count
Source
233
188
  varlist_range varlists() {
234
188
    return varlist_range(varlist_begin(), varlist_end());
235
188
  }
clang::OMPVarListClause<clang::OMPCopyprivateClause>::varlists()
Line
Count
Source
233
76
  varlist_range varlists() {
234
76
    return varlist_range(varlist_begin(), varlist_end());
235
76
  }
clang::OMPVarListClause<clang::OMPFlushClause>::varlists()
Line
Count
Source
233
40
  varlist_range varlists() {
234
40
    return varlist_range(varlist_begin(), varlist_end());
235
40
  }
clang::OMPVarListClause<clang::OMPDependClause>::varlists()
Line
Count
Source
233
942
  varlist_range varlists() {
234
942
    return varlist_range(varlist_begin(), varlist_end());
235
942
  }
clang::OMPVarListClause<clang::OMPMapClause>::varlists()
Line
Count
Source
233
6.57k
  varlist_range varlists() {
234
6.57k
    return varlist_range(varlist_begin(), varlist_end());
235
6.57k
  }
clang::OMPVarListClause<clang::OMPToClause>::varlists()
Line
Count
Source
233
338
  varlist_range varlists() {
234
338
    return varlist_range(varlist_begin(), varlist_end());
235
338
  }
clang::OMPVarListClause<clang::OMPFromClause>::varlists()
Line
Count
Source
233
204
  varlist_range varlists() {
234
204
    return varlist_range(varlist_begin(), varlist_end());
235
204
  }
clang::OMPVarListClause<clang::OMPUseDevicePtrClause>::varlists()
Line
Count
Source
233
254
  varlist_range varlists() {
234
254
    return varlist_range(varlist_begin(), varlist_end());
235
254
  }
clang::OMPVarListClause<clang::OMPIsDevicePtrClause>::varlists()
Line
Count
Source
233
1.30k
  varlist_range varlists() {
234
1.30k
    return varlist_range(varlist_begin(), varlist_end());
235
1.30k
  }
clang::OMPVarListClause<clang::OMPTaskReductionClause>::varlists()
Line
Count
Source
233
1.33k
  varlist_range varlists() {
234
1.33k
    return varlist_range(varlist_begin(), varlist_end());
235
1.33k
  }
clang::OMPVarListClause<clang::OMPInReductionClause>::varlists()
Line
Count
Source
233
1.18k
  varlist_range varlists() {
234
1.18k
    return varlist_range(varlist_begin(), varlist_end());
235
1.18k
  }
clang::OMPVarListClause<clang::OMPAllocateClause>::varlists()
Line
Count
Source
233
1.80k
  varlist_range varlists() {
234
1.80k
    return varlist_range(varlist_begin(), varlist_end());
235
1.80k
  }
clang::OMPVarListClause<clang::OMPNontemporalClause>::varlists()
Line
Count
Source
233
516
  varlist_range varlists() {
234
516
    return varlist_range(varlist_begin(), varlist_end());
235
516
  }
236
16.0k
  varlist_const_range varlists() const {
237
16.0k
    return varlist_const_range(varlist_begin(), varlist_end());
238
16.0k
  }
clang::OMPVarListClause<clang::OMPPrivateClause>::varlists() const
Line
Count
Source
236
1.53k
  varlist_const_range varlists() const {
237
1.53k
    return varlist_const_range(varlist_begin(), varlist_end());
238
1.53k
  }
clang::OMPVarListClause<clang::OMPFirstprivateClause>::varlists() const
Line
Count
Source
236
6.82k
  varlist_const_range varlists() const {
237
6.82k
    return varlist_const_range(varlist_begin(), varlist_end());
238
6.82k
  }
clang::OMPVarListClause<clang::OMPLastprivateClause>::varlists() const
Line
Count
Source
236
760
  varlist_const_range varlists() const {
237
760
    return varlist_const_range(varlist_begin(), varlist_end());
238
760
  }
clang::OMPVarListClause<clang::OMPSharedClause>::varlists() const
Line
Count
Source
236
187
  varlist_const_range varlists() const {
237
187
    return varlist_const_range(varlist_begin(), varlist_end());
238
187
  }
clang::OMPVarListClause<clang::OMPReductionClause>::varlists() const
Line
Count
Source
236
1.10k
  varlist_const_range varlists() const {
237
1.10k
    return varlist_const_range(varlist_begin(), varlist_end());
238
1.10k
  }
clang::OMPVarListClause<clang::OMPLinearClause>::varlists() const
Line
Count
Source
236
1.02k
  varlist_const_range varlists() const {
237
1.02k
    return varlist_const_range(varlist_begin(), varlist_end());
238
1.02k
  }
clang::OMPVarListClause<clang::OMPAlignedClause>::varlists() const
Line
Count
Source
236
442
  varlist_const_range varlists() const {
237
442
    return varlist_const_range(varlist_begin(), varlist_end());
238
442
  }
clang::OMPVarListClause<clang::OMPCopyinClause>::varlists() const
Line
Count
Source
236
36
  varlist_const_range varlists() const {
237
36
    return varlist_const_range(varlist_begin(), varlist_end());
238
36
  }
clang::OMPVarListClause<clang::OMPCopyprivateClause>::varlists() const
Line
Count
Source
236
38
  varlist_const_range varlists() const {
237
38
    return varlist_const_range(varlist_begin(), varlist_end());
238
38
  }
clang::OMPVarListClause<clang::OMPFlushClause>::varlists() const
Line
Count
Source
236
10
  varlist_const_range varlists() const {
237
10
    return varlist_const_range(varlist_begin(), varlist_end());
238
10
  }
clang::OMPVarListClause<clang::OMPDependClause>::varlists() const
Line
Count
Source
236
904
  varlist_const_range varlists() const {
237
904
    return varlist_const_range(varlist_begin(), varlist_end());
238
904
  }
clang::OMPVarListClause<clang::OMPMapClause>::varlists() const
Line
Count
Source
236
2.25k
  varlist_const_range varlists() const {
237
2.25k
    return varlist_const_range(varlist_begin(), varlist_end());
238
2.25k
  }
clang::OMPVarListClause<clang::OMPToClause>::varlists() const
Line
Count
Source
236
46
  varlist_const_range varlists() const {
237
46
    return varlist_const_range(varlist_begin(), varlist_end());
238
46
  }
clang::OMPVarListClause<clang::OMPFromClause>::varlists() const
Line
Count
Source
236
46
  varlist_const_range varlists() const {
237
46
    return varlist_const_range(varlist_begin(), varlist_end());
238
46
  }
clang::OMPVarListClause<clang::OMPUseDevicePtrClause>::varlists() const
Line
Count
Source
236
156
  varlist_const_range varlists() const {
237
156
    return varlist_const_range(varlist_begin(), varlist_end());
238
156
  }
clang::OMPVarListClause<clang::OMPIsDevicePtrClause>::varlists() const
Line
Count
Source
236
432
  varlist_const_range varlists() const {
237
432
    return varlist_const_range(varlist_begin(), varlist_end());
238
432
  }
clang::OMPVarListClause<clang::OMPTaskReductionClause>::varlists() const
Line
Count
Source
236
100
  varlist_const_range varlists() const {
237
100
    return varlist_const_range(varlist_begin(), varlist_end());
238
100
  }
clang::OMPVarListClause<clang::OMPInReductionClause>::varlists() const
Line
Count
Source
236
20
  varlist_const_range varlists() const {
237
20
    return varlist_const_range(varlist_begin(), varlist_end());
238
20
  }
clang::OMPVarListClause<clang::OMPAllocateClause>::varlists() const
Line
Count
Source
236
120
  varlist_const_range varlists() const {
237
120
    return varlist_const_range(varlist_begin(), varlist_end());
238
120
  }
clang::OMPVarListClause<clang::OMPNontemporalClause>::varlists() const
Line
Count
Source
236
44
  varlist_const_range varlists() const {
237
44
    return varlist_const_range(varlist_begin(), varlist_end());
238
44
  }
239
240
226k
  varlist_iterator varlist_begin() { return getVarRefs().begin(); }
clang::OMPVarListClause<clang::OMPAllocateClause>::varlist_begin()
Line
Count
Source
240
3.77k
  varlist_iterator varlist_begin() { return getVarRefs().begin(); }
clang::OMPVarListClause<clang::OMPPrivateClause>::varlist_begin()
Line
Count
Source
240
30.4k
  varlist_iterator varlist_begin() { return getVarRefs().begin(); }
clang::OMPVarListClause<clang::OMPFirstprivateClause>::varlist_begin()
Line
Count
Source
240
71.2k
  varlist_iterator varlist_begin() { return getVarRefs().begin(); }
clang::OMPVarListClause<clang::OMPLastprivateClause>::varlist_begin()
Line
Count
Source
240
21.6k
  varlist_iterator varlist_begin() { return getVarRefs().begin(); }
clang::OMPVarListClause<clang::OMPSharedClause>::varlist_begin()
Line
Count
Source
240
3.42k
  varlist_iterator varlist_begin() { return getVarRefs().begin(); }
clang::OMPVarListClause<clang::OMPReductionClause>::varlist_begin()
Line
Count
Source
240
42.7k
  varlist_iterator varlist_begin() { return getVarRefs().begin(); }
clang::OMPVarListClause<clang::OMPTaskReductionClause>::varlist_begin()
Line
Count
Source
240
5.48k
  varlist_iterator varlist_begin() { return getVarRefs().begin(); }
clang::OMPVarListClause<clang::OMPInReductionClause>::varlist_begin()
Line
Count
Source
240
4.38k
  varlist_iterator varlist_begin() { return getVarRefs().begin(); }
clang::OMPVarListClause<clang::OMPLinearClause>::varlist_begin()
Line
Count
Source
240
8.40k
  varlist_iterator varlist_begin() { return getVarRefs().begin(); }
clang::OMPVarListClause<clang::OMPAlignedClause>::varlist_begin()
Line
Count
Source
240
1.97k
  varlist_iterator varlist_begin() { return getVarRefs().begin(); }
clang::OMPVarListClause<clang::OMPCopyinClause>::varlist_begin()
Line
Count
Source
240
843
  varlist_iterator varlist_begin() { return getVarRefs().begin(); }
clang::OMPVarListClause<clang::OMPCopyprivateClause>::varlist_begin()
Line
Count
Source
240
354
  varlist_iterator varlist_begin() { return getVarRefs().begin(); }
clang::OMPVarListClause<clang::OMPFlushClause>::varlist_begin()
Line
Count
Source
240
72
  varlist_iterator varlist_begin() { return getVarRefs().begin(); }
clang::OMPVarListClause<clang::OMPDependClause>::varlist_begin()
Line
Count
Source
240
2.81k
  varlist_iterator varlist_begin() { return getVarRefs().begin(); }
clang::OMPVarListClause<clang::OMPMapClause>::varlist_begin()
Line
Count
Source
240
23.1k
  varlist_iterator varlist_begin() { return getVarRefs().begin(); }
clang::OMPVarListClause<clang::OMPToClause>::varlist_begin()
Line
Count
Source
240
581
  varlist_iterator varlist_begin() { return getVarRefs().begin(); }
clang::OMPVarListClause<clang::OMPFromClause>::varlist_begin()
Line
Count
Source
240
298
  varlist_iterator varlist_begin() { return getVarRefs().begin(); }
clang::OMPVarListClause<clang::OMPUseDevicePtrClause>::varlist_begin()
Line
Count
Source
240
294
  varlist_iterator varlist_begin() { return getVarRefs().begin(); }
clang::OMPVarListClause<clang::OMPIsDevicePtrClause>::varlist_begin()
Line
Count
Source
240
3.62k
  varlist_iterator varlist_begin() { return getVarRefs().begin(); }
clang::OMPVarListClause<clang::OMPNontemporalClause>::varlist_begin()
Line
Count
Source
240
854
  varlist_iterator varlist_begin() { return getVarRefs().begin(); }
241
646k
  varlist_iterator varlist_end() { return getVarRefs().end(); }
clang::OMPVarListClause<clang::OMPAllocateClause>::varlist_end()
Line
Count
Source
241
2.98k
  varlist_iterator varlist_end() { return getVarRefs().end(); }
clang::OMPVarListClause<clang::OMPPrivateClause>::varlist_end()
Line
Count
Source
241
54.9k
  varlist_iterator varlist_end() { return getVarRefs().end(); }
clang::OMPVarListClause<clang::OMPFirstprivateClause>::varlist_end()
Line
Count
Source
241
243k
  varlist_iterator varlist_end() { return getVarRefs().end(); }
clang::OMPVarListClause<clang::OMPLastprivateClause>::varlist_end()
Line
Count
Source
241
57.8k
  varlist_iterator varlist_end() { return getVarRefs().end(); }
clang::OMPVarListClause<clang::OMPSharedClause>::varlist_end()
Line
Count
Source
241
2.63k
  varlist_iterator varlist_end() { return getVarRefs().end(); }
clang::OMPVarListClause<clang::OMPReductionClause>::varlist_end()
Line
Count
Source
241
138k
  varlist_iterator varlist_end() { return getVarRefs().end(); }
clang::OMPVarListClause<clang::OMPTaskReductionClause>::varlist_end()
Line
Count
Source
241
20.7k
  varlist_iterator varlist_end() { return getVarRefs().end(); }
clang::OMPVarListClause<clang::OMPInReductionClause>::varlist_end()
Line
Count
Source
241
20.3k
  varlist_iterator varlist_end() { return getVarRefs().end(); }
clang::OMPVarListClause<clang::OMPLinearClause>::varlist_end()
Line
Count
Source
241
68.5k
  varlist_iterator varlist_end() { return getVarRefs().end(); }
clang::OMPVarListClause<clang::OMPAlignedClause>::varlist_end()
Line
Count
Source
241
4.91k
  varlist_iterator varlist_end() { return getVarRefs().end(); }
clang::OMPVarListClause<clang::OMPCopyinClause>::varlist_end()
Line
Count
Source
241
2.53k
  varlist_iterator varlist_end() { return getVarRefs().end(); }
clang::OMPVarListClause<clang::OMPCopyprivateClause>::varlist_end()
Line
Count
Source
241
908
  varlist_iterator varlist_end() { return getVarRefs().end(); }
clang::OMPVarListClause<clang::OMPFlushClause>::varlist_end()
Line
Count
Source
241
56
  varlist_iterator varlist_end() { return getVarRefs().end(); }
clang::OMPVarListClause<clang::OMPDependClause>::varlist_end()
Line
Count
Source
241
1.60k
  varlist_iterator varlist_end() { return getVarRefs().end(); }
clang::OMPVarListClause<clang::OMPMapClause>::varlist_end()
Line
Count
Source
241
20.7k
  varlist_iterator varlist_end() { return getVarRefs().end(); }
clang::OMPVarListClause<clang::OMPToClause>::varlist_end()
Line
Count
Source
241
535
  varlist_iterator varlist_end() { return getVarRefs().end(); }
clang::OMPVarListClause<clang::OMPFromClause>::varlist_end()
Line
Count
Source
241
254
  varlist_iterator varlist_end() { return getVarRefs().end(); }
clang::OMPVarListClause<clang::OMPUseDevicePtrClause>::varlist_end()
Line
Count
Source
241
1.46k
  varlist_iterator varlist_end() { return getVarRefs().end(); }
clang::OMPVarListClause<clang::OMPIsDevicePtrClause>::varlist_end()
Line
Count
Source
241
2.46k
  varlist_iterator varlist_end() { return getVarRefs().end(); }
clang::OMPVarListClause<clang::OMPNontemporalClause>::varlist_end()
Line
Count
Source
241
1.71k
  varlist_iterator varlist_end() { return getVarRefs().end(); }
242
23.5k
  varlist_const_iterator varlist_begin() const { return getVarRefs().begin(); }
clang::OMPVarListClause<clang::OMPPrivateClause>::varlist_begin() const
Line
Count
Source
242
2.50k
  varlist_const_iterator varlist_begin() const { return getVarRefs().begin(); }
clang::OMPVarListClause<clang::OMPFirstprivateClause>::varlist_begin() const
Line
Count
Source
242
11.6k
  varlist_const_iterator varlist_begin() const { return getVarRefs().begin(); }
clang::OMPVarListClause<clang::OMPLastprivateClause>::varlist_begin() const
Line
Count
Source
242
1.82k
  varlist_const_iterator varlist_begin() const { return getVarRefs().begin(); }
clang::OMPVarListClause<clang::OMPSharedClause>::varlist_begin() const
Line
Count
Source
242
187
  varlist_const_iterator varlist_begin() const { return getVarRefs().begin(); }
clang::OMPVarListClause<clang::OMPReductionClause>::varlist_begin() const
Line
Count
Source
242
1.10k
  varlist_const_iterator varlist_begin() const { return getVarRefs().begin(); }
clang::OMPVarListClause<clang::OMPLinearClause>::varlist_begin() const
Line
Count
Source
242
1.51k
  varlist_const_iterator varlist_begin() const { return getVarRefs().begin(); }
clang::OMPVarListClause<clang::OMPAlignedClause>::varlist_begin() const
Line
Count
Source
242
442
  varlist_const_iterator varlist_begin() const { return getVarRefs().begin(); }
clang::OMPVarListClause<clang::OMPCopyinClause>::varlist_begin() const
Line
Count
Source
242
63
  varlist_const_iterator varlist_begin() const { return getVarRefs().begin(); }
clang::OMPVarListClause<clang::OMPCopyprivateClause>::varlist_begin() const
Line
Count
Source
242
38
  varlist_const_iterator varlist_begin() const { return getVarRefs().begin(); }
clang::OMPVarListClause<clang::OMPFlushClause>::varlist_begin() const
Line
Count
Source
242
18
  varlist_const_iterator varlist_begin() const { return getVarRefs().begin(); }
clang::OMPVarListClause<clang::OMPDependClause>::varlist_begin() const
Line
Count
Source
242
904
  varlist_const_iterator varlist_begin() const { return getVarRefs().begin(); }
clang::OMPVarListClause<clang::OMPMapClause>::varlist_begin() const
Line
Count
Source
242
2.25k
  varlist_const_iterator varlist_begin() const { return getVarRefs().begin(); }
clang::OMPVarListClause<clang::OMPToClause>::varlist_begin() const
Line
Count
Source
242
46
  varlist_const_iterator varlist_begin() const { return getVarRefs().begin(); }
clang::OMPVarListClause<clang::OMPFromClause>::varlist_begin() const
Line
Count
Source
242
46
  varlist_const_iterator varlist_begin() const { return getVarRefs().begin(); }
clang::OMPVarListClause<clang::OMPUseDevicePtrClause>::varlist_begin() const
Line
Count
Source
242
224
  varlist_const_iterator varlist_begin() const { return getVarRefs().begin(); }
clang::OMPVarListClause<clang::OMPIsDevicePtrClause>::varlist_begin() const
Line
Count
Source
242
432
  varlist_const_iterator varlist_begin() const { return getVarRefs().begin(); }
clang::OMPVarListClause<clang::OMPTaskReductionClause>::varlist_begin() const
Line
Count
Source
242
100
  varlist_const_iterator varlist_begin() const { return getVarRefs().begin(); }
clang::OMPVarListClause<clang::OMPInReductionClause>::varlist_begin() const
Line
Count
Source
242
20
  varlist_const_iterator varlist_begin() const { return getVarRefs().begin(); }
clang::OMPVarListClause<clang::OMPAllocateClause>::varlist_begin() const
Line
Count
Source
242
120
  varlist_const_iterator varlist_begin() const { return getVarRefs().begin(); }
clang::OMPVarListClause<clang::OMPNontemporalClause>::varlist_begin() const
Line
Count
Source
242
44
  varlist_const_iterator varlist_begin() const { return getVarRefs().begin(); }
243
84.7k
  varlist_const_iterator varlist_end() const { return getVarRefs().end(); }
clang::OMPVarListClause<clang::OMPPrivateClause>::varlist_end() const
Line
Count
Source
243
5.00k
  varlist_const_iterator varlist_end() const { return getVarRefs().end(); }
clang::OMPVarListClause<clang::OMPFirstprivateClause>::varlist_end() const
Line
Count
Source
243
38.5k
  varlist_const_iterator varlist_end() const { return getVarRefs().end(); }
clang::OMPVarListClause<clang::OMPLastprivateClause>::varlist_end() const
Line
Count
Source
243
7.38k
  varlist_const_iterator varlist_end() const { return getVarRefs().end(); }
clang::OMPVarListClause<clang::OMPReductionClause>::varlist_end() const
Line
Count
Source
243
18.4k
  varlist_const_iterator varlist_end() const { return getVarRefs().end(); }
clang::OMPVarListClause<clang::OMPTaskReductionClause>::varlist_end() const
Line
Count
Source
243
900
  varlist_const_iterator varlist_end() const { return getVarRefs().end(); }
clang::OMPVarListClause<clang::OMPInReductionClause>::varlist_end() const
Line
Count
Source
243
140
  varlist_const_iterator varlist_end() const { return getVarRefs().end(); }
clang::OMPVarListClause<clang::OMPLinearClause>::varlist_end() const
Line
Count
Source
243
8.15k
  varlist_const_iterator varlist_end() const { return getVarRefs().end(); }
clang::OMPVarListClause<clang::OMPAlignedClause>::varlist_end() const
Line
Count
Source
243
976
  varlist_const_iterator varlist_end() const { return getVarRefs().end(); }
clang::OMPVarListClause<clang::OMPCopyinClause>::varlist_end() const
Line
Count
Source
243
414
  varlist_const_iterator varlist_end() const { return getVarRefs().end(); }
clang::OMPVarListClause<clang::OMPCopyprivateClause>::varlist_end() const
Line
Count
Source
243
266
  varlist_const_iterator varlist_end() const { return getVarRefs().end(); }
clang::OMPVarListClause<clang::OMPUseDevicePtrClause>::varlist_end() const
Line
Count
Source
243
428
  varlist_const_iterator varlist_end() const { return getVarRefs().end(); }
clang::OMPVarListClause<clang::OMPNontemporalClause>::varlist_end() const
Line
Count
Source
243
44
  varlist_const_iterator varlist_end() const { return getVarRefs().end(); }
clang::OMPVarListClause<clang::OMPSharedClause>::varlist_end() const
Line
Count
Source
243
187
  varlist_const_iterator varlist_end() const { return getVarRefs().end(); }
clang::OMPVarListClause<clang::OMPFlushClause>::varlist_end() const
Line
Count
Source
243
18
  varlist_const_iterator varlist_end() const { return getVarRefs().end(); }
clang::OMPVarListClause<clang::OMPDependClause>::varlist_end() const
Line
Count
Source
243
904
  varlist_const_iterator varlist_end() const { return getVarRefs().end(); }
clang::OMPVarListClause<clang::OMPMapClause>::varlist_end() const
Line
Count
Source
243
2.25k
  varlist_const_iterator varlist_end() const { return getVarRefs().end(); }
clang::OMPVarListClause<clang::OMPToClause>::varlist_end() const
Line
Count
Source
243
46
  varlist_const_iterator varlist_end() const { return getVarRefs().end(); }
clang::OMPVarListClause<clang::OMPFromClause>::varlist_end() const
Line
Count
Source
243
46
  varlist_const_iterator varlist_end() const { return getVarRefs().end(); }
clang::OMPVarListClause<clang::OMPIsDevicePtrClause>::varlist_end() const
Line
Count
Source
243
432
  varlist_const_iterator varlist_end() const { return getVarRefs().end(); }
clang::OMPVarListClause<clang::OMPAllocateClause>::varlist_end() const
Line
Count
Source
243
120
  varlist_const_iterator varlist_end() const { return getVarRefs().end(); }
244
245
  /// Sets the location of '('.
246
10.6k
  void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
clang::OMPVarListClause<clang::OMPPrivateClause>::setLParenLoc(clang::SourceLocation)
Line
Count
Source
246
1.32k
  void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
clang::OMPVarListClause<clang::OMPFirstprivateClause>::setLParenLoc(clang::SourceLocation)
Line
Count
Source
246
3.25k
  void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
clang::OMPVarListClause<clang::OMPLastprivateClause>::setLParenLoc(clang::SourceLocation)
Line
Count
Source
246
394
  void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
clang::OMPVarListClause<clang::OMPSharedClause>::setLParenLoc(clang::SourceLocation)
Line
Count
Source
246
334
  void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
clang::OMPVarListClause<clang::OMPReductionClause>::setLParenLoc(clang::SourceLocation)
Line
Count
Source
246
795
  void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
clang::OMPVarListClause<clang::OMPTaskReductionClause>::setLParenLoc(clang::SourceLocation)
Line
Count
Source
246
86
  void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
clang::OMPVarListClause<clang::OMPInReductionClause>::setLParenLoc(clang::SourceLocation)
Line
Count
Source
246
52
  void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
clang::OMPVarListClause<clang::OMPLinearClause>::setLParenLoc(clang::SourceLocation)
Line
Count
Source
246
358
  void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
clang::OMPVarListClause<clang::OMPAlignedClause>::setLParenLoc(clang::SourceLocation)
Line
Count
Source
246
244
  void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
clang::OMPVarListClause<clang::OMPCopyinClause>::setLParenLoc(clang::SourceLocation)
Line
Count
Source
246
74
  void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
clang::OMPVarListClause<clang::OMPCopyprivateClause>::setLParenLoc(clang::SourceLocation)
Line
Count
Source
246
18
  void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
clang::OMPVarListClause<clang::OMPFlushClause>::setLParenLoc(clang::SourceLocation)
Line
Count
Source
246
10
  void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
clang::OMPVarListClause<clang::OMPDependClause>::setLParenLoc(clang::SourceLocation)
Line
Count
Source
246
548
  void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
clang::OMPVarListClause<clang::OMPMapClause>::setLParenLoc(clang::SourceLocation)
Line
Count
Source
246
2.27k
  void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
clang::OMPVarListClause<clang::OMPAllocateClause>::setLParenLoc(clang::SourceLocation)
Line
Count
Source
246
216
  void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
clang::OMPVarListClause<clang::OMPToClause>::setLParenLoc(clang::SourceLocation)
Line
Count
Source
246
46
  void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
clang::OMPVarListClause<clang::OMPFromClause>::setLParenLoc(clang::SourceLocation)
Line
Count
Source
246
46
  void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
clang::OMPVarListClause<clang::OMPUseDevicePtrClause>::setLParenLoc(clang::SourceLocation)
Line
Count
Source
246
84
  void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
clang::OMPVarListClause<clang::OMPIsDevicePtrClause>::setLParenLoc(clang::SourceLocation)
Line
Count
Source
246
432
  void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
clang::OMPVarListClause<clang::OMPNontemporalClause>::setLParenLoc(clang::SourceLocation)
Line
Count
Source
246
82
  void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
247
248
  /// Returns the location of '('.
249
37.2k
  SourceLocation getLParenLoc() const { return LParenLoc; }
clang::OMPVarListClause<clang::OMPPrivateClause>::getLParenLoc() const
Line
Count
Source
249
4.72k
  SourceLocation getLParenLoc() const { return LParenLoc; }
clang::OMPVarListClause<clang::OMPFirstprivateClause>::getLParenLoc() const
Line
Count
Source
249
4.42k
  SourceLocation getLParenLoc() const { return LParenLoc; }
clang::OMPVarListClause<clang::OMPLastprivateClause>::getLParenLoc() const
Line
Count
Source
249
1.78k
  SourceLocation getLParenLoc() const { return LParenLoc; }
clang::OMPVarListClause<clang::OMPSharedClause>::getLParenLoc() const
Line
Count
Source
249
1.28k
  SourceLocation getLParenLoc() const { return LParenLoc; }
clang::OMPVarListClause<clang::OMPReductionClause>::getLParenLoc() const
Line
Count
Source
249
10.0k
  SourceLocation getLParenLoc() const { return LParenLoc; }
clang::OMPVarListClause<clang::OMPLinearClause>::getLParenLoc() const
Line
Count
Source
249
892
  SourceLocation getLParenLoc() const { return LParenLoc; }
clang::OMPVarListClause<clang::OMPAlignedClause>::getLParenLoc() const
Line
Count
Source
249
712
  SourceLocation getLParenLoc() const { return LParenLoc; }
clang::OMPVarListClause<clang::OMPCopyinClause>::getLParenLoc() const
Line
Count
Source
249
188
  SourceLocation getLParenLoc() const { return LParenLoc; }
clang::OMPVarListClause<clang::OMPCopyprivateClause>::getLParenLoc() const
Line
Count
Source
249
76
  SourceLocation getLParenLoc() const { return LParenLoc; }
clang::OMPVarListClause<clang::OMPFlushClause>::getLParenLoc() const
Line
Count
Source
249
44
  SourceLocation getLParenLoc() const { return LParenLoc; }
clang::OMPVarListClause<clang::OMPDependClause>::getLParenLoc() const
Line
Count
Source
249
902
  SourceLocation getLParenLoc() const { return LParenLoc; }
clang::OMPVarListClause<clang::OMPMapClause>::getLParenLoc() const
Line
Count
Source
249
6.56k
  SourceLocation getLParenLoc() const { return LParenLoc; }
clang::OMPVarListClause<clang::OMPToClause>::getLParenLoc() const
Line
Count
Source
249
336
  SourceLocation getLParenLoc() const { return LParenLoc; }
clang::OMPVarListClause<clang::OMPFromClause>::getLParenLoc() const
Line
Count
Source
249
204
  SourceLocation getLParenLoc() const { return LParenLoc; }
clang::OMPVarListClause<clang::OMPUseDevicePtrClause>::getLParenLoc() const
Line
Count
Source
249
254
  SourceLocation getLParenLoc() const { return LParenLoc; }
clang::OMPVarListClause<clang::OMPIsDevicePtrClause>::getLParenLoc() const
Line
Count
Source
249
1.30k
  SourceLocation getLParenLoc() const { return LParenLoc; }
clang::OMPVarListClause<clang::OMPTaskReductionClause>::getLParenLoc() const
Line
Count
Source
249
1.33k
  SourceLocation getLParenLoc() const { return LParenLoc; }
clang::OMPVarListClause<clang::OMPInReductionClause>::getLParenLoc() const
Line
Count
Source
249
1.18k
  SourceLocation getLParenLoc() const { return LParenLoc; }
clang::OMPVarListClause<clang::OMPAllocateClause>::getLParenLoc() const
Line
Count
Source
249
923
  SourceLocation getLParenLoc() const { return LParenLoc; }
clang::OMPVarListClause<clang::OMPNontemporalClause>::getLParenLoc() const
Line
Count
Source
249
94
  SourceLocation getLParenLoc() const { return LParenLoc; }
250
251
  /// Fetches list of all variables in the clause.
252
108k
  ArrayRef<const Expr *> getVarRefs() const {
253
108k
    return llvm::makeArrayRef(
254
108k
        static_cast<const T *>(this)->template getTrailingObjects<Expr *>(),
255
108k
        NumVars);
256
108k
  }
clang::OMPVarListClause<clang::OMPPrivateClause>::getVarRefs() const
Line
Count
Source
252
7.50k
  ArrayRef<const Expr *> getVarRefs() const {
253
7.50k
    return llvm::makeArrayRef(
254
7.50k
        static_cast<const T *>(this)->template getTrailingObjects<Expr *>(),
255
7.50k
        NumVars);
256
7.50k
  }
clang::OMPVarListClause<clang::OMPFirstprivateClause>::getVarRefs() const
Line
Count
Source
252
50.1k
  ArrayRef<const Expr *> getVarRefs() const {
253
50.1k
    return llvm::makeArrayRef(
254
50.1k
        static_cast<const T *>(this)->template getTrailingObjects<Expr *>(),
255
50.1k
        NumVars);
256
50.1k
  }
clang::OMPVarListClause<clang::OMPLastprivateClause>::getVarRefs() const
Line
Count
Source
252
9.23k
  ArrayRef<const Expr *> getVarRefs() const {
253
9.23k
    return llvm::makeArrayRef(
254
9.23k
        static_cast<const T *>(this)->template getTrailingObjects<Expr *>(),
255
9.23k
        NumVars);
256
9.23k
  }
clang::OMPVarListClause<clang::OMPReductionClause>::getVarRefs() const
Line
Count
Source
252
19.6k
  ArrayRef<const Expr *> getVarRefs() const {
253
19.6k
    return llvm::makeArrayRef(
254
19.6k
        static_cast<const T *>(this)->template getTrailingObjects<Expr *>(),
255
19.6k
        NumVars);
256
19.6k
  }
clang::OMPVarListClause<clang::OMPTaskReductionClause>::getVarRefs() const
Line
Count
Source
252
1.00k
  ArrayRef<const Expr *> getVarRefs() const {
253
1.00k
    return llvm::makeArrayRef(
254
1.00k
        static_cast<const T *>(this)->template getTrailingObjects<Expr *>(),
255
1.00k
        NumVars);
256
1.00k
  }
clang::OMPVarListClause<clang::OMPInReductionClause>::getVarRefs() const
Line
Count
Source
252
160
  ArrayRef<const Expr *> getVarRefs() const {
253
160
    return llvm::makeArrayRef(
254
160
        static_cast<const T *>(this)->template getTrailingObjects<Expr *>(),
255
160
        NumVars);
256
160
  }
clang::OMPVarListClause<clang::OMPLinearClause>::getVarRefs() const
Line
Count
Source
252
9.66k
  ArrayRef<const Expr *> getVarRefs() const {
253
9.66k
    return llvm::makeArrayRef(
254
9.66k
        static_cast<const T *>(this)->template getTrailingObjects<Expr *>(),
255
9.66k
        NumVars);
256
9.66k
  }
clang::OMPVarListClause<clang::OMPAlignedClause>::getVarRefs() const
Line
Count
Source
252
1.41k
  ArrayRef<const Expr *> getVarRefs() const {
253
1.41k
    return llvm::makeArrayRef(
254
1.41k
        static_cast<const T *>(this)->template getTrailingObjects<Expr *>(),
255
1.41k
        NumVars);
256
1.41k
  }
clang::OMPVarListClause<clang::OMPCopyinClause>::getVarRefs() const
Line
Count
Source
252
477
  ArrayRef<const Expr *> getVarRefs() const {
253
477
    return llvm::makeArrayRef(
254
477
        static_cast<const T *>(this)->template getTrailingObjects<Expr *>(),
255
477
        NumVars);
256
477
  }
clang::OMPVarListClause<clang::OMPCopyprivateClause>::getVarRefs() const
Line
Count
Source
252
304
  ArrayRef<const Expr *> getVarRefs() const {
253
304
    return llvm::makeArrayRef(
254
304
        static_cast<const T *>(this)->template getTrailingObjects<Expr *>(),
255
304
        NumVars);
256
304
  }
clang::OMPVarListClause<clang::OMPUseDevicePtrClause>::getVarRefs() const
Line
Count
Source
252
652
  ArrayRef<const Expr *> getVarRefs() const {
253
652
    return llvm::makeArrayRef(
254
652
        static_cast<const T *>(this)->template getTrailingObjects<Expr *>(),
255
652
        NumVars);
256
652
  }
clang::OMPVarListClause<clang::OMPNontemporalClause>::getVarRefs() const
Line
Count
Source
252
88
  ArrayRef<const Expr *> getVarRefs() const {
253
88
    return llvm::makeArrayRef(
254
88
        static_cast<const T *>(this)->template getTrailingObjects<Expr *>(),
255
88
        NumVars);
256
88
  }
clang::OMPVarListClause<clang::OMPDependClause>::getVarRefs() const
Line
Count
Source
252
1.82k
  ArrayRef<const Expr *> getVarRefs() const {
253
1.82k
    return llvm::makeArrayRef(
254
1.82k
        static_cast<const T *>(this)->template getTrailingObjects<Expr *>(),
255
1.82k
        NumVars);
256
1.82k
  }
clang::OMPVarListClause<clang::OMPSharedClause>::getVarRefs() const
Line
Count
Source
252
374
  ArrayRef<const Expr *> getVarRefs() const {
253
374
    return llvm::makeArrayRef(
254
374
        static_cast<const T *>(this)->template getTrailingObjects<Expr *>(),
255
374
        NumVars);
256
374
  }
clang::OMPVarListClause<clang::OMPFlushClause>::getVarRefs() const
Line
Count
Source
252
36
  ArrayRef<const Expr *> getVarRefs() const {
253
36
    return llvm::makeArrayRef(
254
36
        static_cast<const T *>(this)->template getTrailingObjects<Expr *>(),
255
36
        NumVars);
256
36
  }
clang::OMPVarListClause<clang::OMPMapClause>::getVarRefs() const
Line
Count
Source
252
4.50k
  ArrayRef<const Expr *> getVarRefs() const {
253
4.50k
    return llvm::makeArrayRef(
254
4.50k
        static_cast<const T *>(this)->template getTrailingObjects<Expr *>(),
255
4.50k
        NumVars);
256
4.50k
  }
clang::OMPVarListClause<clang::OMPToClause>::getVarRefs() const
Line
Count
Source
252
92
  ArrayRef<const Expr *> getVarRefs() const {
253
92
    return llvm::makeArrayRef(
254
92
        static_cast<const T *>(this)->template getTrailingObjects<Expr *>(),
255
92
        NumVars);
256
92
  }
clang::OMPVarListClause<clang::OMPFromClause>::getVarRefs() const
Line
Count
Source
252
92
  ArrayRef<const Expr *> getVarRefs() const {
253
92
    return llvm::makeArrayRef(
254
92
        static_cast<const T *>(this)->template getTrailingObjects<Expr *>(),
255
92
        NumVars);
256
92
  }
clang::OMPVarListClause<clang::OMPIsDevicePtrClause>::getVarRefs() const
Line
Count
Source
252
864
  ArrayRef<const Expr *> getVarRefs() const {
253
864
    return llvm::makeArrayRef(
254
864
        static_cast<const T *>(this)->template getTrailingObjects<Expr *>(),
255
864
        NumVars);
256
864
  }
clang::OMPVarListClause<clang::OMPAllocateClause>::getVarRefs() const
Line
Count
Source
252
240
  ArrayRef<const Expr *> getVarRefs() const {
253
240
    return llvm::makeArrayRef(
254
240
        static_cast<const T *>(this)->template getTrailingObjects<Expr *>(),
255
240
        NumVars);
256
240
  }
257
};
258
259
/// This represents 'allocator' clause in the '#pragma omp ...'
260
/// directive.
261
///
262
/// \code
263
/// #pragma omp allocate(a) allocator(omp_default_mem_alloc)
264
/// \endcode
265
/// In this example directive '#pragma omp allocate' has simple 'allocator'
266
/// clause with the allocator 'omp_default_mem_alloc'.
267
class OMPAllocatorClause : public OMPClause {
268
  friend class OMPClauseReader;
269
270
  /// Location of '('.
271
  SourceLocation LParenLoc;
272
273
  /// Expression with the allocator.
274
  Stmt *Allocator = nullptr;
275
276
  /// Set allocator.
277
75
  void setAllocator(Expr *A) { Allocator = A; }
278
279
public:
280
  /// Build 'allocator' clause with the given allocator.
281
  ///
282
  /// \param A Allocator.
283
  /// \param StartLoc Starting location of the clause.
284
  /// \param LParenLoc Location of '('.
285
  /// \param EndLoc Ending location of the clause.
286
  OMPAllocatorClause(Expr *A, SourceLocation StartLoc, SourceLocation LParenLoc,
287
                     SourceLocation EndLoc)
288
      : OMPClause(OMPC_allocator, StartLoc, EndLoc), LParenLoc(LParenLoc),
289
242
        Allocator(A) {}
290
291
  /// Build an empty clause.
292
  OMPAllocatorClause()
293
75
      : OMPClause(OMPC_allocator, SourceLocation(), SourceLocation()) {}
294
295
  /// Sets the location of '('.
296
75
  void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
297
298
  /// Returns the location of '('.
299
121
  SourceLocation getLParenLoc() const { return LParenLoc; }
300
301
  /// Returns allocator.
302
449
  Expr *getAllocator() const { return cast_or_null<Expr>(Allocator); }
303
304
0
  child_range children() { return child_range(&Allocator, &Allocator + 1); }
305
306
0
  const_child_range children() const {
307
0
    return const_child_range(&Allocator, &Allocator + 1);
308
0
  }
309
310
0
  child_range used_children() {
311
0
    return child_range(child_iterator(), child_iterator());
312
0
  }
313
0
  const_child_range used_children() const {
314
0
    return const_child_range(const_child_iterator(), const_child_iterator());
315
0
  }
316
317
284
  static bool classof(const OMPClause *T) {
318
284
    return T->getClauseKind() == OMPC_allocator;
319
284
  }
320
};
321
322
/// This represents clause 'allocate' in the '#pragma omp ...' directives.
323
///
324
/// \code
325
/// #pragma omp parallel private(a) allocate(omp_default_mem_alloc :a)
326
/// \endcode
327
/// In this example directive '#pragma omp parallel' has clause 'private'
328
/// and clause 'allocate' for the variable 'a'.
329
class OMPAllocateClause final
330
    : public OMPVarListClause<OMPAllocateClause>,
331
      private llvm::TrailingObjects<OMPAllocateClause, Expr *> {
332
  friend class OMPClauseReader;
333
  friend OMPVarListClause;
334
  friend TrailingObjects;
335
336
  /// Allocator specified in the clause, or 'nullptr' if the default one is
337
  /// used.
338
  Expr *Allocator = nullptr;
339
  /// Position of the ':' delimiter in the clause;
340
  SourceLocation ColonLoc;
341
342
  /// Build clause with number of variables \a N.
343
  ///
344
  /// \param StartLoc Starting location of the clause.
345
  /// \param LParenLoc Location of '('.
346
  /// \param Allocator Allocator expression.
347
  /// \param ColonLoc Location of ':' delimiter.
348
  /// \param EndLoc Ending location of the clause.
349
  /// \param N Number of the variables in the clause.
350
  OMPAllocateClause(SourceLocation StartLoc, SourceLocation LParenLoc,
351
                    Expr *Allocator, SourceLocation ColonLoc,
352
                    SourceLocation EndLoc, unsigned N)
353
      : OMPVarListClause<OMPAllocateClause>(OMPC_allocate, StartLoc, LParenLoc,
354
                                            EndLoc, N),
355
1.42k
        Allocator(Allocator), ColonLoc(ColonLoc) {}
356
357
  /// Build an empty clause.
358
  ///
359
  /// \param N Number of variables.
360
  explicit OMPAllocateClause(unsigned N)
361
      : OMPVarListClause<OMPAllocateClause>(OMPC_allocate, SourceLocation(),
362
                                            SourceLocation(), SourceLocation(),
363
216
                                            N) {}
364
365
  /// Sets location of ':' symbol in clause.
366
216
  void setColonLoc(SourceLocation CL) { ColonLoc = CL; }
367
368
216
  void setAllocator(Expr *A) { Allocator = A; }
369
370
public:
371
  /// Creates clause with a list of variables \a VL.
372
  ///
373
  /// \param C AST context.
374
  /// \param StartLoc Starting location of the clause.
375
  /// \param LParenLoc Location of '('.
376
  /// \param Allocator Allocator expression.
377
  /// \param ColonLoc Location of ':' delimiter.
378
  /// \param EndLoc Ending location of the clause.
379
  /// \param VL List of references to the variables.
380
  static OMPAllocateClause *Create(const ASTContext &C, SourceLocation StartLoc,
381
                                   SourceLocation LParenLoc, Expr *Allocator,
382
                                   SourceLocation ColonLoc,
383
                                   SourceLocation EndLoc, ArrayRef<Expr *> VL);
384
385
  /// Returns the allocator expression or nullptr, if no allocator is specified.
386
4.84k
  Expr *getAllocator() const { return Allocator; }
387
388
  /// Returns the location of the ':' delimiter.
389
923
  SourceLocation getColonLoc() const { return ColonLoc; }
390
391
  /// Creates an empty clause with the place for \a N variables.
392
  ///
393
  /// \param C AST context.
394
  /// \param N The number of variables.
395
  static OMPAllocateClause *CreateEmpty(const ASTContext &C, unsigned N);
396
397
386
  child_range children() {
398
386
    return child_range(reinterpret_cast<Stmt **>(varlist_begin()),
399
386
                       reinterpret_cast<Stmt **>(varlist_end()));
400
386
  }
401
402
0
  const_child_range children() const {
403
0
    auto Children = const_cast<OMPAllocateClause *>(this)->children();
404
0
    return const_child_range(Children.begin(), Children.end());
405
0
  }
406
407
1.13k
  child_range used_children() {
408
1.13k
    return child_range(child_iterator(), child_iterator());
409
1.13k
  }
410
0
  const_child_range used_children() const {
411
0
    return const_child_range(const_child_iterator(), const_child_iterator());
412
0
  }
413
414
111k
  static bool classof(const OMPClause *T) {
415
111k
    return T->getClauseKind() == OMPC_allocate;
416
111k
  }
417
};
418
419
/// This represents 'if' clause in the '#pragma omp ...' directive.
420
///
421
/// \code
422
/// #pragma omp parallel if(parallel:a > 5)
423
/// \endcode
424
/// In this example directive '#pragma omp parallel' has simple 'if' clause with
425
/// condition 'a > 5' and directive name modifier 'parallel'.
426
class OMPIfClause : public OMPClause, public OMPClauseWithPreInit {
427
  friend class OMPClauseReader;
428
429
  /// Location of '('.
430
  SourceLocation LParenLoc;
431
432
  /// Condition of the 'if' clause.
433
  Stmt *Condition = nullptr;
434
435
  /// Location of ':' (if any).
436
  SourceLocation ColonLoc;
437
438
  /// Directive name modifier for the clause.
439
  OpenMPDirectiveKind NameModifier = llvm::omp::OMPD_unknown;
440
441
  /// Name modifier location.
442
  SourceLocation NameModifierLoc;
443
444
  /// Set condition.
445
1.74k
  void setCondition(Expr *Cond) { Condition = Cond; }
446
447
  /// Set directive name modifier for the clause.
448
1.74k
  void setNameModifier(OpenMPDirectiveKind NM) { NameModifier = NM; }
449
450
  /// Set location of directive name modifier for the clause.
451
1.74k
  void setNameModifierLoc(SourceLocation Loc) { NameModifierLoc = Loc; }
452
453
  /// Set location of ':'.
454
1.74k
  void setColonLoc(SourceLocation Loc) { ColonLoc = Loc; }
455
456
public:
457
  /// Build 'if' clause with condition \a Cond.
458
  ///
459
  /// \param NameModifier [OpenMP 4.1] Directive name modifier of clause.
460
  /// \param Cond Condition of the clause.
461
  /// \param HelperCond Helper condition for the clause.
462
  /// \param CaptureRegion Innermost OpenMP region where expressions in this
463
  /// clause must be captured.
464
  /// \param StartLoc Starting location of the clause.
465
  /// \param LParenLoc Location of '('.
466
  /// \param NameModifierLoc Location of directive name modifier.
467
  /// \param ColonLoc [OpenMP 4.1] Location of ':'.
468
  /// \param EndLoc Ending location of the clause.
469
  OMPIfClause(OpenMPDirectiveKind NameModifier, Expr *Cond, Stmt *HelperCond,
470
              OpenMPDirectiveKind CaptureRegion, SourceLocation StartLoc,
471
              SourceLocation LParenLoc, SourceLocation NameModifierLoc,
472
              SourceLocation ColonLoc, SourceLocation EndLoc)
473
      : OMPClause(OMPC_if, StartLoc, EndLoc), OMPClauseWithPreInit(this),
474
        LParenLoc(LParenLoc), Condition(Cond), ColonLoc(ColonLoc),
475
8.34k
        NameModifier(NameModifier), NameModifierLoc(NameModifierLoc) {
476
8.34k
    setPreInitStmt(HelperCond, CaptureRegion);
477
8.34k
  }
478
479
  /// Build an empty clause.
480
  OMPIfClause()
481
      : OMPClause(OMPC_if, SourceLocation(), SourceLocation()),
482
1.74k
        OMPClauseWithPreInit(this) {}
483
484
  /// Sets the location of '('.
485
1.74k
  void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
486
487
  /// Returns the location of '('.
488
3.51k
  SourceLocation getLParenLoc() const { return LParenLoc; }
489
490
  /// Return the location of ':'.
491
3.51k
  SourceLocation getColonLoc() const { return ColonLoc; }
492
493
  /// Returns condition.
494
9.71k
  Expr *getCondition() const { return cast_or_null<Expr>(Condition); }
495
496
  /// Return directive name modifier associated with the clause.
497
18.2k
  OpenMPDirectiveKind getNameModifier() const { return NameModifier; }
498
499
  /// Return the location of directive name modifier.
500
7.86k
  SourceLocation getNameModifierLoc() const { return NameModifierLoc; }
501
502
906
  child_range children() { return child_range(&Condition, &Condition + 1); }
503
504
0
  const_child_range children() const {
505
0
    return const_child_range(&Condition, &Condition + 1);
506
0
  }
507
508
  child_range used_children();
509
0
  const_child_range used_children() const {
510
0
    auto Children = const_cast<OMPIfClause *>(this)->used_children();
511
0
    return const_child_range(Children.begin(), Children.end());
512
0
  }
513
514
123k
  static bool classof(const OMPClause *T) {
515
123k
    return T->getClauseKind() == OMPC_if;
516
123k
  }
517
};
518
519
/// This represents 'final' clause in the '#pragma omp ...' directive.
520
///
521
/// \code
522
/// #pragma omp task final(a > 5)
523
/// \endcode
524
/// In this example directive '#pragma omp task' has simple 'final'
525
/// clause with condition 'a > 5'.
526
class OMPFinalClause : public OMPClause, public OMPClauseWithPreInit {
527
  friend class OMPClauseReader;
528
529
  /// Location of '('.
530
  SourceLocation LParenLoc;
531
532
  /// Condition of the 'if' clause.
533
  Stmt *Condition = nullptr;
534
535
  /// Set condition.
536
58
  void setCondition(Expr *Cond) { Condition = Cond; }
537
538
public:
539
  /// Build 'final' clause with condition \a Cond.
540
  ///
541
  /// \param Cond Condition of the clause.
542
  /// \param HelperCond Helper condition for the construct.
543
  /// \param CaptureRegion Innermost OpenMP region where expressions in this
544
  /// clause must be captured.
545
  /// \param StartLoc Starting location of the clause.
546
  /// \param LParenLoc Location of '('.
547
  /// \param EndLoc Ending location of the clause.
548
  OMPFinalClause(Expr *Cond, Stmt *HelperCond,
549
                 OpenMPDirectiveKind CaptureRegion, SourceLocation StartLoc,
550
                 SourceLocation LParenLoc, SourceLocation EndLoc)
551
      : OMPClause(OMPC_final, StartLoc, EndLoc), OMPClauseWithPreInit(this),
552
518
        LParenLoc(LParenLoc), Condition(Cond) {
553
518
    setPreInitStmt(HelperCond, CaptureRegion);
554
518
  }
555
556
  /// Build an empty clause.
557
  OMPFinalClause()
558
      : OMPClause(OMPC_final, SourceLocation(), SourceLocation()),
559
58
        OMPClauseWithPreInit(this) {}
560
561
  /// Sets the location of '('.
562
58
  void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
563
564
  /// Returns the location of '('.
565
236
  SourceLocation getLParenLoc() const { return LParenLoc; }
566
567
  /// Returns condition.
568
458
  Expr *getCondition() const { return cast_or_null<Expr>(Condition); }
569
570
152
  child_range children() { return child_range(&Condition, &Condition + 1); }
571
572
0
  const_child_range children() const {
573
0
    return const_child_range(&Condition, &Condition + 1);
574
0
  }
575
576
  child_range used_children();
577
0
  const_child_range used_children() const {
578
0
    auto Children = const_cast<OMPFinalClause *>(this)->used_children();
579
0
    return const_child_range(Children.begin(), Children.end());
580
0
  }
581
582
707
  static bool classof(const OMPClause *T) {
583
707
    return T->getClauseKind() == OMPC_final;
584
707
  }
585
};
586
587
/// This represents 'num_threads' clause in the '#pragma omp ...'
588
/// directive.
589
///
590
/// \code
591
/// #pragma omp parallel num_threads(6)
592
/// \endcode
593
/// In this example directive '#pragma omp parallel' has simple 'num_threads'
594
/// clause with number of threads '6'.
595
class OMPNumThreadsClause : public OMPClause, public OMPClauseWithPreInit {
596
  friend class OMPClauseReader;
597
598
  /// Location of '('.
599
  SourceLocation LParenLoc;
600
601
  /// Condition of the 'num_threads' clause.
602
  Stmt *NumThreads = nullptr;
603
604
  /// Set condition.
605
178
  void setNumThreads(Expr *NThreads) { NumThreads = NThreads; }
606
607
public:
608
  /// Build 'num_threads' clause with condition \a NumThreads.
609
  ///
610
  /// \param NumThreads Number of threads for the construct.
611
  /// \param HelperNumThreads Helper Number of threads for the construct.
612
  /// \param CaptureRegion Innermost OpenMP region where expressions in this
613
  /// clause must be captured.
614
  /// \param StartLoc Starting location of the clause.
615
  /// \param LParenLoc Location of '('.
616
  /// \param EndLoc Ending location of the clause.
617
  OMPNumThreadsClause(Expr *NumThreads, Stmt *HelperNumThreads,
618
                      OpenMPDirectiveKind CaptureRegion,
619
                      SourceLocation StartLoc, SourceLocation LParenLoc,
620
                      SourceLocation EndLoc)
621
      : OMPClause(OMPC_num_threads, StartLoc, EndLoc),
622
        OMPClauseWithPreInit(this), LParenLoc(LParenLoc),
623
1.40k
        NumThreads(NumThreads) {
624
1.40k
    setPreInitStmt(HelperNumThreads, CaptureRegion);
625
1.40k
  }
626
627
  /// Build an empty clause.
628
  OMPNumThreadsClause()
629
      : OMPClause(OMPC_num_threads, SourceLocation(), SourceLocation()),
630
178
        OMPClauseWithPreInit(this) {}
631
632
  /// Sets the location of '('.
633
178
  void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
634
635
  /// Returns the location of '('.
636
832
  SourceLocation getLParenLoc() const { return LParenLoc; }
637
638
  /// Returns number of threads.
639
1.63k
  Expr *getNumThreads() const { return cast_or_null<Expr>(NumThreads); }
640
641
305
  child_range children() { return child_range(&NumThreads, &NumThreads + 1); }
642
643
0
  const_child_range children() const {
644
0
    return const_child_range(&NumThreads, &NumThreads + 1);
645
0
  }
646
647
1.12k
  child_range used_children() {
648
1.12k
    return child_range(child_iterator(), child_iterator());
649
1.12k
  }
650
0
  const_child_range used_children() const {
651
0
    return const_child_range(const_child_iterator(), const_child_iterator());
652
0
  }
653
654
8.80k
  static bool classof(const OMPClause *T) {
655
8.80k
    return T->getClauseKind() == OMPC_num_threads;
656
8.80k
  }
657
};
658
659
/// This represents 'safelen' clause in the '#pragma omp ...'
660
/// directive.
661
///
662
/// \code
663
/// #pragma omp simd safelen(4)
664
/// \endcode
665
/// In this example directive '#pragma omp simd' has clause 'safelen'
666
/// with single expression '4'.
667
/// If the safelen clause is used then no two iterations executed
668
/// concurrently with SIMD instructions can have a greater distance
669
/// in the logical iteration space than its value. The parameter of
670
/// the safelen clause must be a constant positive integer expression.
671
class OMPSafelenClause : public OMPClause {
672
  friend class OMPClauseReader;
673
674
  /// Location of '('.
675
  SourceLocation LParenLoc;
676
677
  /// Safe iteration space distance.
678
  Stmt *Safelen = nullptr;
679
680
  /// Set safelen.
681
228
  void setSafelen(Expr *Len) { Safelen = Len; }
682
683
public:
684
  /// Build 'safelen' clause.
685
  ///
686
  /// \param Len Expression associated with this clause.
687
  /// \param StartLoc Starting location of the clause.
688
  /// \param EndLoc Ending location of the clause.
689
  OMPSafelenClause(Expr *Len, SourceLocation StartLoc, SourceLocation LParenLoc,
690
                   SourceLocation EndLoc)
691
      : OMPClause(OMPC_safelen, StartLoc, EndLoc), LParenLoc(LParenLoc),
692
3.35k
        Safelen(Len) {}
693
694
  /// Build an empty clause.
695
  explicit OMPSafelenClause()
696
228
      : OMPClause(OMPC_safelen, SourceLocation(), SourceLocation()) {}
697
698
  /// Sets the location of '('.
699
228
  void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
700
701
  /// Returns the location of '('.
702
2.19k
  SourceLocation getLParenLoc() const { return LParenLoc; }
703
704
  /// Return safe iteration space distance.
705
3.44k
  Expr *getSafelen() const { return cast_or_null<Expr>(Safelen); }
706
707
708
  child_range children() { return child_range(&Safelen, &Safelen + 1); }
708
709
0
  const_child_range children() const {
710
0
    return const_child_range(&Safelen, &Safelen + 1);
711
0
  }
712
713
664
  child_range used_children() {
714
664
    return child_range(child_iterator(), child_iterator());
715
664
  }
716
0
  const_child_range used_children() const {
717
0
    return const_child_range(const_child_iterator(), const_child_iterator());
718
0
  }
719
720
15.3k
  static bool classof(const OMPClause *T) {
721
15.3k
    return T->getClauseKind() == OMPC_safelen;
722
15.3k
  }
723
};
724
725
/// This represents 'simdlen' clause in the '#pragma omp ...'
726
/// directive.
727
///
728
/// \code
729
/// #pragma omp simd simdlen(4)
730
/// \endcode
731
/// In this example directive '#pragma omp simd' has clause 'simdlen'
732
/// with single expression '4'.
733
/// If the 'simdlen' clause is used then it specifies the preferred number of
734
/// iterations to be executed concurrently. The parameter of the 'simdlen'
735
/// clause must be a constant positive integer expression.
736
class OMPSimdlenClause : public OMPClause {
737
  friend class OMPClauseReader;
738
739
  /// Location of '('.
740
  SourceLocation LParenLoc;
741
742
  /// Safe iteration space distance.
743
  Stmt *Simdlen = nullptr;
744
745
  /// Set simdlen.
746
228
  void setSimdlen(Expr *Len) { Simdlen = Len; }
747
748
public:
749
  /// Build 'simdlen' clause.
750
  ///
751
  /// \param Len Expression associated with this clause.
752
  /// \param StartLoc Starting location of the clause.
753
  /// \param EndLoc Ending location of the clause.
754
  OMPSimdlenClause(Expr *Len, SourceLocation StartLoc, SourceLocation LParenLoc,
755
                   SourceLocation EndLoc)
756
      : OMPClause(OMPC_simdlen, StartLoc, EndLoc), LParenLoc(LParenLoc),
757
2.08k
        Simdlen(Len) {}
758
759
  /// Build an empty clause.
760
  explicit OMPSimdlenClause()
761
228
      : OMPClause(OMPC_simdlen, SourceLocation(), SourceLocation()) {}
762
763
  /// Sets the location of '('.
764
228
  void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
765
766
  /// Returns the location of '('.
767
1.22k
  SourceLocation getLParenLoc() const { return LParenLoc; }
768
769
  /// Return safe iteration space distance.
770
2.56k
  Expr *getSimdlen() const { return cast_or_null<Expr>(Simdlen); }
771
772
290
  child_range children() { return child_range(&Simdlen, &Simdlen + 1); }
773
774
0
  const_child_range children() const {
775
0
    return const_child_range(&Simdlen, &Simdlen + 1);
776
0
  }
777
778
688
  child_range used_children() {
779
688
    return child_range(child_iterator(), child_iterator());
780
688
  }
781
0
  const_child_range used_children() const {
782
0
    return const_child_range(const_child_iterator(), const_child_iterator());
783
0
  }
784
785
13.6k
  static bool classof(const OMPClause *T) {
786
13.6k
    return T->getClauseKind() == OMPC_simdlen;
787
13.6k
  }
788
};
789
790
/// This represents 'collapse' clause in the '#pragma omp ...'
791
/// directive.
792
///
793
/// \code
794
/// #pragma omp simd collapse(3)
795
/// \endcode
796
/// In this example directive '#pragma omp simd' has clause 'collapse'
797
/// with single expression '3'.
798
/// The parameter must be a constant positive integer expression, it specifies
799
/// the number of nested loops that should be collapsed into a single iteration
800
/// space.
801
class OMPCollapseClause : public OMPClause {
802
  friend class OMPClauseReader;
803
804
  /// Location of '('.
805
  SourceLocation LParenLoc;
806
807
  /// Number of for-loops.
808
  Stmt *NumForLoops = nullptr;
809
810
  /// Set the number of associated for-loops.
811
365
  void setNumForLoops(Expr *Num) { NumForLoops = Num; }
812
813
public:
814
  /// Build 'collapse' clause.
815
  ///
816
  /// \param Num Expression associated with this clause.
817
  /// \param StartLoc Starting location of the clause.
818
  /// \param LParenLoc Location of '('.
819
  /// \param EndLoc Ending location of the clause.
820
  OMPCollapseClause(Expr *Num, SourceLocation StartLoc,
821
                    SourceLocation LParenLoc, SourceLocation EndLoc)
822
      : OMPClause(OMPC_collapse, StartLoc, EndLoc), LParenLoc(LParenLoc),
823
5.39k
        NumForLoops(Num) {}
824
825
  /// Build an empty clause.
826
  explicit OMPCollapseClause()
827
365
      : OMPClause(OMPC_collapse, SourceLocation(), SourceLocation()) {}
828
829
  /// Sets the location of '('.
830
365
  void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
831
832
  /// Returns the location of '('.
833
3.27k
  SourceLocation getLParenLoc() const { return LParenLoc; }
834
835
  /// Return the number of associated for-loops.
836
9.29k
  Expr *getNumForLoops() const { return cast_or_null<Expr>(NumForLoops); }
837
838
768
  child_range children() { return child_range(&NumForLoops, &NumForLoops + 1); }
839
840
0
  const_child_range children() const {
841
0
    return const_child_range(&NumForLoops, &NumForLoops + 1);
842
0
  }
843
844
1.27k
  child_range used_children() {
845
1.27k
    return child_range(child_iterator(), child_iterator());
846
1.27k
  }
847
0
  const_child_range used_children() const {
848
0
    return const_child_range(const_child_iterator(), const_child_iterator());
849
0
  }
850
851
91.6k
  static bool classof(const OMPClause *T) {
852
91.6k
    return T->getClauseKind() == OMPC_collapse;
853
91.6k
  }
854
};
855
856
/// This represents 'default' clause in the '#pragma omp ...' directive.
857
///
858
/// \code
859
/// #pragma omp parallel default(shared)
860
/// \endcode
861
/// In this example directive '#pragma omp parallel' has simple 'default'
862
/// clause with kind 'shared'.
863
class OMPDefaultClause : public OMPClause {
864
  friend class OMPClauseReader;
865
866
  /// Location of '('.
867
  SourceLocation LParenLoc;
868
869
  /// A kind of the 'default' clause.
870
  llvm::omp::DefaultKind Kind = llvm::omp::OMP_DEFAULT_unknown;
871
872
  /// Start location of the kind in source code.
873
  SourceLocation KindKwLoc;
874
875
  /// Set kind of the clauses.
876
  ///
877
  /// \param K Argument of clause.
878
228
  void setDefaultKind(llvm::omp::DefaultKind K) { Kind = K; }
879
880
  /// Set argument location.
881
  ///
882
  /// \param KLoc Argument location.
883
228
  void setDefaultKindKwLoc(SourceLocation KLoc) { KindKwLoc = KLoc; }
884
885
public:
886
  /// Build 'default' clause with argument \a A ('none' or 'shared').
887
  ///
888
  /// \param A Argument of the clause ('none' or 'shared').
889
  /// \param ALoc Starting location of the argument.
890
  /// \param StartLoc Starting location of the clause.
891
  /// \param LParenLoc Location of '('.
892
  /// \param EndLoc Ending location of the clause.
893
  OMPDefaultClause(llvm::omp::DefaultKind A, SourceLocation ALoc,
894
                   SourceLocation StartLoc, SourceLocation LParenLoc,
895
                   SourceLocation EndLoc)
896
      : OMPClause(OMPC_default, StartLoc, EndLoc), LParenLoc(LParenLoc),
897
1.20k
        Kind(A), KindKwLoc(ALoc) {}
898
899
  /// Build an empty clause.
900
  OMPDefaultClause()
901
228
      : OMPClause(OMPC_default, SourceLocation(), SourceLocation()) {}
902
903
  /// Sets the location of '('.
904
228
  void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
905
906
  /// Returns the location of '('.
907
564
  SourceLocation getLParenLoc() const { return LParenLoc; }
908
909
  /// Returns kind of the clause.
910
1.27k
  llvm::omp::DefaultKind getDefaultKind() const { return Kind; }
911
912
  /// Returns location of clause kind.
913
564
  SourceLocation getDefaultKindKwLoc() const { return KindKwLoc; }
914
915
402
  child_range children() {
916
402
    return child_range(child_iterator(), child_iterator());
917
402
  }
918
919
0
  const_child_range children() const {
920
0
    return const_child_range(const_child_iterator(), const_child_iterator());
921
0
  }
922
923
862
  child_range used_children() {
924
862
    return child_range(child_iterator(), child_iterator());
925
862
  }
926
0
  const_child_range used_children() const {
927
0
    return const_child_range(const_child_iterator(), const_child_iterator());
928
0
  }
929
930
344
  static bool classof(const OMPClause *T) {
931
344
    return T->getClauseKind() == OMPC_default;
932
344
  }
933
};
934
935
/// This represents 'proc_bind' clause in the '#pragma omp ...'
936
/// directive.
937
///
938
/// \code
939
/// #pragma omp parallel proc_bind(master)
940
/// \endcode
941
/// In this example directive '#pragma omp parallel' has simple 'proc_bind'
942
/// clause with kind 'master'.
943
class OMPProcBindClause : public OMPClause {
944
  friend class OMPClauseReader;
945
946
  /// Location of '('.
947
  SourceLocation LParenLoc;
948
949
  /// A kind of the 'proc_bind' clause.
950
  llvm::omp::ProcBindKind Kind = llvm::omp::OMP_PROC_BIND_unknown;
951
952
  /// Start location of the kind in source code.
953
  SourceLocation KindKwLoc;
954
955
  /// Set kind of the clause.
956
  ///
957
  /// \param K Kind of clause.
958
98
  void setProcBindKind(llvm::omp::ProcBindKind K) { Kind = K; }
959
960
  /// Set clause kind location.
961
  ///
962
  /// \param KLoc Kind location.
963
98
  void setProcBindKindKwLoc(SourceLocation KLoc) { KindKwLoc = KLoc; }
964
965
public:
966
  /// Build 'proc_bind' clause with argument \a A ('master', 'close' or
967
  ///        'spread').
968
  ///
969
  /// \param A Argument of the clause ('master', 'close' or 'spread').
970
  /// \param ALoc Starting location of the argument.
971
  /// \param StartLoc Starting location of the clause.
972
  /// \param LParenLoc Location of '('.
973
  /// \param EndLoc Ending location of the clause.
974
  OMPProcBindClause(llvm::omp::ProcBindKind A, SourceLocation ALoc,
975
                    SourceLocation StartLoc, SourceLocation LParenLoc,
976
                    SourceLocation EndLoc)
977
      : OMPClause(OMPC_proc_bind, StartLoc, EndLoc), LParenLoc(LParenLoc),
978
676
        Kind(A), KindKwLoc(ALoc) {}
979
980
  /// Build an empty clause.
981
  OMPProcBindClause()
982
98
      : OMPClause(OMPC_proc_bind, SourceLocation(), SourceLocation()) {}
983
984
  /// Sets the location of '('.
985
98
  void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
986
987
  /// Returns the location of '('.
988
312
  SourceLocation getLParenLoc() const { return LParenLoc; }
989
990
  /// Returns kind of the clause.
991
582
  llvm::omp::ProcBindKind getProcBindKind() const { return Kind; }
992
993
  /// Returns location of clause kind.
994
312
  SourceLocation getProcBindKindKwLoc() const { return KindKwLoc; }
995
996
138
  child_range children() {
997
138
    return child_range(child_iterator(), child_iterator());
998
138
  }
999
1000
0
  const_child_range children() const {
1001
0
    return const_child_range(const_child_iterator(), const_child_iterator());
1002
0
  }
1003
1004
634
  child_range used_children() {
1005
634
    return child_range(child_iterator(), child_iterator());
1006
634
  }
1007
0
  const_child_range used_children() const {
1008
0
    return const_child_range(const_child_iterator(), const_child_iterator());
1009
0
  }
1010
1011
5.54k
  static bool classof(const OMPClause *T) {
1012
5.54k
    return T->getClauseKind() == OMPC_proc_bind;
1013
5.54k
  }
1014
};
1015
1016
/// This represents 'unified_address' clause in the '#pragma omp requires'
1017
/// directive.
1018
///
1019
/// \code
1020
/// #pragma omp requires unified_address
1021
/// \endcode
1022
/// In this example directive '#pragma omp requires' has 'unified_address'
1023
/// clause.
1024
class OMPUnifiedAddressClause final : public OMPClause {
1025
public:
1026
  friend class OMPClauseReader;
1027
  /// Build 'unified_address' clause.
1028
  ///
1029
  /// \param StartLoc Starting location of the clause.
1030
  /// \param EndLoc Ending location of the clause.
1031
  OMPUnifiedAddressClause(SourceLocation StartLoc, SourceLocation EndLoc)
1032
14
      : OMPClause(OMPC_unified_address, StartLoc, EndLoc) {}
1033
1034
  /// Build an empty clause.
1035
  OMPUnifiedAddressClause()
1036
2
      : OMPClause(OMPC_unified_address, SourceLocation(), SourceLocation()) {}
1037
1038
0
  child_range children() {
1039
0
    return child_range(child_iterator(), child_iterator());
1040
0
  }
1041
1042
0
  const_child_range children() const {
1043
0
    return const_child_range(const_child_iterator(), const_child_iterator());
1044
0
  }
1045
1046
0
  child_range used_children() {
1047
0
    return child_range(child_iterator(), child_iterator());
1048
0
  }
1049
0
  const_child_range used_children() const {
1050
0
    return const_child_range(const_child_iterator(), const_child_iterator());
1051
0
  }
1052
1053
7
  static bool classof(const OMPClause *T) {
1054
7
    return T->getClauseKind() == OMPC_unified_address;
1055
7
  }
1056
};
1057
1058
/// This represents 'unified_shared_memory' clause in the '#pragma omp requires'
1059
/// directive.
1060
///
1061
/// \code
1062
/// #pragma omp requires unified_shared_memory
1063
/// \endcode
1064
/// In this example directive '#pragma omp requires' has 'unified_shared_memory'
1065
/// clause.
1066
class OMPUnifiedSharedMemoryClause final : public OMPClause {
1067
public:
1068
  friend class OMPClauseReader;
1069
  /// Build 'unified_shared_memory' clause.
1070
  ///
1071
  /// \param StartLoc Starting location of the clause.
1072
  /// \param EndLoc Ending location of the clause.
1073
  OMPUnifiedSharedMemoryClause(SourceLocation StartLoc, SourceLocation EndLoc)
1074
28
      : OMPClause(OMPC_unified_shared_memory, StartLoc, EndLoc) {}
1075
1076
  /// Build an empty clause.
1077
  OMPUnifiedSharedMemoryClause()
1078
2
      : OMPClause(OMPC_unified_shared_memory, SourceLocation(), SourceLocation()) {}
1079
1080
0
  child_range children() {
1081
0
    return child_range(child_iterator(), child_iterator());
1082
0
  }
1083
1084
0
  const_child_range children() const {
1085
0
    return const_child_range(const_child_iterator(), const_child_iterator());
1086
0
  }
1087
1088
0
  child_range used_children() {
1089
0
    return child_range(child_iterator(), child_iterator());
1090
0
  }
1091
0
  const_child_range used_children() const {
1092
0
    return const_child_range(const_child_iterator(), const_child_iterator());
1093
0
  }
1094
1095
17
  static bool classof(const OMPClause *T) {
1096
17
    return T->getClauseKind() == OMPC_unified_shared_memory;
1097
17
  }
1098
};
1099
1100
/// This represents 'reverse_offload' clause in the '#pragma omp requires'
1101
/// directive.
1102
///
1103
/// \code
1104
/// #pragma omp requires reverse_offload
1105
/// \endcode
1106
/// In this example directive '#pragma omp requires' has 'reverse_offload'
1107
/// clause.
1108
class OMPReverseOffloadClause final : public OMPClause {
1109
public:
1110
  friend class OMPClauseReader;
1111
  /// Build 'reverse_offload' clause.
1112
  ///
1113
  /// \param StartLoc Starting location of the clause.
1114
  /// \param EndLoc Ending location of the clause.
1115
  OMPReverseOffloadClause(SourceLocation StartLoc, SourceLocation EndLoc)
1116
9
      : OMPClause(OMPC_reverse_offload, StartLoc, EndLoc) {}
1117
1118
  /// Build an empty clause.
1119
  OMPReverseOffloadClause()
1120
2
      : OMPClause(OMPC_reverse_offload, SourceLocation(), SourceLocation()) {}
1121
1122
0
  child_range children() {
1123
0
    return child_range(child_iterator(), child_iterator());
1124
0
  }
1125
1126
0
  const_child_range children() const {
1127
0
    return const_child_range(const_child_iterator(), const_child_iterator());
1128
0
  }
1129
1130
0
  child_range used_children() {
1131
0
    return child_range(child_iterator(), child_iterator());
1132
0
  }
1133
0
  const_child_range used_children() const {
1134
0
    return const_child_range(const_child_iterator(), const_child_iterator());
1135
0
  }
1136
1137
6
  static bool classof(const OMPClause *T) {
1138
6
    return T->getClauseKind() == OMPC_reverse_offload;
1139
6
  }
1140
};
1141
1142
/// This represents 'dynamic_allocators' clause in the '#pragma omp requires'
1143
/// directive.
1144
///
1145
/// \code
1146
/// #pragma omp requires dynamic_allocators
1147
/// \endcode
1148
/// In this example directive '#pragma omp requires' has 'dynamic_allocators'
1149
/// clause.
1150
class OMPDynamicAllocatorsClause final : public OMPClause {
1151
public:
1152
  friend class OMPClauseReader;
1153
  /// Build 'dynamic_allocators' clause.
1154
  ///
1155
  /// \param StartLoc Starting location of the clause.
1156
  /// \param EndLoc Ending location of the clause.
1157
  OMPDynamicAllocatorsClause(SourceLocation StartLoc, SourceLocation EndLoc)
1158
10
      : OMPClause(OMPC_dynamic_allocators, StartLoc, EndLoc) {}
1159
1160
  /// Build an empty clause.
1161
  OMPDynamicAllocatorsClause()
1162
2
      : OMPClause(OMPC_dynamic_allocators, SourceLocation(), SourceLocation()) {
1163
2
  }
1164
1165
0
  child_range children() {
1166
0
    return child_range(child_iterator(), child_iterator());
1167
0
  }
1168
1169
0
  const_child_range children() const {
1170
0
    return const_child_range(const_child_iterator(), const_child_iterator());
1171
0
  }
1172
1173
0
  child_range used_children() {
1174
0
    return child_range(child_iterator(), child_iterator());
1175
0
  }
1176
0
  const_child_range used_children() const {
1177
0
    return const_child_range(const_child_iterator(), const_child_iterator());
1178
0
  }
1179
1180
9
  static bool classof(const OMPClause *T) {
1181
9
    return T->getClauseKind() == OMPC_dynamic_allocators;
1182
9
  }
1183
};
1184
1185
/// This represents 'atomic_default_mem_order' clause in the '#pragma omp
1186
/// requires'  directive.
1187
///
1188
/// \code
1189
/// #pragma omp requires atomic_default_mem_order(seq_cst)
1190
/// \endcode
1191
/// In this example directive '#pragma omp requires' has simple
1192
/// atomic_default_mem_order' clause with kind 'seq_cst'.
1193
class OMPAtomicDefaultMemOrderClause final : public OMPClause {
1194
  friend class OMPClauseReader;
1195
1196
  /// Location of '('
1197
  SourceLocation LParenLoc;
1198
1199
  /// A kind of the 'atomic_default_mem_order' clause.
1200
  OpenMPAtomicDefaultMemOrderClauseKind Kind =
1201
      OMPC_ATOMIC_DEFAULT_MEM_ORDER_unknown;
1202
1203
  /// Start location of the kind in source code.
1204
  SourceLocation KindKwLoc;
1205
1206
  /// Set kind of the clause.
1207
  ///
1208
  /// \param K Kind of clause.
1209
12
  void setAtomicDefaultMemOrderKind(OpenMPAtomicDefaultMemOrderClauseKind K) {
1210
12
    Kind = K;
1211
12
  }
1212
1213
  /// Set clause kind location.
1214
  ///
1215
  /// \param KLoc Kind location.
1216
12
  void setAtomicDefaultMemOrderKindKwLoc(SourceLocation KLoc) {
1217
12
    KindKwLoc = KLoc;
1218
12
  }
1219
1220
public:
1221
  /// Build 'atomic_default_mem_order' clause with argument \a A ('seq_cst',
1222
  /// 'acq_rel' or 'relaxed').
1223
  ///
1224
  /// \param A Argument of the clause ('seq_cst', 'acq_rel' or 'relaxed').
1225
  /// \param ALoc Starting location of the argument.
1226
  /// \param StartLoc Starting location of the clause.
1227
  /// \param LParenLoc Location of '('.
1228
  /// \param EndLoc Ending location of the clause.
1229
  OMPAtomicDefaultMemOrderClause(OpenMPAtomicDefaultMemOrderClauseKind A,
1230
                                 SourceLocation ALoc, SourceLocation StartLoc,
1231
                                 SourceLocation LParenLoc,
1232
                                 SourceLocation EndLoc)
1233
      : OMPClause(OMPC_atomic_default_mem_order, StartLoc, EndLoc),
1234
35
        LParenLoc(LParenLoc), Kind(A), KindKwLoc(ALoc) {}
1235
1236
  /// Build an empty clause.
1237
  OMPAtomicDefaultMemOrderClause()
1238
      : OMPClause(OMPC_atomic_default_mem_order, SourceLocation(),
1239
12
                  SourceLocation()) {}
1240
1241
  /// Sets the location of '('.
1242
12
  void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
1243
1244
  /// Returns the locaiton of '('.
1245
12
  SourceLocation getLParenLoc() const { return LParenLoc; }
1246
1247
  /// Returns kind of the clause.
1248
36
  OpenMPAtomicDefaultMemOrderClauseKind getAtomicDefaultMemOrderKind() const {
1249
36
    return Kind;
1250
36
  }
1251
1252
  /// Returns location of clause kind.
1253
12
  SourceLocation getAtomicDefaultMemOrderKindKwLoc() const { return KindKwLoc; }
1254
1255
0
  child_range children() {
1256
0
    return child_range(child_iterator(), child_iterator());
1257
0
  }
1258
1259
0
  const_child_range children() const {
1260
0
    return const_child_range(const_child_iterator(), const_child_iterator());
1261
0
  }
1262
1263
0
  child_range used_children() {
1264
0
    return child_range(child_iterator(), child_iterator());
1265
0
  }
1266
0
  const_child_range used_children() const {
1267
0
    return const_child_range(const_child_iterator(), const_child_iterator());
1268
0
  }
1269
1270
27
  static bool classof(const OMPClause *T) {
1271
27
    return T->getClauseKind() == OMPC_atomic_default_mem_order;
1272
27
  }
1273
};
1274
1275
/// This represents 'schedule' clause in the '#pragma omp ...' directive.
1276
///
1277
/// \code
1278
/// #pragma omp for schedule(static, 3)
1279
/// \endcode
1280
/// In this example directive '#pragma omp for' has 'schedule' clause with
1281
/// arguments 'static' and '3'.
1282
class OMPScheduleClause : public OMPClause, public OMPClauseWithPreInit {
1283
  friend class OMPClauseReader;
1284
1285
  /// Location of '('.
1286
  SourceLocation LParenLoc;
1287
1288
  /// A kind of the 'schedule' clause.
1289
  OpenMPScheduleClauseKind Kind = OMPC_SCHEDULE_unknown;
1290
1291
  /// Modifiers for 'schedule' clause.
1292
  enum {FIRST, SECOND, NUM_MODIFIERS};
1293
  OpenMPScheduleClauseModifier Modifiers[NUM_MODIFIERS];
1294
1295
  /// Locations of modifiers.
1296
  SourceLocation ModifiersLoc[NUM_MODIFIERS];
1297
1298
  /// Start location of the schedule ind in source code.
1299
  SourceLocation KindLoc;
1300
1301
  /// Location of ',' (if any).
1302
  SourceLocation CommaLoc;
1303
1304
  /// Chunk size.
1305
  Expr *ChunkSize = nullptr;
1306
1307
  /// Set schedule kind.
1308
  ///
1309
  /// \param K Schedule kind.
1310
458
  void setScheduleKind(OpenMPScheduleClauseKind K) { Kind = K; }
1311
1312
  /// Set the first schedule modifier.
1313
  ///
1314
  /// \param M Schedule modifier.
1315
458
  void setFirstScheduleModifier(OpenMPScheduleClauseModifier M) {
1316
458
    Modifiers[FIRST] = M;
1317
458
  }
1318
1319
  /// Set the second schedule modifier.
1320
  ///
1321
  /// \param M Schedule modifier.
1322
458
  void setSecondScheduleModifier(OpenMPScheduleClauseModifier M) {
1323
458
    Modifiers[SECOND] = M;
1324
458
  }
1325
1326
  /// Set location of the first schedule modifier.
1327
458
  void setFirstScheduleModifierLoc(SourceLocation Loc) {
1328
458
    ModifiersLoc[FIRST] = Loc;
1329
458
  }
1330
1331
  /// Set location of the second schedule modifier.
1332
458
  void setSecondScheduleModifierLoc(SourceLocation Loc) {
1333
458
    ModifiersLoc[SECOND] = Loc;
1334
458
  }
1335
1336
  /// Set schedule modifier location.
1337
  ///
1338
  /// \param M Schedule modifier location.
1339
0
  void setScheduleModifer(OpenMPScheduleClauseModifier M) {
1340
0
    if (Modifiers[FIRST] == OMPC_SCHEDULE_MODIFIER_unknown)
1341
0
      Modifiers[FIRST] = M;
1342
0
    else {
1343
0
      assert(Modifiers[SECOND] == OMPC_SCHEDULE_MODIFIER_unknown);
1344
0
      Modifiers[SECOND] = M;
1345
0
    }
1346
0
  }
1347
1348
  /// Sets the location of '('.
1349
  ///
1350
  /// \param Loc Location of '('.
1351
458
  void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
1352
1353
  /// Set schedule kind start location.
1354
  ///
1355
  /// \param KLoc Schedule kind location.
1356
458
  void setScheduleKindLoc(SourceLocation KLoc) { KindLoc = KLoc; }
1357
1358
  /// Set location of ','.
1359
  ///
1360
  /// \param Loc Location of ','.
1361
458
  void setCommaLoc(SourceLocation Loc) { CommaLoc = Loc; }
1362
1363
  /// Set chunk size.
1364
  ///
1365
  /// \param E Chunk size.
1366
458
  void setChunkSize(Expr *E) { ChunkSize = E; }
1367
1368
public:
1369
  /// Build 'schedule' clause with schedule kind \a Kind and chunk size
1370
  /// expression \a ChunkSize.
1371
  ///
1372
  /// \param StartLoc Starting location of the clause.
1373
  /// \param LParenLoc Location of '('.
1374
  /// \param KLoc Starting location of the argument.
1375
  /// \param CommaLoc Location of ','.
1376
  /// \param EndLoc Ending location of the clause.
1377
  /// \param Kind Schedule kind.
1378
  /// \param ChunkSize Chunk size.
1379
  /// \param HelperChunkSize Helper chunk size for combined directives.
1380
  /// \param M1 The first modifier applied to 'schedule' clause.
1381
  /// \param M1Loc Location of the first modifier
1382
  /// \param M2 The second modifier applied to 'schedule' clause.
1383
  /// \param M2Loc Location of the second modifier
1384
  OMPScheduleClause(SourceLocation StartLoc, SourceLocation LParenLoc,
1385
                    SourceLocation KLoc, SourceLocation CommaLoc,
1386
                    SourceLocation EndLoc, OpenMPScheduleClauseKind Kind,
1387
                    Expr *ChunkSize, Stmt *HelperChunkSize,
1388
                    OpenMPScheduleClauseModifier M1, SourceLocation M1Loc,
1389
                    OpenMPScheduleClauseModifier M2, SourceLocation M2Loc)
1390
      : OMPClause(OMPC_schedule, StartLoc, EndLoc), OMPClauseWithPreInit(this),
1391
        LParenLoc(LParenLoc), Kind(Kind), KindLoc(KLoc), CommaLoc(CommaLoc),
1392
3.06k
        ChunkSize(ChunkSize) {
1393
3.06k
    setPreInitStmt(HelperChunkSize);
1394
3.06k
    Modifiers[FIRST] = M1;
1395
3.06k
    Modifiers[SECOND] = M2;
1396
3.06k
    ModifiersLoc[FIRST] = M1Loc;
1397
3.06k
    ModifiersLoc[SECOND] = M2Loc;
1398
3.06k
  }
1399
1400
  /// Build an empty clause.
1401
  explicit OMPScheduleClause()
1402
      : OMPClause(OMPC_schedule, SourceLocation(), SourceLocation()),
1403
458
        OMPClauseWithPreInit(this) {
1404
458
    Modifiers[FIRST] = OMPC_SCHEDULE_MODIFIER_unknown;
1405
458
    Modifiers[SECOND] = OMPC_SCHEDULE_MODIFIER_unknown;
1406
458
  }
1407
1408
  /// Get kind of the clause.
1409
2.91k
  OpenMPScheduleClauseKind getScheduleKind() const { return Kind; }
1410
1411
  /// Get the first modifier of the clause.
1412
5.76k
  OpenMPScheduleClauseModifier getFirstScheduleModifier() const {
1413
5.76k
    return Modifiers[FIRST];
1414
5.76k
  }
1415
1416
  /// Get the second modifier of the clause.
1417
5.45k
  OpenMPScheduleClauseModifier getSecondScheduleModifier() const {
1418
5.45k
    return Modifiers[SECOND];
1419
5.45k
  }
1420
1421
  /// Get location of '('.
1422
1.45k
  SourceLocation getLParenLoc() { return LParenLoc; }
1423
1424
  /// Get kind location.
1425
1.45k
  SourceLocation getScheduleKindLoc() { return KindLoc; }
1426
1427
  /// Get the first modifier location.
1428
1.46k
  SourceLocation getFirstScheduleModifierLoc() const {
1429
1.46k
    return ModifiersLoc[FIRST];
1430
1.46k
  }
1431
1432
  /// Get the second modifier location.
1433
1.45k
  SourceLocation getSecondScheduleModifierLoc() const {
1434
1.45k
    return ModifiersLoc[SECOND];
1435
1.45k
  }
1436
1437
  /// Get location of ','.
1438
1.45k
  SourceLocation getCommaLoc() { return CommaLoc; }
1439
1440
  /// Get chunk size.
1441
1.75k
  Expr *getChunkSize() { return ChunkSize; }
1442
1443
  /// Get chunk size.
1444
1.22k
  const Expr *getChunkSize() const { return ChunkSize; }
1445
1446
1.15k
  child_range children() {
1447
1.15k
    return child_range(reinterpret_cast<Stmt **>(&ChunkSize),
1448
1.15k
                       reinterpret_cast<Stmt **>(&ChunkSize) + 1);
1449
1.15k
  }
1450
1451
0
  const_child_range children() const {
1452
0
    auto Children = const_cast<OMPScheduleClause *>(this)->children();
1453
0
    return const_child_range(Children.begin(), Children.end());
1454
0
  }
1455
1456
2.82k
  child_range used_children() {
1457
2.82k
    return child_range(child_iterator(), child_iterator());
1458
2.82k
  }
1459
0
  const_child_range used_children() const {
1460
0
    return const_child_range(const_child_iterator(), const_child_iterator());
1461
0
  }
1462
1463
10.1k
  static bool classof(const OMPClause *T) {
1464
10.1k
    return T->getClauseKind() == OMPC_schedule;
1465
10.1k
  }
1466
};
1467
1468
/// This represents 'ordered' clause in the '#pragma omp ...' directive.
1469
///
1470
/// \code
1471
/// #pragma omp for ordered (2)
1472
/// \endcode
1473
/// In this example directive '#pragma omp for' has 'ordered' clause with
1474
/// parameter 2.
1475
class OMPOrderedClause final
1476
    : public OMPClause,
1477
      private llvm::TrailingObjects<OMPOrderedClause, Expr *> {
1478
  friend class OMPClauseReader;
1479
  friend TrailingObjects;
1480
1481
  /// Location of '('.
1482
  SourceLocation LParenLoc;
1483
1484
  /// Number of for-loops.
1485
  Stmt *NumForLoops = nullptr;
1486
1487
  /// Real number of loops.
1488
  unsigned NumberOfLoops = 0;
1489
1490
  /// Build 'ordered' clause.
1491
  ///
1492
  /// \param Num Expression, possibly associated with this clause.
1493
  /// \param NumLoops Number of loops, associated with this clause.
1494
  /// \param StartLoc Starting location of the clause.
1495
  /// \param LParenLoc Location of '('.
1496
  /// \param EndLoc Ending location of the clause.
1497
  OMPOrderedClause(Expr *Num, unsigned NumLoops, SourceLocation StartLoc,
1498
                   SourceLocation LParenLoc, SourceLocation EndLoc)
1499
      : OMPClause(OMPC_ordered, StartLoc, EndLoc), LParenLoc(LParenLoc),
1500
1.11k
        NumForLoops(Num), NumberOfLoops(NumLoops) {}
1501
1502
  /// Build an empty clause.
1503
  explicit OMPOrderedClause(unsigned NumLoops)
1504
      : OMPClause(OMPC_ordered, SourceLocation(), SourceLocation()),
1505
64
        NumberOfLoops(NumLoops) {}
1506
1507
  /// Set the number of associated for-loops.
1508
64
  void setNumForLoops(Expr *Num) { NumForLoops = Num; }
1509
1510
public:
1511
  /// Build 'ordered' clause.
1512
  ///
1513
  /// \param Num Expression, possibly associated with this clause.
1514
  /// \param NumLoops Number of loops, associated with this clause.
1515
  /// \param StartLoc Starting location of the clause.
1516
  /// \param LParenLoc Location of '('.
1517
  /// \param EndLoc Ending location of the clause.
1518
  static OMPOrderedClause *Create(const ASTContext &C, Expr *Num,
1519
                                  unsigned NumLoops, SourceLocation StartLoc,
1520
                                  SourceLocation LParenLoc,
1521
                                  SourceLocation EndLoc);
1522
1523
  /// Build an empty clause.
1524
  static OMPOrderedClause* CreateEmpty(const ASTContext &C, unsigned NumLoops);
1525
1526
  /// Sets the location of '('.
1527
64
  void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
1528
1529
  /// Returns the location of '('.
1530
556
  SourceLocation getLParenLoc() const { return LParenLoc; }
1531
1532
  /// Return the number of associated for-loops.
1533
2.87k
  Expr *getNumForLoops() const { return cast_or_null<Expr>(NumForLoops); }
1534
1535
  /// Set number of iterations for the specified loop.
1536
  void setLoopNumIterations(unsigned NumLoop, Expr *NumIterations);
1537
  /// Get number of iterations for all the loops.
1538
  ArrayRef<Expr *> getLoopNumIterations() const;
1539
1540
  /// Set loop counter for the specified loop.
1541
  void setLoopCounter(unsigned NumLoop, Expr *Counter);
1542
  /// Get loops counter for the specified loop.
1543
  Expr *getLoopCounter(unsigned NumLoop);
1544
  const Expr *getLoopCounter(unsigned NumLoop) const;
1545
1546
60
  child_range children() { return child_range(&NumForLoops, &NumForLoops + 1); }
1547
1548
0
  const_child_range children() const {
1549
0
    return const_child_range(&NumForLoops, &NumForLoops + 1);
1550
0
  }
1551
1552
212
  child_range used_children() {
1553
212
    return child_range(child_iterator(), child_iterator());
1554
212
  }
1555
0
  const_child_range used_children() const {
1556
0
    return const_child_range(const_child_iterator(), const_child_iterator());
1557
0
  }
1558
1559
64.3k
  static bool classof(const OMPClause *T) {
1560
64.3k
    return T->getClauseKind() == OMPC_ordered;
1561
64.3k
  }
1562
};
1563
1564
/// This represents 'nowait' clause in the '#pragma omp ...' directive.
1565
///
1566
/// \code
1567
/// #pragma omp for nowait
1568
/// \endcode
1569
/// In this example directive '#pragma omp for' has 'nowait' clause.
1570
class OMPNowaitClause : public OMPClause {
1571
public:
1572
  /// Build 'nowait' clause.
1573
  ///
1574
  /// \param StartLoc Starting location of the clause.
1575
  /// \param EndLoc Ending location of the clause.
1576
  OMPNowaitClause(SourceLocation StartLoc, SourceLocation EndLoc)
1577
1.07k
      : OMPClause(OMPC_nowait, StartLoc, EndLoc) {}
1578
1579
  /// Build an empty clause.
1580
  OMPNowaitClause()
1581
396
      : OMPClause(OMPC_nowait, SourceLocation(), SourceLocation()) {}
1582
1583
58
  child_range children() {
1584
58
    return child_range(child_iterator(), child_iterator());
1585
58
  }
1586
1587
0
  const_child_range children() const {
1588
0
    return const_child_range(const_child_iterator(), const_child_iterator());
1589
0
  }
1590
1591
2.39k
  child_range used_children() {
1592
2.39k
    return child_range(child_iterator(), child_iterator());
1593
2.39k
  }
1594
0
  const_child_range used_children() const {
1595
0
    return const_child_range(const_child_iterator(), const_child_iterator());
1596
0
  }
1597
1598
10.9k
  static bool classof(const OMPClause *T) {
1599
10.9k
    return T->getClauseKind() == OMPC_nowait;
1600
10.9k
  }
1601
};
1602
1603
/// This represents 'untied' clause in the '#pragma omp ...' directive.
1604
///
1605
/// \code
1606
/// #pragma omp task untied
1607
/// \endcode
1608
/// In this example directive '#pragma omp task' has 'untied' clause.
1609
class OMPUntiedClause : public OMPClause {
1610
public:
1611
  /// Build 'untied' clause.
1612
  ///
1613
  /// \param StartLoc Starting location of the clause.
1614
  /// \param EndLoc Ending location of the clause.
1615
  OMPUntiedClause(SourceLocation StartLoc, SourceLocation EndLoc)
1616
76
      : OMPClause(OMPC_untied, StartLoc, EndLoc) {}
1617
1618
  /// Build an empty clause.
1619
  OMPUntiedClause()
1620
34
      : OMPClause(OMPC_untied, SourceLocation(), SourceLocation()) {}
1621
1622
72
  child_range children() {
1623
72
    return child_range(child_iterator(), child_iterator());
1624
72
  }
1625
1626
0
  const_child_range children() const {
1627
0
    return const_child_range(const_child_iterator(), const_child_iterator());
1628
0
  }
1629
1630
312
  child_range used_children() {
1631
312
    return child_range(child_iterator(), child_iterator());
1632
312
  }
1633
0
  const_child_range used_children() const {
1634
0
    return const_child_range(const_child_iterator(), const_child_iterator());
1635
0
  }
1636
1637
225
  static bool classof(const OMPClause *T) {
1638
225
    return T->getClauseKind() == OMPC_untied;
1639
225
  }
1640
};
1641
1642
/// This represents 'mergeable' clause in the '#pragma omp ...'
1643
/// directive.
1644
///
1645
/// \code
1646
/// #pragma omp task mergeable
1647
/// \endcode
1648
/// In this example directive '#pragma omp task' has 'mergeable' clause.
1649
class OMPMergeableClause : public OMPClause {
1650
public:
1651
  /// Build 'mergeable' clause.
1652
  ///
1653
  /// \param StartLoc Starting location of the clause.
1654
  /// \param EndLoc Ending location of the clause.
1655
  OMPMergeableClause(SourceLocation StartLoc, SourceLocation EndLoc)
1656
88
      : OMPClause(OMPC_mergeable, StartLoc, EndLoc) {}
1657
1658
  /// Build an empty clause.
1659
  OMPMergeableClause()
1660
40
      : OMPClause(OMPC_mergeable, SourceLocation(), SourceLocation()) {}
1661
1662
116
  child_range children() {
1663
116
    return child_range(child_iterator(), child_iterator());
1664
116
  }
1665
1666
0
  const_child_range children() const {
1667
0
    return const_child_range(const_child_iterator(), const_child_iterator());
1668
0
  }
1669
1670
328
  child_range used_children() {
1671
328
    return child_range(child_iterator(), child_iterator());
1672
328
  }
1673
0
  const_child_range used_children() const {
1674
0
    return const_child_range(const_child_iterator(), const_child_iterator());
1675
0
  }
1676
1677
84
  static bool classof(const OMPClause *T) {
1678
84
    return T->getClauseKind() == OMPC_mergeable;
1679
84
  }
1680
};
1681
1682
/// This represents 'read' clause in the '#pragma omp atomic' directive.
1683
///
1684
/// \code
1685
/// #pragma omp atomic read
1686
/// \endcode
1687
/// In this example directive '#pragma omp atomic' has 'read' clause.
1688
class OMPReadClause : public OMPClause {
1689
public:
1690
  /// Build 'read' clause.
1691
  ///
1692
  /// \param StartLoc Starting location of the clause.
1693
  /// \param EndLoc Ending location of the clause.
1694
  OMPReadClause(SourceLocation StartLoc, SourceLocation EndLoc)
1695
405
      : OMPClause(OMPC_read, StartLoc, EndLoc) {}
1696
1697
  /// Build an empty clause.
1698
128
  OMPReadClause() : OMPClause(OMPC_read, SourceLocation(), SourceLocation()) {}
1699
1700
16
  child_range children() {
1701
16
    return child_range(child_iterator(), child_iterator());
1702
16
  }
1703
1704
0
  const_child_range children() const {
1705
0
    return const_child_range(const_child_iterator(), const_child_iterator());
1706
0
  }
1707
1708
92
  child_range used_children() {
1709
92
    return child_range(child_iterator(), child_iterator());
1710
92
  }
1711
0
  const_child_range used_children() const {
1712
0
    return const_child_range(const_child_iterator(), const_child_iterator());
1713
0
  }
1714
1715
72
  static bool classof(const OMPClause *T) {
1716
72
    return T->getClauseKind() == OMPC_read;
1717
72
  }
1718
};
1719
1720
/// This represents 'write' clause in the '#pragma omp atomic' directive.
1721
///
1722
/// \code
1723
/// #pragma omp atomic write
1724
/// \endcode
1725
/// In this example directive '#pragma omp atomic' has 'write' clause.
1726
class OMPWriteClause : public OMPClause {
1727
public:
1728
  /// Build 'write' clause.
1729
  ///
1730
  /// \param StartLoc Starting location of the clause.
1731
  /// \param EndLoc Ending location of the clause.
1732
  OMPWriteClause(SourceLocation StartLoc, SourceLocation EndLoc)
1733
400
      : OMPClause(OMPC_write, StartLoc, EndLoc) {}
1734
1735
  /// Build an empty clause.
1736
  OMPWriteClause()
1737
130
      : OMPClause(OMPC_write, SourceLocation(), SourceLocation()) {}
1738
1739
16
  child_range children() {
1740
16
    return child_range(child_iterator(), child_iterator());
1741
16
  }
1742
1743
0
  const_child_range children() const {
1744
0
    return const_child_range(const_child_iterator(), const_child_iterator());
1745
0
  }
1746
1747
56
  child_range used_children() {
1748
56
    return child_range(child_iterator(), child_iterator());
1749
56
  }
1750
0
  const_child_range used_children() const {
1751
0
    return const_child_range(const_child_iterator(), const_child_iterator());
1752
0
  }
1753
1754
52
  static bool classof(const OMPClause *T) {
1755
52
    return T->getClauseKind() == OMPC_write;
1756
52
  }
1757
};
1758
1759
/// This represents 'update' clause in the '#pragma omp atomic'
1760
/// directive.
1761
///
1762
/// \code
1763
/// #pragma omp atomic update
1764
/// \endcode
1765
/// In this example directive '#pragma omp atomic' has 'update' clause.
1766
class OMPUpdateClause : public OMPClause {
1767
public:
1768
  /// Build 'update' clause.
1769
  ///
1770
  /// \param StartLoc Starting location of the clause.
1771
  /// \param EndLoc Ending location of the clause.
1772
  OMPUpdateClause(SourceLocation StartLoc, SourceLocation EndLoc)
1773
425
      : OMPClause(OMPC_update, StartLoc, EndLoc) {}
1774
1775
  /// Build an empty clause.
1776
  OMPUpdateClause()
1777
80
      : OMPClause(OMPC_update, SourceLocation(), SourceLocation()) {}
1778
1779
8
  child_range children() {
1780
8
    return child_range(child_iterator(), child_iterator());
1781
8
  }
1782
1783
0
  const_child_range children() const {
1784
0
    return const_child_range(const_child_iterator(), const_child_iterator());
1785
0
  }
1786
1787
56
  child_range used_children() {
1788
56
    return child_range(child_iterator(), child_iterator());
1789
56
  }
1790
0
  const_child_range used_children() const {
1791
0
    return const_child_range(const_child_iterator(), const_child_iterator());
1792
0
  }
1793
1794
80
  static bool classof(const OMPClause *T) {
1795
80
    return T->getClauseKind() == OMPC_update;
1796
80
  }
1797
};
1798
1799
/// This represents 'capture' clause in the '#pragma omp atomic'
1800
/// directive.
1801
///
1802
/// \code
1803
/// #pragma omp atomic capture
1804
/// \endcode
1805
/// In this example directive '#pragma omp atomic' has 'capture' clause.
1806
class OMPCaptureClause : public OMPClause {
1807
public:
1808
  /// Build 'capture' clause.
1809
  ///
1810
  /// \param StartLoc Starting location of the clause.
1811
  /// \param EndLoc Ending location of the clause.
1812
  OMPCaptureClause(SourceLocation StartLoc, SourceLocation EndLoc)
1813
1.17k
      : OMPClause(OMPC_capture, StartLoc, EndLoc) {}
1814
1815
  /// Build an empty clause.
1816
  OMPCaptureClause()
1817
158
      : OMPClause(OMPC_capture, SourceLocation(), SourceLocation()) {}
1818
1819
16
  child_range children() {
1820
16
    return child_range(child_iterator(), child_iterator());
1821
16
  }
1822
1823
0
  const_child_range children() const {
1824
0
    return const_child_range(const_child_iterator(), const_child_iterator());
1825
0
  }
1826
1827
112
  child_range used_children() {
1828
112
    return child_range(child_iterator(), child_iterator());
1829
112
  }
1830
0
  const_child_range used_children() const {
1831
0
    return const_child_range(const_child_iterator(), const_child_iterator());
1832
0
  }
1833
1834
288
  static bool classof(const OMPClause *T) {
1835
288
    return T->getClauseKind() == OMPC_capture;
1836
288
  }
1837
};
1838
1839
/// This represents 'seq_cst' clause in the '#pragma omp atomic'
1840
/// directive.
1841
///
1842
/// \code
1843
/// #pragma omp atomic seq_cst
1844
/// \endcode
1845
/// In this example directive '#pragma omp atomic' has 'seq_cst' clause.
1846
class OMPSeqCstClause : public OMPClause {
1847
public:
1848
  /// Build 'seq_cst' clause.
1849
  ///
1850
  /// \param StartLoc Starting location of the clause.
1851
  /// \param EndLoc Ending location of the clause.
1852
  OMPSeqCstClause(SourceLocation StartLoc, SourceLocation EndLoc)
1853
176
      : OMPClause(OMPC_seq_cst, StartLoc, EndLoc) {}
1854
1855
  /// Build an empty clause.
1856
  OMPSeqCstClause()
1857
56
      : OMPClause(OMPC_seq_cst, SourceLocation(), SourceLocation()) {}
1858
1859
0
  child_range children() {
1860
0
    return child_range(child_iterator(), child_iterator());
1861
0
  }
1862
1863
0
  const_child_range children() const {
1864
0
    return const_child_range(const_child_iterator(), const_child_iterator());
1865
0
  }
1866
1867
48
  child_range used_children() {
1868
48
    return child_range(child_iterator(), child_iterator());
1869
48
  }
1870
0
  const_child_range used_children() const {
1871
0
    return const_child_range(const_child_iterator(), const_child_iterator());
1872
0
  }
1873
1874
522
  static bool classof(const OMPClause *T) {
1875
522
    return T->getClauseKind() == OMPC_seq_cst;
1876
522
  }
1877
};
1878
1879
/// This represents 'acq_rel' clause in the '#pragma omp atomic|flush'
1880
/// directives.
1881
///
1882
/// \code
1883
/// #pragma omp flush acq_rel
1884
/// \endcode
1885
/// In this example directive '#pragma omp flush' has 'acq_rel' clause.
1886
class OMPAcqRelClause final : public OMPClause {
1887
public:
1888
  /// Build 'ack_rel' clause.
1889
  ///
1890
  /// \param StartLoc Starting location of the clause.
1891
  /// \param EndLoc Ending location of the clause.
1892
  OMPAcqRelClause(SourceLocation StartLoc, SourceLocation EndLoc)
1893
60
      : OMPClause(OMPC_acq_rel, StartLoc, EndLoc) {}
1894
1895
  /// Build an empty clause.
1896
  OMPAcqRelClause()
1897
20
      : OMPClause(OMPC_acq_rel, SourceLocation(), SourceLocation()) {}
1898
1899
0
  child_range children() {
1900
0
    return child_range(child_iterator(), child_iterator());
1901
0
  }
1902
1903
0
  const_child_range children() const {
1904
0
    return const_child_range(const_child_iterator(), const_child_iterator());
1905
0
  }
1906
1907
44
  child_range used_children() {
1908
44
    return child_range(child_iterator(), child_iterator());
1909
44
  }
1910
0
  const_child_range used_children() const {
1911
0
    return const_child_range(const_child_iterator(), const_child_iterator());
1912
0
  }
1913
1914
412
  static bool classof(const OMPClause *T) {
1915
412
    return T->getClauseKind() == OMPC_acq_rel;
1916
412
  }
1917
};
1918
1919
/// This represents 'acquire' clause in the '#pragma omp atomic|flush'
1920
/// directives.
1921
///
1922
/// \code
1923
/// #pragma omp flush acquire
1924
/// \endcode
1925
/// In this example directive '#pragma omp flush' has 'acquire' clause.
1926
class OMPAcquireClause final : public OMPClause {
1927
public:
1928
  /// Build 'acquire' clause.
1929
  ///
1930
  /// \param StartLoc Starting location of the clause.
1931
  /// \param EndLoc Ending location of the clause.
1932
  OMPAcquireClause(SourceLocation StartLoc, SourceLocation EndLoc)
1933
70
      : OMPClause(OMPC_acquire, StartLoc, EndLoc) {}
1934
1935
  /// Build an empty clause.
1936
  OMPAcquireClause()
1937
26
      : OMPClause(OMPC_acquire, SourceLocation(), SourceLocation()) {}
1938
1939
0
  child_range children() {
1940
0
    return child_range(child_iterator(), child_iterator());
1941
0
  }
1942
1943
0
  const_child_range children() const {
1944
0
    return const_child_range(const_child_iterator(), const_child_iterator());
1945
0
  }
1946
1947
52
  child_range used_children() {
1948
52
    return child_range(child_iterator(), child_iterator());
1949
52
  }
1950
0
  const_child_range used_children() const {
1951
0
    return const_child_range(const_child_iterator(), const_child_iterator());
1952
0
  }
1953
1954
414
  static bool classof(const OMPClause *T) {
1955
414
    return T->getClauseKind() == OMPC_acquire;
1956
414
  }
1957
};
1958
1959
/// This represents 'release' clause in the '#pragma omp atomic|flush'
1960
/// directives.
1961
///
1962
/// \code
1963
/// #pragma omp flush release
1964
/// \endcode
1965
/// In this example directive '#pragma omp flush' has 'release' clause.
1966
class OMPReleaseClause final : public OMPClause {
1967
public:
1968
  /// Build 'release' clause.
1969
  ///
1970
  /// \param StartLoc Starting location of the clause.
1971
  /// \param EndLoc Ending location of the clause.
1972
  OMPReleaseClause(SourceLocation StartLoc, SourceLocation EndLoc)
1973
88
      : OMPClause(OMPC_release, StartLoc, EndLoc) {}
1974
1975
  /// Build an empty clause.
1976
  OMPReleaseClause()
1977
36
      : OMPClause(OMPC_release, SourceLocation(), SourceLocation()) {}
1978
1979
0
  child_range children() {
1980
0
    return child_range(child_iterator(), child_iterator());
1981
0
  }
1982
1983
0
  const_child_range children() const {
1984
0
    return const_child_range(const_child_iterator(), const_child_iterator());
1985
0
  }
1986
1987
68
  child_range used_children() {
1988
68
    return child_range(child_iterator(), child_iterator());
1989
68
  }
1990
0
  const_child_range used_children() const {
1991
0
    return const_child_range(const_child_iterator(), const_child_iterator());
1992
0
  }
1993
1994
416
  static bool classof(const OMPClause *T) {
1995
416
    return T->getClauseKind() == OMPC_release;
1996
416
  }
1997
};
1998
1999
/// This represents 'relaxed' clause in the '#pragma omp atomic'
2000
/// directives.
2001
///
2002
/// \code
2003
/// #pragma omp atomic relaxed
2004
/// \endcode
2005
/// In this example directive '#pragma omp atomic' has 'relaxed' clause.
2006
class OMPRelaxedClause final : public OMPClause {
2007
public:
2008
  /// Build 'relaxed' clause.
2009
  ///
2010
  /// \param StartLoc Starting location of the clause.
2011
  /// \param EndLoc Ending location of the clause.
2012
  OMPRelaxedClause(SourceLocation StartLoc, SourceLocation EndLoc)
2013
88
      : OMPClause(OMPC_relaxed, StartLoc, EndLoc) {}
2014
2015
  /// Build an empty clause.
2016
  OMPRelaxedClause()
2017
38
      : OMPClause(OMPC_relaxed, SourceLocation(), SourceLocation()) {}
2018
2019
0
  child_range children() {
2020
0
    return child_range(child_iterator(), child_iterator());
2021
0
  }
2022
2023
0
  const_child_range children() const {
2024
0
    return const_child_range(const_child_iterator(), const_child_iterator());
2025
0
  }
2026
2027
40
  child_range used_children() {
2028
40
    return child_range(child_iterator(), child_iterator());
2029
40
  }
2030
0
  const_child_range used_children() const {
2031
0
    return const_child_range(const_child_iterator(), const_child_iterator());
2032
0
  }
2033
2034
402
  static bool classof(const OMPClause *T) {
2035
402
    return T->getClauseKind() == OMPC_relaxed;
2036
402
  }
2037
};
2038
2039
/// This represents clause 'private' in the '#pragma omp ...' directives.
2040
///
2041
/// \code
2042
/// #pragma omp parallel private(a,b)
2043
/// \endcode
2044
/// In this example directive '#pragma omp parallel' has clause 'private'
2045
/// with the variables 'a' and 'b'.
2046
class OMPPrivateClause final
2047
    : public OMPVarListClause<OMPPrivateClause>,
2048
      private llvm::TrailingObjects<OMPPrivateClause, Expr *> {
2049
  friend class OMPClauseReader;
2050
  friend OMPVarListClause;
2051
  friend TrailingObjects;
2052
2053
  /// Build clause with number of variables \a N.
2054
  ///
2055
  /// \param StartLoc Starting location of the clause.
2056
  /// \param LParenLoc Location of '('.
2057
  /// \param EndLoc Ending location of the clause.
2058
  /// \param N Number of the variables in the clause.
2059
  OMPPrivateClause(SourceLocation StartLoc, SourceLocation LParenLoc,
2060
                   SourceLocation EndLoc, unsigned N)
2061
      : OMPVarListClause<OMPPrivateClause>(OMPC_private, StartLoc, LParenLoc,
2062
10.4k
                                           EndLoc, N) {}
2063
2064
  /// Build an empty clause.
2065
  ///
2066
  /// \param N Number of variables.
2067
  explicit OMPPrivateClause(unsigned N)
2068
      : OMPVarListClause<OMPPrivateClause>(OMPC_private, SourceLocation(),
2069
                                           SourceLocation(), SourceLocation(),
2070
1.32k
                                           N) {}
2071
2072
  /// Sets the list of references to private copies with initializers for
2073
  /// new private variables.
2074
  /// \param VL List of references.
2075
  void setPrivateCopies(ArrayRef<Expr *> VL);
2076
2077
  /// Gets the list of references to private copies with initializers for
2078
  /// new private variables.
2079
16.0k
  MutableArrayRef<Expr *> getPrivateCopies() {
2080
16.0k
    return MutableArrayRef<Expr *>(varlist_end(), varlist_size());
2081
16.0k
  }
2082
3.46k
  ArrayRef<const Expr *> getPrivateCopies() const {
2083
3.46k
    return llvm::makeArrayRef(varlist_end(), varlist_size());
2084
3.46k
  }
2085
2086
public:
2087
  /// Creates clause with a list of variables \a VL.
2088
  ///
2089
  /// \param C AST context.
2090
  /// \param StartLoc Starting location of the clause.
2091
  /// \param LParenLoc Location of '('.
2092
  /// \param EndLoc Ending location of the clause.
2093
  /// \param VL List of references to the variables.
2094
  /// \param PrivateVL List of references to private copies with initializers.
2095
  static OMPPrivateClause *Create(const ASTContext &C, SourceLocation StartLoc,
2096
                                  SourceLocation LParenLoc,
2097
                                  SourceLocation EndLoc, ArrayRef<Expr *> VL,
2098
                                  ArrayRef<Expr *> PrivateVL);
2099
2100
  /// Creates an empty clause with the place for \a N variables.
2101
  ///
2102
  /// \param C AST context.
2103
  /// \param N The number of variables.
2104
  static OMPPrivateClause *CreateEmpty(const ASTContext &C, unsigned N);
2105
2106
  using private_copies_iterator = MutableArrayRef<Expr *>::iterator;
2107
  using private_copies_const_iterator = ArrayRef<const Expr *>::iterator;
2108
  using private_copies_range = llvm::iterator_range<private_copies_iterator>;
2109
  using private_copies_const_range =
2110
      llvm::iterator_range<private_copies_const_iterator>;
2111
2112
8.01k
  private_copies_range private_copies() {
2113
8.01k
    return private_copies_range(getPrivateCopies().begin(),
2114
8.01k
                                getPrivateCopies().end());
2115
8.01k
  }
2116
2117
1.73k
  private_copies_const_range private_copies() const {
2118
1.73k
    return private_copies_const_range(getPrivateCopies().begin(),
2119
1.73k
                                      getPrivateCopies().end());
2120
1.73k
  }
2121
2122
13.0k
  child_range children() {
2123
13.0k
    return child_range(reinterpret_cast<Stmt **>(varlist_begin()),
2124
13.0k
                       reinterpret_cast<Stmt **>(varlist_end()));
2125
13.0k
  }
2126
2127
0
  const_child_range children() const {
2128
0
    auto Children = const_cast<OMPPrivateClause *>(this)->children();
2129
0
    return const_child_range(Children.begin(), Children.end());
2130
0
  }
2131
2132
2.44k
  child_range used_children() {
2133
2.44k
    return child_range(child_iterator(), child_iterator());
2134
2.44k
  }
2135
0
  const_child_range used_children() const {
2136
0
    return const_child_range(const_child_iterator(), const_child_iterator());
2137
0
  }
2138
2139
64.1k
  static bool classof(const OMPClause *T) {
2140
64.1k
    return T->getClauseKind() == OMPC_private;
2141
64.1k
  }
2142
};
2143
2144
/// This represents clause 'firstprivate' in the '#pragma omp ...'
2145
/// directives.
2146
///
2147
/// \code
2148
/// #pragma omp parallel firstprivate(a,b)
2149
/// \endcode
2150
/// In this example directive '#pragma omp parallel' has clause 'firstprivate'
2151
/// with the variables 'a' and 'b'.
2152
class OMPFirstprivateClause final
2153
    : public OMPVarListClause<OMPFirstprivateClause>,
2154
      public OMPClauseWithPreInit,
2155
      private llvm::TrailingObjects<OMPFirstprivateClause, Expr *> {
2156
  friend class OMPClauseReader;
2157
  friend OMPVarListClause;
2158
  friend TrailingObjects;
2159
2160
  /// Build clause with number of variables \a N.
2161
  ///
2162
  /// \param StartLoc Starting location of the clause.
2163
  /// \param LParenLoc Location of '('.
2164
  /// \param EndLoc Ending location of the clause.
2165
  /// \param N Number of the variables in the clause.
2166
  OMPFirstprivateClause(SourceLocation StartLoc, SourceLocation LParenLoc,
2167
                        SourceLocation EndLoc, unsigned N)
2168
      : OMPVarListClause<OMPFirstprivateClause>(OMPC_firstprivate, StartLoc,
2169
                                                LParenLoc, EndLoc, N),
2170
39.5k
        OMPClauseWithPreInit(this) {}
2171
2172
  /// Build an empty clause.
2173
  ///
2174
  /// \param N Number of variables.
2175
  explicit OMPFirstprivateClause(unsigned N)
2176
      : OMPVarListClause<OMPFirstprivateClause>(
2177
            OMPC_firstprivate, SourceLocation(), SourceLocation(),
2178
            SourceLocation(), N),
2179
3.25k
        OMPClauseWithPreInit(this) {}
2180
2181
  /// Sets the list of references to private copies with initializers for
2182
  /// new private variables.
2183
  /// \param VL List of references.
2184
  void setPrivateCopies(ArrayRef<Expr *> VL);
2185
2186
  /// Gets the list of references to private copies with initializers for
2187
  /// new private variables.
2188
130k
  MutableArrayRef<Expr *> getPrivateCopies() {
2189
130k
    return MutableArrayRef<Expr *>(varlist_end(), varlist_size());
2190
130k
  }
2191
31.7k
  ArrayRef<const Expr *> getPrivateCopies() const {
2192
31.7k
    return llvm::makeArrayRef(varlist_end(), varlist_size());
2193
31.7k
  }
2194
2195
  /// Sets the list of references to initializer variables for new
2196
  /// private variables.
2197
  /// \param VL List of references.
2198
  void setInits(ArrayRef<Expr *> VL);
2199
2200
  /// Gets the list of references to initializer variables for new
2201
  /// private variables.
2202
6.79k
  MutableArrayRef<Expr *> getInits() {
2203
6.79k
    return MutableArrayRef<Expr *>(getPrivateCopies().end(), varlist_size());
2204
6.79k
  }
2205
15.8k
  ArrayRef<const Expr *> getInits() const {
2206
15.8k
    return llvm::makeArrayRef(getPrivateCopies().end(), varlist_size());
2207
15.8k
  }
2208
2209
public:
2210
  /// Creates clause with a list of variables \a VL.
2211
  ///
2212
  /// \param C AST context.
2213
  /// \param StartLoc Starting location of the clause.
2214
  /// \param LParenLoc Location of '('.
2215
  /// \param EndLoc Ending location of the clause.
2216
  /// \param VL List of references to the original variables.
2217
  /// \param PrivateVL List of references to private copies with initializers.
2218
  /// \param InitVL List of references to auto generated variables used for
2219
  /// initialization of a single array element. Used if firstprivate variable is
2220
  /// of array type.
2221
  /// \param PreInit Statement that must be executed before entering the OpenMP
2222
  /// region with this clause.
2223
  static OMPFirstprivateClause *
2224
  Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
2225
         SourceLocation EndLoc, ArrayRef<Expr *> VL, ArrayRef<Expr *> PrivateVL,
2226
         ArrayRef<Expr *> InitVL, Stmt *PreInit);
2227
2228
  /// Creates an empty clause with the place for \a N variables.
2229
  ///
2230
  /// \param C AST context.
2231
  /// \param N The number of variables.
2232
  static OMPFirstprivateClause *CreateEmpty(const ASTContext &C, unsigned N);
2233
2234
  using private_copies_iterator = MutableArrayRef<Expr *>::iterator;
2235
  using private_copies_const_iterator = ArrayRef<const Expr *>::iterator;
2236
  using private_copies_range = llvm::iterator_range<private_copies_iterator>;
2237
  using private_copies_const_range =
2238
      llvm::iterator_range<private_copies_const_iterator>;
2239
2240
40.6k
  private_copies_range private_copies() {
2241
40.6k
    return private_copies_range(getPrivateCopies().begin(),
2242
40.6k
                                getPrivateCopies().end());
2243
40.6k
  }
2244
7.92k
  private_copies_const_range private_copies() const {
2245
7.92k
    return private_copies_const_range(getPrivateCopies().begin(),
2246
7.92k
                                      getPrivateCopies().end());
2247
7.92k
  }
2248
2249
  using inits_iterator = MutableArrayRef<Expr *>::iterator;
2250
  using inits_const_iterator = ArrayRef<const Expr *>::iterator;
2251
  using inits_range = llvm::iterator_range<inits_iterator>;
2252
  using inits_const_range = llvm::iterator_range<inits_const_iterator>;
2253
2254
3.39k
  inits_range inits() {
2255
3.39k
    return inits_range(getInits().begin(), getInits().end());
2256
3.39k
  }
2257
7.92k
  inits_const_range inits() const {
2258
7.92k
    return inits_const_range(getInits().begin(), getInits().end());
2259
7.92k
  }
2260
2261
7.78k
  child_range children() {
2262
7.78k
    return child_range(reinterpret_cast<Stmt **>(varlist_begin()),
2263
7.78k
                       reinterpret_cast<Stmt **>(varlist_end()));
2264
7.78k
  }
2265
2266
0
  const_child_range children() const {
2267
0
    auto Children = const_cast<OMPFirstprivateClause *>(this)->children();
2268
0
    return const_child_range(Children.begin(), Children.end());
2269
0
  }
2270
2271
19.0k
  child_range used_children() {
2272
19.0k
    return child_range(reinterpret_cast<Stmt **>(varlist_begin()),
2273
19.0k
                       reinterpret_cast<Stmt **>(varlist_end()));
2274
19.0k
  }
2275
0
  const_child_range used_children() const {
2276
0
    auto Children = const_cast<OMPFirstprivateClause *>(this)->used_children();
2277
0
    return const_child_range(Children.begin(), Children.end());
2278
0
  }
2279
2280
135k
  static bool classof(const OMPClause *T) {
2281
135k
    return T->getClauseKind() == OMPC_firstprivate;
2282
135k
  }
2283
};
2284
2285
/// This represents clause 'lastprivate' in the '#pragma omp ...'
2286
/// directives.
2287
///
2288
/// \code
2289
/// #pragma omp simd lastprivate(a,b)
2290
/// \endcode
2291
/// In this example directive '#pragma omp simd' has clause 'lastprivate'
2292
/// with the variables 'a' and 'b'.
2293
class OMPLastprivateClause final
2294
    : public OMPVarListClause<OMPLastprivateClause>,
2295
      public OMPClauseWithPostUpdate,
2296
      private llvm::TrailingObjects<OMPLastprivateClause, Expr *> {
2297
  // There are 4 additional tail-allocated arrays at the end of the class:
2298
  // 1. Contains list of pseudo variables with the default initialization for
2299
  // each non-firstprivate variables. Used in codegen for initialization of
2300
  // lastprivate copies.
2301
  // 2. List of helper expressions for proper generation of assignment operation
2302
  // required for lastprivate clause. This list represents private variables
2303
  // (for arrays, single array element).
2304
  // 3. List of helper expressions for proper generation of assignment operation
2305
  // required for lastprivate clause. This list represents original variables
2306
  // (for arrays, single array element).
2307
  // 4. List of helper expressions that represents assignment operation:
2308
  // \code
2309
  // DstExprs = SrcExprs;
2310
  // \endcode
2311
  // Required for proper codegen of final assignment performed by the
2312
  // lastprivate clause.
2313
  friend class OMPClauseReader;
2314
  friend OMPVarListClause;
2315
  friend TrailingObjects;
2316
2317
  /// Optional lastprivate kind, e.g. 'conditional', if specified by user.
2318
  OpenMPLastprivateModifier LPKind;
2319
  /// Optional location of the lasptrivate kind, if specified by user.
2320
  SourceLocation LPKindLoc;
2321
  /// Optional colon location, if specified by user.
2322
  SourceLocation ColonLoc;
2323
2324
  /// Build clause with number of variables \a N.
2325
  ///
2326
  /// \param StartLoc Starting location of the clause.
2327
  /// \param LParenLoc Location of '('.
2328
  /// \param EndLoc Ending location of the clause.
2329
  /// \param N Number of the variables in the clause.
2330
  OMPLastprivateClause(SourceLocation StartLoc, SourceLocation LParenLoc,
2331
                       SourceLocation EndLoc, OpenMPLastprivateModifier LPKind,
2332
                       SourceLocation LPKindLoc, SourceLocation ColonLoc,
2333
                       unsigned N)
2334
      : OMPVarListClause<OMPLastprivateClause>(OMPC_lastprivate, StartLoc,
2335
                                               LParenLoc, EndLoc, N),
2336
        OMPClauseWithPostUpdate(this), LPKind(LPKind), LPKindLoc(LPKindLoc),
2337
5.81k
        ColonLoc(ColonLoc) {}
2338
2339
  /// Build an empty clause.
2340
  ///
2341
  /// \param N Number of variables.
2342
  explicit OMPLastprivateClause(unsigned N)
2343
      : OMPVarListClause<OMPLastprivateClause>(
2344
            OMPC_lastprivate, SourceLocation(), SourceLocation(),
2345
            SourceLocation(), N),
2346
394
        OMPClauseWithPostUpdate(this) {}
2347
2348
  /// Get the list of helper expressions for initialization of private
2349
  /// copies for lastprivate variables.
2350
30.8k
  MutableArrayRef<Expr *> getPrivateCopies() {
2351
30.8k
    return MutableArrayRef<Expr *>(varlist_end(), varlist_size());
2352
30.8k
  }
2353
6.62k
  ArrayRef<const Expr *> getPrivateCopies() const {
2354
6.62k
    return llvm::makeArrayRef(varlist_end(), varlist_size());
2355
6.62k
  }
2356
2357
  /// Set list of helper expressions, required for proper codegen of the
2358
  /// clause. These expressions represent private variables (for arrays, single
2359
  /// array element) in the final assignment statement performed by the
2360
  /// lastprivate clause.
2361
  void setSourceExprs(ArrayRef<Expr *> SrcExprs);
2362
2363
  /// Get the list of helper source expressions.
2364
15.0k
  MutableArrayRef<Expr *> getSourceExprs() {
2365
15.0k
    return MutableArrayRef<Expr *>(getPrivateCopies().end(), varlist_size());
2366
15.0k
  }
2367
5.55k
  ArrayRef<const Expr *> getSourceExprs() const {
2368
5.55k
    return llvm::makeArrayRef(getPrivateCopies().end(), varlist_size());
2369
5.55k
  }
2370
2371
  /// Set list of helper expressions, required for proper codegen of the
2372
  /// clause. These expressions represent original variables (for arrays, single
2373
  /// array element) in the final assignment statement performed by the
2374
  /// lastprivate clause.
2375
  void setDestinationExprs(ArrayRef<Expr *> DstExprs);
2376
2377
  /// Get the list of helper destination expressions.
2378
7.97k
  MutableArrayRef<Expr *> getDestinationExprs() {
2379
7.97k
    return MutableArrayRef<Expr *>(getSourceExprs().end(), varlist_size());
2380
7.97k
  }
2381
4.06k
  ArrayRef<const Expr *> getDestinationExprs() const {
2382
4.06k
    return llvm::makeArrayRef(getSourceExprs().end(), varlist_size());
2383
4.06k
  }
2384
2385
  /// Set list of helper assignment expressions, required for proper
2386
  /// codegen of the clause. These expressions are assignment expressions that
2387
  /// assign private copy of the variable to original variable.
2388
  void setAssignmentOps(ArrayRef<Expr *> AssignmentOps);
2389
2390
  /// Get the list of helper assignment expressions.
2391
884
  MutableArrayRef<Expr *> getAssignmentOps() {
2392
884
    return MutableArrayRef<Expr *>(getDestinationExprs().end(), varlist_size());
2393
884
  }
2394
1.49k
  ArrayRef<const Expr *> getAssignmentOps() const {
2395
1.49k
    return llvm::makeArrayRef(getDestinationExprs().end(), varlist_size());
2396
1.49k
  }
2397
2398
  /// Sets lastprivate kind.
2399
394
  void setKind(OpenMPLastprivateModifier Kind) { LPKind = Kind; }
2400
  /// Sets location of the lastprivate kind.
2401
394
  void setKindLoc(SourceLocation Loc) { LPKindLoc = Loc; }
2402
  /// Sets colon symbol location.
2403
394
  void setColonLoc(SourceLocation Loc) { ColonLoc = Loc; }
2404
2405
public:
2406
  /// Creates clause with a list of variables \a VL.
2407
  ///
2408
  /// \param C AST context.
2409
  /// \param StartLoc Starting location of the clause.
2410
  /// \param LParenLoc Location of '('.
2411
  /// \param EndLoc Ending location of the clause.
2412
  /// \param VL List of references to the variables.
2413
  /// \param SrcExprs List of helper expressions for proper generation of
2414
  /// assignment operation required for lastprivate clause. This list represents
2415
  /// private variables (for arrays, single array element).
2416
  /// \param DstExprs List of helper expressions for proper generation of
2417
  /// assignment operation required for lastprivate clause. This list represents
2418
  /// original variables (for arrays, single array element).
2419
  /// \param AssignmentOps List of helper expressions that represents assignment
2420
  /// operation:
2421
  /// \code
2422
  /// DstExprs = SrcExprs;
2423
  /// \endcode
2424
  /// Required for proper codegen of final assignment performed by the
2425
  /// lastprivate clause.
2426
  /// \param LPKind Lastprivate kind, e.g. 'conditional'.
2427
  /// \param LPKindLoc Location of the lastprivate kind.
2428
  /// \param ColonLoc Location of the ':' symbol if lastprivate kind is used.
2429
  /// \param PreInit Statement that must be executed before entering the OpenMP
2430
  /// region with this clause.
2431
  /// \param PostUpdate Expression that must be executed after exit from the
2432
  /// OpenMP region with this clause.
2433
  static OMPLastprivateClause *
2434
  Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
2435
         SourceLocation EndLoc, ArrayRef<Expr *> VL, ArrayRef<Expr *> SrcExprs,
2436
         ArrayRef<Expr *> DstExprs, ArrayRef<Expr *> AssignmentOps,
2437
         OpenMPLastprivateModifier LPKind, SourceLocation LPKindLoc,
2438
         SourceLocation ColonLoc, Stmt *PreInit, Expr *PostUpdate);
2439
2440
  /// Creates an empty clause with the place for \a N variables.
2441
  ///
2442
  /// \param C AST context.
2443
  /// \param N The number of variables.
2444
  static OMPLastprivateClause *CreateEmpty(const ASTContext &C, unsigned N);
2445
2446
  /// Lastprivate kind.
2447
7.51k
  OpenMPLastprivateModifier getKind() const { return LPKind; }
2448
  /// Returns the location of the lastprivate kind.
2449
1.78k
  SourceLocation getKindLoc() const { return LPKindLoc; }
2450
  /// Returns the location of the ':' symbol, if any.
2451
1.78k
  SourceLocation getColonLoc() const { return ColonLoc; }
2452
2453
  using helper_expr_iterator = MutableArrayRef<Expr *>::iterator;
2454
  using helper_expr_const_iterator = ArrayRef<const Expr *>::iterator;
2455
  using helper_expr_range = llvm::iterator_range<helper_expr_iterator>;
2456
  using helper_expr_const_range =
2457
      llvm::iterator_range<helper_expr_const_iterator>;
2458
2459
  /// Set list of helper expressions, required for generation of private
2460
  /// copies of original lastprivate variables.
2461
  void setPrivateCopies(ArrayRef<Expr *> PrivateCopies);
2462
2463
534
  helper_expr_const_range private_copies() const {
2464
534
    return helper_expr_const_range(getPrivateCopies().begin(),
2465
534
                                   getPrivateCopies().end());
2466
534
  }
2467
2468
4.81k
  helper_expr_range private_copies() {
2469
4.81k
    return helper_expr_range(getPrivateCopies().begin(),
2470
4.81k
                             getPrivateCopies().end());
2471
4.81k
  }
2472
2473
748
  helper_expr_const_range source_exprs() const {
2474
748
    return helper_expr_const_range(getSourceExprs().begin(),
2475
748
                                   getSourceExprs().end());
2476
748
  }
2477
2478
442
  helper_expr_range source_exprs() {
2479
442
    return helper_expr_range(getSourceExprs().begin(), getSourceExprs().end());
2480
442
  }
2481
2482
1.28k
  helper_expr_const_range destination_exprs() const {
2483
1.28k
    return helper_expr_const_range(getDestinationExprs().begin(),
2484
1.28k
                                   getDestinationExprs().end());
2485
1.28k
  }
2486
2487
442
  helper_expr_range destination_exprs() {
2488
442
    return helper_expr_range(getDestinationExprs().begin(),
2489
442
                             getDestinationExprs().end());
2490
442
  }
2491
2492
748
  helper_expr_const_range assignment_ops() const {
2493
748
    return helper_expr_const_range(getAssignmentOps().begin(),
2494
748
                                   getAssignmentOps().end());
2495
748
  }
2496
2497
442
  helper_expr_range assignment_ops() {
2498
442
    return helper_expr_range(getAssignmentOps().begin(),
2499
442
                             getAssignmentOps().end());
2500
442
  }
2501
2502
8.34k
  child_range children() {
2503
8.34k
    return child_range(reinterpret_cast<Stmt **>(varlist_begin()),
2504
8.34k
                       reinterpret_cast<Stmt **>(varlist_end()));
2505
8.34k
  }
2506
2507
0
  const_child_range children() const {
2508
0
    auto Children = const_cast<OMPLastprivateClause *>(this)->children();
2509
0
    return const_child_range(Children.begin(), Children.end());
2510
0
  }
2511
2512
1.38k
  child_range used_children() {
2513
1.38k
    return child_range(child_iterator(), child_iterator());
2514
1.38k
  }
2515
0
  const_child_range used_children() const {
2516
0
    return const_child_range(const_child_iterator(), const_child_iterator());
2517
0
  }
2518
2519
192k
  static bool classof(const OMPClause *T) {
2520
192k
    return T->getClauseKind() == OMPC_lastprivate;
2521
192k
  }
2522
};
2523
2524
/// This represents clause 'shared' in the '#pragma omp ...' directives.
2525
///
2526
/// \code
2527
/// #pragma omp parallel shared(a,b)
2528
/// \endcode
2529
/// In this example directive '#pragma omp parallel' has clause 'shared'
2530
/// with the variables 'a' and 'b'.
2531
class OMPSharedClause final
2532
    : public OMPVarListClause<OMPSharedClause>,
2533
      private llvm::TrailingObjects<OMPSharedClause, Expr *> {
2534
  friend OMPVarListClause;
2535
  friend TrailingObjects;
2536
2537
  /// Build clause with number of variables \a N.
2538
  ///
2539
  /// \param StartLoc Starting location of the clause.
2540
  /// \param LParenLoc Location of '('.
2541
  /// \param EndLoc Ending location of the clause.
2542
  /// \param N Number of the variables in the clause.
2543
  OMPSharedClause(SourceLocation StartLoc, SourceLocation LParenLoc,
2544
                  SourceLocation EndLoc, unsigned N)
2545
      : OMPVarListClause<OMPSharedClause>(OMPC_shared, StartLoc, LParenLoc,
2546
2.87k
                                          EndLoc, N) {}
2547
2548
  /// Build an empty clause.
2549
  ///
2550
  /// \param N Number of variables.
2551
  explicit OMPSharedClause(unsigned N)
2552
      : OMPVarListClause<OMPSharedClause>(OMPC_shared, SourceLocation(),
2553
                                          SourceLocation(), SourceLocation(),
2554
334
                                          N) {}
2555
2556
public:
2557
  /// Creates clause with a list of variables \a VL.
2558
  ///
2559
  /// \param C AST context.
2560
  /// \param StartLoc Starting location of the clause.
2561
  /// \param LParenLoc Location of '('.
2562
  /// \param EndLoc Ending location of the clause.
2563
  /// \param VL List of references to the variables.
2564
  static OMPSharedClause *Create(const ASTContext &C, SourceLocation StartLoc,
2565
                                 SourceLocation LParenLoc,
2566
                                 SourceLocation EndLoc, ArrayRef<Expr *> VL);
2567
2568
  /// Creates an empty clause with \a N variables.
2569
  ///
2570
  /// \param C AST context.
2571
  /// \param N The number of variables.
2572
  static OMPSharedClause *CreateEmpty(const ASTContext &C, unsigned N);
2573
2574
597
  child_range children() {
2575
597
    return child_range(reinterpret_cast<Stmt **>(varlist_begin()),
2576
597
                       reinterpret_cast<Stmt **>(varlist_end()));
2577
597
  }
2578
2579
0
  const_child_range children() const {
2580
0
    auto Children = const_cast<OMPSharedClause *>(this)->children();
2581
0
    return const_child_range(Children.begin(), Children.end());
2582
0
  }
2583
2584
1.21k
  child_range used_children() {
2585
1.21k
    return child_range(child_iterator(), child_iterator());
2586
1.21k
  }
2587
0
  const_child_range used_children() const {
2588
0
    return const_child_range(const_child_iterator(), const_child_iterator());
2589
0
  }
2590
2591
946
  static bool classof(const OMPClause *T) {
2592
946
    return T->getClauseKind() == OMPC_shared;
2593
946
  }
2594
};
2595
2596
/// This represents clause 'reduction' in the '#pragma omp ...'
2597
/// directives.
2598
///
2599
/// \code
2600
/// #pragma omp parallel reduction(+:a,b)
2601
/// \endcode
2602
/// In this example directive '#pragma omp parallel' has clause 'reduction'
2603
/// with operator '+' and the variables 'a' and 'b'.
2604
class OMPReductionClause final
2605
    : public OMPVarListClause<OMPReductionClause>,
2606
      public OMPClauseWithPostUpdate,
2607
      private llvm::TrailingObjects<OMPReductionClause, Expr *> {
2608
  friend class OMPClauseReader;
2609
  friend OMPVarListClause;
2610
  friend TrailingObjects;
2611
2612
  /// Location of ':'.
2613
  SourceLocation ColonLoc;
2614
2615
  /// Nested name specifier for C++.
2616
  NestedNameSpecifierLoc QualifierLoc;
2617
2618
  /// Name of custom operator.
2619
  DeclarationNameInfo NameInfo;
2620
2621
  /// Build clause with number of variables \a N.
2622
  ///
2623
  /// \param StartLoc Starting location of the clause.
2624
  /// \param LParenLoc Location of '('.
2625
  /// \param EndLoc Ending location of the clause.
2626
  /// \param ColonLoc Location of ':'.
2627
  /// \param N Number of the variables in the clause.
2628
  /// \param QualifierLoc The nested-name qualifier with location information
2629
  /// \param NameInfo The full name info for reduction identifier.
2630
  OMPReductionClause(SourceLocation StartLoc, SourceLocation LParenLoc,
2631
                     SourceLocation ColonLoc, SourceLocation EndLoc, unsigned N,
2632
                     NestedNameSpecifierLoc QualifierLoc,
2633
                     const DeclarationNameInfo &NameInfo)
2634
      : OMPVarListClause<OMPReductionClause>(OMPC_reduction, StartLoc,
2635
                                             LParenLoc, EndLoc, N),
2636
        OMPClauseWithPostUpdate(this), ColonLoc(ColonLoc),
2637
13.5k
        QualifierLoc(QualifierLoc), NameInfo(NameInfo) {}
2638
2639
  /// Build an empty clause.
2640
  ///
2641
  /// \param N Number of variables.
2642
  explicit OMPReductionClause(unsigned N)
2643
      : OMPVarListClause<OMPReductionClause>(OMPC_reduction, SourceLocation(),
2644
                                             SourceLocation(), SourceLocation(),
2645
                                             N),
2646
795
        OMPClauseWithPostUpdate(this) {}
2647
2648
  /// Sets location of ':' symbol in clause.
2649
795
  void setColonLoc(SourceLocation CL) { ColonLoc = CL; }
2650
2651
  /// Sets the name info for specified reduction identifier.
2652
795
  void setNameInfo(DeclarationNameInfo DNI) { NameInfo = DNI; }
2653
2654
  /// Sets the nested name specifier.
2655
795
  void setQualifierLoc(NestedNameSpecifierLoc NSL) { QualifierLoc = NSL; }
2656
2657
  /// Set list of helper expressions, required for proper codegen of the
2658
  /// clause. These expressions represent private copy of the reduction
2659
  /// variable.
2660
  void setPrivates(ArrayRef<Expr *> Privates);
2661
2662
  /// Get the list of helper privates.
2663
83.0k
  MutableArrayRef<Expr *> getPrivates() {
2664
83.0k
    return MutableArrayRef<Expr *>(varlist_end(), varlist_size());
2665
83.0k
  }
2666
17.3k
  ArrayRef<const Expr *> getPrivates() const {
2667
17.3k
    return llvm::makeArrayRef(varlist_end(), varlist_size());
2668
17.3k
  }
2669
2670
  /// Set list of helper expressions, required for proper codegen of the
2671
  /// clause. These expressions represent LHS expression in the final
2672
  /// reduction expression performed by the reduction clause.
2673
  void setLHSExprs(ArrayRef<Expr *> LHSExprs);
2674
2675
  /// Get the list of helper LHS expressions.
2676
52.1k
  MutableArrayRef<Expr *> getLHSExprs() {
2677
52.1k
    return MutableArrayRef<Expr *>(getPrivates().end(), varlist_size());
2678
52.1k
  }
2679
13.0k
  ArrayRef<const Expr *> getLHSExprs() const {
2680
13.0k
    return llvm::makeArrayRef(getPrivates().end(), varlist_size());
2681
13.0k
  }
2682
2683
  /// Set list of helper expressions, required for proper codegen of the
2684
  /// clause. These expressions represent RHS expression in the final
2685
  /// reduction expression performed by the reduction clause.
2686
  /// Also, variables in these expressions are used for proper initialization of
2687
  /// reduction copies.
2688
  void setRHSExprs(ArrayRef<Expr *> RHSExprs);
2689
2690
  /// Get the list of helper destination expressions.
2691
36.1k
  MutableArrayRef<Expr *> getRHSExprs() {
2692
36.1k
    return MutableArrayRef<Expr *>(getLHSExprs().end(), varlist_size());
2693
36.1k
  }
2694
8.68k
  ArrayRef<const Expr *> getRHSExprs() const {
2695
8.68k
    return llvm::makeArrayRef(getLHSExprs().end(), varlist_size());
2696
8.68k
  }
2697
2698
  /// Set list of helper reduction expressions, required for proper
2699
  /// codegen of the clause. These expressions are binary expressions or
2700
  /// operator/custom reduction call that calculates new value from source
2701
  /// helper expressions to destination helper expressions.
2702
  void setReductionOps(ArrayRef<Expr *> ReductionOps);
2703
2704
  /// Get the list of helper reduction expressions.
2705
20.1k
  MutableArrayRef<Expr *> getReductionOps() {
2706
20.1k
    return MutableArrayRef<Expr *>(getRHSExprs().end(), varlist_size());
2707
20.1k
  }
2708
4.34k
  ArrayRef<const Expr *> getReductionOps() const {
2709
4.34k
    return llvm::makeArrayRef(getRHSExprs().end(), varlist_size());
2710
4.34k
  }
2711
2712
public:
2713
  /// Creates clause with a list of variables \a VL.
2714
  ///
2715
  /// \param StartLoc Starting location of the clause.
2716
  /// \param LParenLoc Location of '('.
2717
  /// \param ColonLoc Location of ':'.
2718
  /// \param EndLoc Ending location of the clause.
2719
  /// \param VL The variables in the clause.
2720
  /// \param QualifierLoc The nested-name qualifier with location information
2721
  /// \param NameInfo The full name info for reduction identifier.
2722
  /// \param Privates List of helper expressions for proper generation of
2723
  /// private copies.
2724
  /// \param LHSExprs List of helper expressions for proper generation of
2725
  /// assignment operation required for copyprivate clause. This list represents
2726
  /// LHSs of the reduction expressions.
2727
  /// \param RHSExprs List of helper expressions for proper generation of
2728
  /// assignment operation required for copyprivate clause. This list represents
2729
  /// RHSs of the reduction expressions.
2730
  /// Also, variables in these expressions are used for proper initialization of
2731
  /// reduction copies.
2732
  /// \param ReductionOps List of helper expressions that represents reduction
2733
  /// expressions:
2734
  /// \code
2735
  /// LHSExprs binop RHSExprs;
2736
  /// operator binop(LHSExpr, RHSExpr);
2737
  /// <CutomReduction>(LHSExpr, RHSExpr);
2738
  /// \endcode
2739
  /// Required for proper codegen of final reduction operation performed by the
2740
  /// reduction clause.
2741
  /// \param PreInit Statement that must be executed before entering the OpenMP
2742
  /// region with this clause.
2743
  /// \param PostUpdate Expression that must be executed after exit from the
2744
  /// OpenMP region with this clause.
2745
  static OMPReductionClause *
2746
  Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
2747
         SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef<Expr *> VL,
2748
         NestedNameSpecifierLoc QualifierLoc,
2749
         const DeclarationNameInfo &NameInfo, ArrayRef<Expr *> Privates,
2750
         ArrayRef<Expr *> LHSExprs, ArrayRef<Expr *> RHSExprs,
2751
         ArrayRef<Expr *> ReductionOps, Stmt *PreInit, Expr *PostUpdate);
2752
2753
  /// Creates an empty clause with the place for \a N variables.
2754
  ///
2755
  /// \param C AST context.
2756
  /// \param N The number of variables.
2757
  static OMPReductionClause *CreateEmpty(const ASTContext &C, unsigned N);
2758
2759
  /// Gets location of ':' symbol in clause.
2760
10.0k
  SourceLocation getColonLoc() const { return ColonLoc; }
2761
2762
  /// Gets the name info for specified reduction identifier.
2763
12.3k
  const DeclarationNameInfo &getNameInfo() const { return NameInfo; }
2764
2765
  /// Gets the nested name specifier.
2766
11.9k
  NestedNameSpecifierLoc getQualifierLoc() const { return QualifierLoc; }
2767
2768
  using helper_expr_iterator = MutableArrayRef<Expr *>::iterator;
2769
  using helper_expr_const_iterator = ArrayRef<const Expr *>::iterator;
2770
  using helper_expr_range = llvm::iterator_range<helper_expr_iterator>;
2771
  using helper_expr_const_range =
2772
      llvm::iterator_range<helper_expr_const_iterator>;
2773
2774
2.18k
  helper_expr_const_range privates() const {
2775
2.18k
    return helper_expr_const_range(getPrivates().begin(), getPrivates().end());
2776
2.18k
  }
2777
2778
8.25k
  helper_expr_range privates() {
2779
8.25k
    return helper_expr_range(getPrivates().begin(), getPrivates().end());
2780
8.25k
  }
2781
2782
2.17k
  helper_expr_const_range lhs_exprs() const {
2783
2.17k
    return helper_expr_const_range(getLHSExprs().begin(), getLHSExprs().end());
2784
2.17k
  }
2785
2786
836
  helper_expr_range lhs_exprs() {
2787
836
    return helper_expr_range(getLHSExprs().begin(), getLHSExprs().end());
2788
836
  }
2789
2790
2.17k
  helper_expr_const_range rhs_exprs() const {
2791
2.17k
    return helper_expr_const_range(getRHSExprs().begin(), getRHSExprs().end());
2792
2.17k
  }
2793
2794
836
  helper_expr_range rhs_exprs() {
2795
836
    return helper_expr_range(getRHSExprs().begin(), getRHSExprs().end());
2796
836
  }
2797
2798
2.17k
  helper_expr_const_range reduction_ops() const {
2799
2.17k
    return helper_expr_const_range(getReductionOps().begin(),
2800
2.17k
                                   getReductionOps().end());
2801
2.17k
  }
2802
2803
10.0k
  helper_expr_range reduction_ops() {
2804
10.0k
    return helper_expr_range(getReductionOps().begin(),
2805
10.0k
                             getReductionOps().end());
2806
10.0k
  }
2807
2808
16.3k
  child_range children() {
2809
16.3k
    return child_range(reinterpret_cast<Stmt **>(varlist_begin()),
2810
16.3k
                       reinterpret_cast<Stmt **>(varlist_end()));
2811
16.3k
  }
2812
2813
0
  const_child_range children() const {
2814
0
    auto Children = const_cast<OMPReductionClause *>(this)->children();
2815
0
    return const_child_range(Children.begin(), Children.end());
2816
0
  }
2817
2818
5.43k
  child_range used_children() {
2819
5.43k
    return child_range(reinterpret_cast<Stmt **>(varlist_begin()),
2820
5.43k
                       reinterpret_cast<Stmt **>(varlist_end()));
2821
5.43k
  }
2822
0
  const_child_range used_children() const {
2823
0
    auto Children = const_cast<OMPReductionClause *>(this)->used_children();
2824
0
    return const_child_range(Children.begin(), Children.end());
2825
0
  }
2826
2827
73.4k
  static bool classof(const OMPClause *T) {
2828
73.4k
    return T->getClauseKind() == OMPC_reduction;
2829
73.4k
  }
2830
};
2831
2832
/// This represents clause 'task_reduction' in the '#pragma omp taskgroup'
2833
/// directives.
2834
///
2835
/// \code
2836
/// #pragma omp taskgroup task_reduction(+:a,b)
2837
/// \endcode
2838
/// In this example directive '#pragma omp taskgroup' has clause
2839
/// 'task_reduction' with operator '+' and the variables 'a' and 'b'.
2840
class OMPTaskReductionClause final
2841
    : public OMPVarListClause<OMPTaskReductionClause>,
2842
      public OMPClauseWithPostUpdate,
2843
      private llvm::TrailingObjects<OMPTaskReductionClause, Expr *> {
2844
  friend class OMPClauseReader;
2845
  friend OMPVarListClause;
2846
  friend TrailingObjects;
2847
2848
  /// Location of ':'.
2849
  SourceLocation ColonLoc;
2850
2851
  /// Nested name specifier for C++.
2852
  NestedNameSpecifierLoc QualifierLoc;
2853
2854
  /// Name of custom operator.
2855
  DeclarationNameInfo NameInfo;
2856
2857
  /// Build clause with number of variables \a N.
2858
  ///
2859
  /// \param StartLoc Starting location of the clause.
2860
  /// \param LParenLoc Location of '('.
2861
  /// \param EndLoc Ending location of the clause.
2862
  /// \param ColonLoc Location of ':'.
2863
  /// \param N Number of the variables in the clause.
2864
  /// \param QualifierLoc The nested-name qualifier with location information
2865
  /// \param NameInfo The full name info for reduction identifier.
2866
  OMPTaskReductionClause(SourceLocation StartLoc, SourceLocation LParenLoc,
2867
                         SourceLocation ColonLoc, SourceLocation EndLoc,
2868
                         unsigned N, NestedNameSpecifierLoc QualifierLoc,
2869
                         const DeclarationNameInfo &NameInfo)
2870
      : OMPVarListClause<OMPTaskReductionClause>(OMPC_task_reduction, StartLoc,
2871
                                                 LParenLoc, EndLoc, N),
2872
        OMPClauseWithPostUpdate(this), ColonLoc(ColonLoc),
2873
2.26k
        QualifierLoc(QualifierLoc), NameInfo(NameInfo) {}
2874
2875
  /// Build an empty clause.
2876
  ///
2877
  /// \param N Number of variables.
2878
  explicit OMPTaskReductionClause(unsigned N)
2879
      : OMPVarListClause<OMPTaskReductionClause>(
2880
            OMPC_task_reduction, SourceLocation(), SourceLocation(),
2881
            SourceLocation(), N),
2882
86
        OMPClauseWithPostUpdate(this) {}
2883
2884
  /// Sets location of ':' symbol in clause.
2885
86
  void setColonLoc(SourceLocation CL) { ColonLoc = CL; }
2886
2887
  /// Sets the name info for specified reduction identifier.
2888
86
  void setNameInfo(DeclarationNameInfo DNI) { NameInfo = DNI; }
2889
2890
  /// Sets the nested name specifier.
2891
86
  void setQualifierLoc(NestedNameSpecifierLoc NSL) { QualifierLoc = NSL; }
2892
2893
  /// Set list of helper expressions, required for proper codegen of the clause.
2894
  /// These expressions represent private copy of the reduction variable.
2895
  void setPrivates(ArrayRef<Expr *> Privates);
2896
2897
  /// Get the list of helper privates.
2898
13.1k
  MutableArrayRef<Expr *> getPrivates() {
2899
13.1k
    return MutableArrayRef<Expr *>(varlist_end(), varlist_size());
2900
13.1k
  }
2901
800
  ArrayRef<const Expr *> getPrivates() const {
2902
800
    return llvm::makeArrayRef(varlist_end(), varlist_size());
2903
800
  }
2904
2905
  /// Set list of helper expressions, required for proper codegen of the clause.
2906
  /// These expressions represent LHS expression in the final reduction
2907
  /// expression performed by the reduction clause.
2908
  void setLHSExprs(ArrayRef<Expr *> LHSExprs);
2909
2910
  /// Get the list of helper LHS expressions.
2911
7.69k
  MutableArrayRef<Expr *> getLHSExprs() {
2912
7.69k
    return MutableArrayRef<Expr *>(getPrivates().end(), varlist_size());
2913
7.69k
  }
2914
600
  ArrayRef<const Expr *> getLHSExprs() const {
2915
600
    return llvm::makeArrayRef(getPrivates().end(), varlist_size());
2916
600
  }
2917
2918
  /// Set list of helper expressions, required for proper codegen of the clause.
2919
  /// These expressions represent RHS expression in the final reduction
2920
  /// expression performed by the reduction clause. Also, variables in these
2921
  /// expressions are used for proper initialization of reduction copies.
2922
  void setRHSExprs(ArrayRef<Expr *> RHSExprs);
2923
2924
  ///  Get the list of helper destination expressions.
2925
5.17k
  MutableArrayRef<Expr *> getRHSExprs() {
2926
5.17k
    return MutableArrayRef<Expr *>(getLHSExprs().end(), varlist_size());
2927
5.17k
  }
2928
400
  ArrayRef<const Expr *> getRHSExprs() const {
2929
400
    return llvm::makeArrayRef(getLHSExprs().end(), varlist_size());
2930
400
  }
2931
2932
  /// Set list of helper reduction expressions, required for proper
2933
  /// codegen of the clause. These expressions are binary expressions or
2934
  /// operator/custom reduction call that calculates new value from source
2935
  /// helper expressions to destination helper expressions.
2936
  void setReductionOps(ArrayRef<Expr *> ReductionOps);
2937
2938
  ///  Get the list of helper reduction expressions.
2939
2.66k
  MutableArrayRef<Expr *> getReductionOps() {
2940
2.66k
    return MutableArrayRef<Expr *>(getRHSExprs().end(), varlist_size());
2941
2.66k
  }
2942
200
  ArrayRef<const Expr *> getReductionOps() const {
2943
200
    return llvm::makeArrayRef(getRHSExprs().end(), varlist_size());
2944
200
  }
2945
2946
public:
2947
  /// Creates clause with a list of variables \a VL.
2948
  ///
2949
  /// \param StartLoc Starting location of the clause.
2950
  /// \param LParenLoc Location of '('.
2951
  /// \param ColonLoc Location of ':'.
2952
  /// \param EndLoc Ending location of the clause.
2953
  /// \param VL The variables in the clause.
2954
  /// \param QualifierLoc The nested-name qualifier with location information
2955
  /// \param NameInfo The full name info for reduction identifier.
2956
  /// \param Privates List of helper expressions for proper generation of
2957
  /// private copies.
2958
  /// \param LHSExprs List of helper expressions for proper generation of
2959
  /// assignment operation required for copyprivate clause. This list represents
2960
  /// LHSs of the reduction expressions.
2961
  /// \param RHSExprs List of helper expressions for proper generation of
2962
  /// assignment operation required for copyprivate clause. This list represents
2963
  /// RHSs of the reduction expressions.
2964
  /// Also, variables in these expressions are used for proper initialization of
2965
  /// reduction copies.
2966
  /// \param ReductionOps List of helper expressions that represents reduction
2967
  /// expressions:
2968
  /// \code
2969
  /// LHSExprs binop RHSExprs;
2970
  /// operator binop(LHSExpr, RHSExpr);
2971
  /// <CutomReduction>(LHSExpr, RHSExpr);
2972
  /// \endcode
2973
  /// Required for proper codegen of final reduction operation performed by the
2974
  /// reduction clause.
2975
  /// \param PreInit Statement that must be executed before entering the OpenMP
2976
  /// region with this clause.
2977
  /// \param PostUpdate Expression that must be executed after exit from the
2978
  /// OpenMP region with this clause.
2979
  static OMPTaskReductionClause *
2980
  Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
2981
         SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef<Expr *> VL,
2982
         NestedNameSpecifierLoc QualifierLoc,
2983
         const DeclarationNameInfo &NameInfo, ArrayRef<Expr *> Privates,
2984
         ArrayRef<Expr *> LHSExprs, ArrayRef<Expr *> RHSExprs,
2985
         ArrayRef<Expr *> ReductionOps, Stmt *PreInit, Expr *PostUpdate);
2986
2987
  /// Creates an empty clause with the place for \a N variables.
2988
  ///
2989
  /// \param C AST context.
2990
  /// \param N The number of variables.
2991
  static OMPTaskReductionClause *CreateEmpty(const ASTContext &C, unsigned N);
2992
2993
  /// Gets location of ':' symbol in clause.
2994
1.33k
  SourceLocation getColonLoc() const { return ColonLoc; }
2995
2996
  /// Gets the name info for specified reduction identifier.
2997
1.63k
  const DeclarationNameInfo &getNameInfo() const { return NameInfo; }
2998
2999
  /// Gets the nested name specifier.
3000
1.62k
  NestedNameSpecifierLoc getQualifierLoc() const { return QualifierLoc; }
3001
3002
  using helper_expr_iterator = MutableArrayRef<Expr *>::iterator;
3003
  using helper_expr_const_iterator = ArrayRef<const Expr *>::iterator;
3004
  using helper_expr_range = llvm::iterator_range<helper_expr_iterator>;
3005
  using helper_expr_const_range =
3006
      llvm::iterator_range<helper_expr_const_iterator>;
3007
3008
100
  helper_expr_const_range privates() const {
3009
100
    return helper_expr_const_range(getPrivates().begin(), getPrivates().end());
3010
100
  }
3011
3012
1.54k
  helper_expr_range privates() {
3013
1.54k
    return helper_expr_range(getPrivates().begin(), getPrivates().end());
3014
1.54k
  }
3015
3016
100
  helper_expr_const_range lhs_exprs() const {
3017
100
    return helper_expr_const_range(getLHSExprs().begin(), getLHSExprs().end());
3018
100
  }
3019
3020
86
  helper_expr_range lhs_exprs() {
3021
86
    return helper_expr_range(getLHSExprs().begin(), getLHSExprs().end());
3022
86
  }
3023
3024
100
  helper_expr_const_range rhs_exprs() const {
3025
100
    return helper_expr_const_range(getRHSExprs().begin(), getRHSExprs().end());
3026
100
  }
3027
3028
86
  helper_expr_range rhs_exprs() {
3029
86
    return helper_expr_range(getRHSExprs().begin(), getRHSExprs().end());
3030
86
  }
3031
3032
100
  helper_expr_const_range reduction_ops() const {
3033
100
    return helper_expr_const_range(getReductionOps().begin(),
3034
100
                                   getReductionOps().end());
3035
100
  }
3036
3037
1.33k
  helper_expr_range reduction_ops() {
3038
1.33k
    return helper_expr_range(getReductionOps().begin(),
3039
1.33k
                             getReductionOps().end());
3040
1.33k
  }
3041
3042
2.26k
  child_range children() {
3043
2.26k
    return child_range(reinterpret_cast<Stmt **>(varlist_begin()),
3044
2.26k
                       reinterpret_cast<Stmt **>(varlist_end()));
3045
2.26k
  }
3046
3047
0
  const_child_range children() const {
3048
0
    auto Children = const_cast<OMPTaskReductionClause *>(this)->children();
3049
0
    return const_child_range(Children.begin(), Children.end());
3050
0
  }
3051
3052
300
  child_range used_children() {
3053
300
    return child_range(child_iterator(), child_iterator());
3054
300
  }
3055
0
  const_child_range used_children() const {
3056
0
    return const_child_range(const_child_iterator(), const_child_iterator());
3057
0
  }
3058
3059
2.75k
  static bool classof(const OMPClause *T) {
3060
2.75k
    return T->getClauseKind() == OMPC_task_reduction;
3061
2.75k
  }
3062
};
3063
3064
/// This represents clause 'in_reduction' in the '#pragma omp task' directives.
3065
///
3066
/// \code
3067
/// #pragma omp task in_reduction(+:a,b)
3068
/// \endcode
3069
/// In this example directive '#pragma omp task' has clause 'in_reduction' with
3070
/// operator '+' and the variables 'a' and 'b'.
3071
class OMPInReductionClause final
3072
    : public OMPVarListClause<OMPInReductionClause>,
3073
      public OMPClauseWithPostUpdate,
3074
      private llvm::TrailingObjects<OMPInReductionClause, Expr *> {
3075
  friend class OMPClauseReader;
3076
  friend OMPVarListClause;
3077
  friend TrailingObjects;
3078
3079
  /// Location of ':'.
3080
  SourceLocation ColonLoc;
3081
3082
  /// Nested name specifier for C++.
3083
  NestedNameSpecifierLoc QualifierLoc;
3084
3085
  /// Name of custom operator.
3086
  DeclarationNameInfo NameInfo;
3087
3088
  /// Build clause with number of variables \a N.
3089
  ///
3090
  /// \param StartLoc Starting location of the clause.
3091
  /// \param LParenLoc Location of '('.
3092
  /// \param EndLoc Ending location of the clause.
3093
  /// \param ColonLoc Location of ':'.
3094
  /// \param N Number of the variables in the clause.
3095
  /// \param QualifierLoc The nested-name qualifier with location information
3096
  /// \param NameInfo The full name info for reduction identifier.
3097
  OMPInReductionClause(SourceLocation StartLoc, SourceLocation LParenLoc,
3098
                       SourceLocation ColonLoc, SourceLocation EndLoc,
3099
                       unsigned N, NestedNameSpecifierLoc QualifierLoc,
3100
                       const DeclarationNameInfo &NameInfo)
3101
      : OMPVarListClause<OMPInReductionClause>(OMPC_in_reduction, StartLoc,
3102
                                               LParenLoc, EndLoc, N),
3103
        OMPClauseWithPostUpdate(this), ColonLoc(ColonLoc),
3104
1.41k
        QualifierLoc(QualifierLoc), NameInfo(NameInfo) {}
3105
3106
  /// Build an empty clause.
3107
  ///
3108
  /// \param N Number of variables.
3109
  explicit OMPInReductionClause(unsigned N)
3110
      : OMPVarListClause<OMPInReductionClause>(
3111
            OMPC_in_reduction, SourceLocation(), SourceLocation(),
3112
            SourceLocation(), N),
3113
52
        OMPClauseWithPostUpdate(this) {}
3114
3115
  /// Sets location of ':' symbol in clause.
3116
52
  void setColonLoc(SourceLocation CL) { ColonLoc = CL; }
3117
3118
  /// Sets the name info for specified reduction identifier.
3119
52
  void setNameInfo(DeclarationNameInfo DNI) { NameInfo = DNI; }
3120
3121
  /// Sets the nested name specifier.
3122
52
  void setQualifierLoc(NestedNameSpecifierLoc NSL) { QualifierLoc = NSL; }
3123
3124
  /// Set list of helper expressions, required for proper codegen of the clause.
3125
  /// These expressions represent private copy of the reduction variable.
3126
  void setPrivates(ArrayRef<Expr *> Privates);
3127
3128
  /// Get the list of helper privates.
3129
14.6k
  MutableArrayRef<Expr *> getPrivates() {
3130
14.6k
    return MutableArrayRef<Expr *>(varlist_end(), varlist_size());
3131
14.6k
  }
3132
120
  ArrayRef<const Expr *> getPrivates() const {
3133
120
    return llvm::makeArrayRef(varlist_end(), varlist_size());
3134
120
  }
3135
3136
  /// Set list of helper expressions, required for proper codegen of the clause.
3137
  /// These expressions represent LHS expression in the final reduction
3138
  /// expression performed by the reduction clause.
3139
  void setLHSExprs(ArrayRef<Expr *> LHSExprs);
3140
3141
  /// Get the list of helper LHS expressions.
3142
11.5k
  MutableArrayRef<Expr *> getLHSExprs() {
3143
11.5k
    return MutableArrayRef<Expr *>(getPrivates().end(), varlist_size());
3144
11.5k
  }
3145
80
  ArrayRef<const Expr *> getLHSExprs() const {
3146
80
    return llvm::makeArrayRef(getPrivates().end(), varlist_size());
3147
80
  }
3148
3149
  /// Set list of helper expressions, required for proper codegen of the clause.
3150
  /// These expressions represent RHS expression in the final reduction
3151
  /// expression performed by the reduction clause. Also, variables in these
3152
  /// expressions are used for proper initialization of reduction copies.
3153
  void setRHSExprs(ArrayRef<Expr *> RHSExprs);
3154
3155
  ///  Get the list of helper destination expressions.
3156
9.92k
  MutableArrayRef<Expr *> getRHSExprs() {
3157
9.92k
    return MutableArrayRef<Expr *>(getLHSExprs().end(), varlist_size());
3158
9.92k
  }
3159
80
  ArrayRef<const Expr *> getRHSExprs() const {
3160
80
    return llvm::makeArrayRef(getLHSExprs().end(), varlist_size());
3161
80
  }
3162
3163
  /// Set list of helper reduction expressions, required for proper
3164
  /// codegen of the clause. These expressions are binary expressions or
3165
  /// operator/custom reduction call that calculates new value from source
3166
  /// helper expressions to destination helper expressions.
3167
  void setReductionOps(ArrayRef<Expr *> ReductionOps);
3168
3169
  ///  Get the list of helper reduction expressions.
3170
8.35k
  MutableArrayRef<Expr *> getReductionOps() {
3171
8.35k
    return MutableArrayRef<Expr *>(getRHSExprs().end(), varlist_size());
3172
8.35k
  }
3173
80
  ArrayRef<const Expr *> getReductionOps() const {
3174
80
    return llvm::makeArrayRef(getRHSExprs().end(), varlist_size());
3175
80
  }
3176
3177
  /// Set list of helper reduction taskgroup descriptors.
3178
  void setTaskgroupDescriptors(ArrayRef<Expr *> ReductionOps);
3179
3180
  ///  Get the list of helper reduction taskgroup descriptors.
3181
4.52k
  MutableArrayRef<Expr *> getTaskgroupDescriptors() {
3182
4.52k
    return MutableArrayRef<Expr *>(getReductionOps().end(), varlist_size());
3183
4.52k
  }
3184
40
  ArrayRef<const Expr *> getTaskgroupDescriptors() const {
3185
40
    return llvm::makeArrayRef(getReductionOps().end(), varlist_size());
3186
40
  }
3187
3188
public:
3189
  /// Creates clause with a list of variables \a VL.
3190
  ///
3191
  /// \param StartLoc Starting location of the clause.
3192
  /// \param LParenLoc Location of '('.
3193
  /// \param ColonLoc Location of ':'.
3194
  /// \param EndLoc Ending location of the clause.
3195
  /// \param VL The variables in the clause.
3196
  /// \param QualifierLoc The nested-name qualifier with location information
3197
  /// \param NameInfo The full name info for reduction identifier.
3198
  /// \param Privates List of helper expressions for proper generation of
3199
  /// private copies.
3200
  /// \param LHSExprs List of helper expressions for proper generation of
3201
  /// assignment operation required for copyprivate clause. This list represents
3202
  /// LHSs of the reduction expressions.
3203
  /// \param RHSExprs List of helper expressions for proper generation of
3204
  /// assignment operation required for copyprivate clause. This list represents
3205
  /// RHSs of the reduction expressions.
3206
  /// Also, variables in these expressions are used for proper initialization of
3207
  /// reduction copies.
3208
  /// \param ReductionOps List of helper expressions that represents reduction
3209
  /// expressions:
3210
  /// \code
3211
  /// LHSExprs binop RHSExprs;
3212
  /// operator binop(LHSExpr, RHSExpr);
3213
  /// <CutomReduction>(LHSExpr, RHSExpr);
3214
  /// \endcode
3215
  /// Required for proper codegen of final reduction operation performed by the
3216
  /// reduction clause.
3217
  /// \param TaskgroupDescriptors List of helper taskgroup descriptors for
3218
  /// corresponding items in parent taskgroup task_reduction clause.
3219
  /// \param PreInit Statement that must be executed before entering the OpenMP
3220
  /// region with this clause.
3221
  /// \param PostUpdate Expression that must be executed after exit from the
3222
  /// OpenMP region with this clause.
3223
  static OMPInReductionClause *
3224
  Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
3225
         SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef<Expr *> VL,
3226
         NestedNameSpecifierLoc QualifierLoc,
3227
         const DeclarationNameInfo &NameInfo, ArrayRef<Expr *> Privates,
3228
         ArrayRef<Expr *> LHSExprs, ArrayRef<Expr *> RHSExprs,
3229
         ArrayRef<Expr *> ReductionOps, ArrayRef<Expr *> TaskgroupDescriptors,
3230
         Stmt *PreInit, Expr *PostUpdate);
3231
3232
  /// Creates an empty clause with the place for \a N variables.
3233
  ///
3234
  /// \param C AST context.
3235
  /// \param N The number of variables.
3236
  static OMPInReductionClause *CreateEmpty(const ASTContext &C, unsigned N);
3237
3238
  /// Gets location of ':' symbol in clause.
3239
1.18k
  SourceLocation getColonLoc() const { return ColonLoc; }
3240
3241
  /// Gets the name info for specified reduction identifier.
3242
1.31k
  const DeclarationNameInfo &getNameInfo() const { return NameInfo; }
3243
3244
  /// Gets the nested name specifier.
3245
1.30k
  NestedNameSpecifierLoc getQualifierLoc() const { return QualifierLoc; }
3246
3247
  using helper_expr_iterator = MutableArrayRef<Expr *>::iterator;
3248
  using helper_expr_const_iterator = ArrayRef<const Expr *>::iterator;
3249
  using helper_expr_range = llvm::iterator_range<helper_expr_iterator>;
3250
  using helper_expr_const_range =
3251
      llvm::iterator_range<helper_expr_const_iterator>;
3252
3253
20
  helper_expr_const_range privates() const {
3254
20
    return helper_expr_const_range(getPrivates().begin(), getPrivates().end());
3255
20
  }
3256
3257
844
  helper_expr_range privates() {
3258
844
    return helper_expr_range(getPrivates().begin(), getPrivates().end());
3259
844
  }
3260
3261
0
  helper_expr_const_range lhs_exprs() const {
3262
0
    return helper_expr_const_range(getLHSExprs().begin(), getLHSExprs().end());
3263
0
  }
3264
3265
52
  helper_expr_range lhs_exprs() {
3266
52
    return helper_expr_range(getLHSExprs().begin(), getLHSExprs().end());
3267
52
  }
3268
3269
0
  helper_expr_const_range rhs_exprs() const {
3270
0
    return helper_expr_const_range(getRHSExprs().begin(), getRHSExprs().end());
3271
0
  }
3272
3273
52
  helper_expr_range rhs_exprs() {
3274
52
    return helper_expr_range(getRHSExprs().begin(), getRHSExprs().end());
3275
52
  }
3276
3277
20
  helper_expr_const_range reduction_ops() const {
3278
20
    return helper_expr_const_range(getReductionOps().begin(),
3279
20
                                   getReductionOps().end());
3280
20
  }
3281
3282
1.18k
  helper_expr_range reduction_ops() {
3283
1.18k
    return helper_expr_range(getReductionOps().begin(),
3284
1.18k
                             getReductionOps().end());
3285
1.18k
  }
3286
3287
20
  helper_expr_const_range taskgroup_descriptors() const {
3288
20
    return helper_expr_const_range(getTaskgroupDescriptors().begin(),
3289
20
                                   getTaskgroupDescriptors().end());
3290
20
  }
3291
3292
2.26k
  helper_expr_range taskgroup_descriptors() {
3293
2.26k
    return helper_expr_range(getTaskgroupDescriptors().begin(),
3294
2.26k
                             getTaskgroupDescriptors().end());
3295
2.26k
  }
3296
3297
2.16k
  child_range children() {
3298
2.16k
    return child_range(reinterpret_cast<Stmt **>(varlist_begin()),
3299
2.16k
                       reinterpret_cast<Stmt **>(varlist_end()));
3300
2.16k
  }
3301
3302
0
  const_child_range children() const {
3303
0
    auto Children = const_cast<OMPInReductionClause *>(this)->children();
3304
0
    return const_child_range(Children.begin(), Children.end());
3305
0
  }
3306
3307
344
  child_range used_children() {
3308
344
    return child_range(child_iterator(), child_iterator());
3309
344
  }
3310
0
  const_child_range used_children() const {
3311
0
    return const_child_range(const_child_iterator(), const_child_iterator());
3312
0
  }
3313
3314
78.1k
  static bool classof(const OMPClause *T) {
3315
78.1k
    return T->getClauseKind() == OMPC_in_reduction;
3316
78.1k
  }
3317
};
3318
3319
/// This represents clause 'linear' in the '#pragma omp ...'
3320
/// directives.
3321
///
3322
/// \code
3323
/// #pragma omp simd linear(a,b : 2)
3324
/// \endcode
3325
/// In this example directive '#pragma omp simd' has clause 'linear'
3326
/// with variables 'a', 'b' and linear step '2'.
3327
class OMPLinearClause final
3328
    : public OMPVarListClause<OMPLinearClause>,
3329
      public OMPClauseWithPostUpdate,
3330
      private llvm::TrailingObjects<OMPLinearClause, Expr *> {
3331
  friend class OMPClauseReader;
3332
  friend OMPVarListClause;
3333
  friend TrailingObjects;
3334
3335
  /// Modifier of 'linear' clause.
3336
  OpenMPLinearClauseKind Modifier = OMPC_LINEAR_val;
3337
3338
  /// Location of linear modifier if any.
3339
  SourceLocation ModifierLoc;
3340
3341
  /// Location of ':'.
3342
  SourceLocation ColonLoc;
3343
3344
  /// Sets the linear step for clause.
3345
2.93k
  void setStep(Expr *Step) { *(getFinals().end()) = Step; }
3346
3347
  /// Sets the expression to calculate linear step for clause.
3348
2.93k
  void setCalcStep(Expr *CalcStep) { *(getFinals().end() + 1) = CalcStep; }
3349
3350
  /// Build 'linear' clause with given number of variables \a NumVars.
3351
  ///
3352
  /// \param StartLoc Starting location of the clause.
3353
  /// \param LParenLoc Location of '('.
3354
  /// \param ColonLoc Location of ':'.
3355
  /// \param EndLoc Ending location of the clause.
3356
  /// \param NumVars Number of variables.
3357
  OMPLinearClause(SourceLocation StartLoc, SourceLocation LParenLoc,
3358
                  OpenMPLinearClauseKind Modifier, SourceLocation ModifierLoc,
3359
                  SourceLocation ColonLoc, SourceLocation EndLoc,
3360
                  unsigned NumVars)
3361
      : OMPVarListClause<OMPLinearClause>(OMPC_linear, StartLoc, LParenLoc,
3362
                                          EndLoc, NumVars),
3363
        OMPClauseWithPostUpdate(this), Modifier(Modifier),
3364
2.58k
        ModifierLoc(ModifierLoc), ColonLoc(ColonLoc) {}
3365
3366
  /// Build an empty clause.
3367
  ///
3368
  /// \param NumVars Number of variables.
3369
  explicit OMPLinearClause(unsigned NumVars)
3370
      : OMPVarListClause<OMPLinearClause>(OMPC_linear, SourceLocation(),
3371
                                          SourceLocation(), SourceLocation(),
3372
                                          NumVars),
3373
358
        OMPClauseWithPostUpdate(this) {}
3374
3375
  /// Gets the list of initial values for linear variables.
3376
  ///
3377
  /// There are NumVars expressions with initial values allocated after the
3378
  /// varlist, they are followed by NumVars update expressions (used to update
3379
  /// the linear variable's value on current iteration) and they are followed by
3380
  /// NumVars final expressions (used to calculate the linear variable's
3381
  /// value after the loop body). After these lists, there are 2 helper
3382
  /// expressions - linear step and a helper to calculate it before the
3383
  /// loop body (used when the linear step is not constant):
3384
  ///
3385
  /// { Vars[] /* in OMPVarListClause */; Privates[]; Inits[]; Updates[];
3386
  /// Finals[]; Step; CalcStep; }
3387
57.6k
  MutableArrayRef<Expr *> getPrivates() {
3388
57.6k
    return MutableArrayRef<Expr *>(varlist_end(), varlist_size());
3389
57.6k
  }
3390
7.12k
  ArrayRef<const Expr *> getPrivates() const {
3391
7.12k
    return llvm::makeArrayRef(varlist_end(), varlist_size());
3392
7.12k
  }
3393
3394
46.6k
  MutableArrayRef<Expr *> getInits() {
3395
46.6k
    return MutableArrayRef<Expr *>(getPrivates().end(), varlist_size());
3396
46.6k
  }
3397
5.61k
  ArrayRef<const Expr *> getInits() const {
3398
5.61k
    return llvm::makeArrayRef(getPrivates().end(), varlist_size());
3399
5.61k
  }
3400
3401
  /// Sets the list of update expressions for linear variables.
3402
34.5k
  MutableArrayRef<Expr *> getUpdates() {
3403
34.5k
    return MutableArrayRef<Expr *>(getInits().end(), varlist_size());
3404
34.5k
  }
3405
4.10k
  ArrayRef<const Expr *> getUpdates() const {
3406
4.10k
    return llvm::makeArrayRef(getInits().end(), varlist_size());
3407
4.10k
  }
3408
3409
  /// Sets the list of final update expressions for linear variables.
3410
26.3k
  MutableArrayRef<Expr *> getFinals() {
3411
26.3k
    return MutableArrayRef<Expr *>(getUpdates().end(), varlist_size());
3412
26.3k
  }
3413
2.78k
  ArrayRef<const Expr *> getFinals() const {
3414
2.78k
    return llvm::makeArrayRef(getUpdates().end(), varlist_size());
3415
2.78k
  }
3416
3417
  /// Gets the list of used expressions for linear variables.
3418
9.71k
  MutableArrayRef<Expr *> getUsedExprs() {
3419
9.71k
    return MutableArrayRef<Expr *>(getFinals().end() + 2, varlist_size() + 1);
3420
9.71k
  }
3421
0
  ArrayRef<const Expr *> getUsedExprs() const {
3422
0
    return llvm::makeArrayRef(getFinals().end() + 2, varlist_size() + 1);
3423
0
  }
3424
3425
  /// Sets the list of the copies of original linear variables.
3426
  /// \param PL List of expressions.
3427
  void setPrivates(ArrayRef<Expr *> PL);
3428
3429
  /// Sets the list of the initial values for linear variables.
3430
  /// \param IL List of expressions.
3431
  void setInits(ArrayRef<Expr *> IL);
3432
3433
public:
3434
  /// Creates clause with a list of variables \a VL and a linear step
3435
  /// \a Step.
3436
  ///
3437
  /// \param C AST Context.
3438
  /// \param StartLoc Starting location of the clause.
3439
  /// \param LParenLoc Location of '('.
3440
  /// \param Modifier Modifier of 'linear' clause.
3441
  /// \param ModifierLoc Modifier location.
3442
  /// \param ColonLoc Location of ':'.
3443
  /// \param EndLoc Ending location of the clause.
3444
  /// \param VL List of references to the variables.
3445
  /// \param PL List of private copies of original variables.
3446
  /// \param IL List of initial values for the variables.
3447
  /// \param Step Linear step.
3448
  /// \param CalcStep Calculation of the linear step.
3449
  /// \param PreInit Statement that must be executed before entering the OpenMP
3450
  /// region with this clause.
3451
  /// \param PostUpdate Expression that must be executed after exit from the
3452
  /// OpenMP region with this clause.
3453
  static OMPLinearClause *
3454
  Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
3455
         OpenMPLinearClauseKind Modifier, SourceLocation ModifierLoc,
3456
         SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef<Expr *> VL,
3457
         ArrayRef<Expr *> PL, ArrayRef<Expr *> IL, Expr *Step, Expr *CalcStep,
3458
         Stmt *PreInit, Expr *PostUpdate);
3459
3460
  /// Creates an empty clause with the place for \a NumVars variables.
3461
  ///
3462
  /// \param C AST context.
3463
  /// \param NumVars Number of variables.
3464
  static OMPLinearClause *CreateEmpty(const ASTContext &C, unsigned NumVars);
3465
3466
  /// Set modifier.
3467
358
  void setModifier(OpenMPLinearClauseKind Kind) { Modifier = Kind; }
3468
3469
  /// Return modifier.
3470
2.88k
  OpenMPLinearClauseKind getModifier() const { return Modifier; }
3471
3472
  /// Set modifier location.
3473
358
  void setModifierLoc(SourceLocation Loc) { ModifierLoc = Loc; }
3474
3475
  /// Return modifier location.
3476
1.72k
  SourceLocation getModifierLoc() const { return ModifierLoc; }
3477
3478
  /// Sets the location of ':'.
3479
358
  void setColonLoc(SourceLocation Loc) { ColonLoc = Loc; }
3480
3481
  /// Returns the location of ':'.
3482
892
  SourceLocation getColonLoc() const { return ColonLoc; }
3483
3484
  /// Returns linear step.
3485
5.38k
  Expr *getStep() { return *(getFinals().end()); }
3486
3487
  /// Returns linear step.
3488
454
  const Expr *getStep() const { return *(getFinals().end()); }
3489
3490
  /// Returns expression to calculate linear step.
3491
2.31k
  Expr *getCalcStep() { return *(getFinals().end() + 1); }
3492
3493
  /// Returns expression to calculate linear step.
3494
816
  const Expr *getCalcStep() const { return *(getFinals().end() + 1); }
3495
3496
  /// Sets the list of update expressions for linear variables.
3497
  /// \param UL List of expressions.
3498
  void setUpdates(ArrayRef<Expr *> UL);
3499
3500
  /// Sets the list of final update expressions for linear variables.
3501
  /// \param FL List of expressions.
3502
  void setFinals(ArrayRef<Expr *> FL);
3503
3504
  /// Sets the list of used expressions for the linear clause.
3505
  void setUsedExprs(ArrayRef<Expr *> UE);
3506
3507
  using privates_iterator = MutableArrayRef<Expr *>::iterator;
3508
  using privates_const_iterator = ArrayRef<const Expr *>::iterator;
3509
  using privates_range = llvm::iterator_range<privates_iterator>;
3510
  using privates_const_range = llvm::iterator_range<privates_const_iterator>;
3511
3512
4.05k
  privates_range privates() {
3513
4.05k
    return privates_range(getPrivates().begin(), getPrivates().end());
3514
4.05k
  }
3515
3516
756
  privates_const_range privates() const {
3517
756
    return privates_const_range(getPrivates().begin(), getPrivates().end());
3518
756
  }
3519
3520
  using inits_iterator = MutableArrayRef<Expr *>::iterator;
3521
  using inits_const_iterator = ArrayRef<const Expr *>::iterator;
3522
  using inits_range = llvm::iterator_range<inits_iterator>;
3523
  using inits_const_range = llvm::iterator_range<inits_const_iterator>;
3524
3525
2.31k
  inits_range inits() {
3526
2.31k
    return inits_range(getInits().begin(), getInits().end());
3527
2.31k
  }
3528
3529
756
  inits_const_range inits() const {
3530
756
    return inits_const_range(getInits().begin(), getInits().end());
3531
756
  }
3532
3533
  using updates_iterator = MutableArrayRef<Expr *>::iterator;
3534
  using updates_const_iterator = ArrayRef<const Expr *>::iterator;
3535
  using updates_range = llvm::iterator_range<updates_iterator>;
3536
  using updates_const_range = llvm::iterator_range<updates_const_iterator>;
3537
3538
367
  updates_range updates() {
3539
367
    return updates_range(getUpdates().begin(), getUpdates().end());
3540
367
  }
3541
3542
660
  updates_const_range updates() const {
3543
660
    return updates_const_range(getUpdates().begin(), getUpdates().end());
3544
660
  }
3545
3546
  using finals_iterator = MutableArrayRef<Expr *>::iterator;
3547
  using finals_const_iterator = ArrayRef<const Expr *>::iterator;
3548
  using finals_range = llvm::iterator_range<finals_iterator>;
3549
  using finals_const_range = llvm::iterator_range<finals_const_iterator>;
3550
3551
367
  finals_range finals() {
3552
367
    return finals_range(getFinals().begin(), getFinals().end());
3553
367
  }
3554
3555
756
  finals_const_range finals() const {
3556
756
    return finals_const_range(getFinals().begin(), getFinals().end());
3557
756
  }
3558
3559
  using used_expressions_iterator = MutableArrayRef<Expr *>::iterator;
3560
  using used_expressions_const_iterator = ArrayRef<const Expr *>::iterator;
3561
  using used_expressions_range =
3562
      llvm::iterator_range<used_expressions_iterator>;
3563
  using used_expressions_const_range =
3564
      llvm::iterator_range<used_expressions_const_iterator>;
3565
3566
358
  used_expressions_range used_expressions() {
3567
358
    return finals_range(getUsedExprs().begin(), getUsedExprs().end());
3568
358
  }
3569
3570
0
  used_expressions_const_range used_expressions() const {
3571
0
    return finals_const_range(getUsedExprs().begin(), getUsedExprs().end());
3572
0
  }
3573
3574
2.92k
  child_range children() {
3575
2.92k
    return child_range(reinterpret_cast<Stmt **>(varlist_begin()),
3576
2.92k
                       reinterpret_cast<Stmt **>(varlist_end()));
3577
2.92k
  }
3578
3579
0
  const_child_range children() const {
3580
0
    auto Children = const_cast<OMPLinearClause *>(this)->children();
3581
0
    return const_child_range(Children.begin(), Children.end());
3582
0
  }
3583
3584
  child_range used_children();
3585
3586
0
  const_child_range used_children() const {
3587
0
    auto Children = const_cast<OMPLinearClause *>(this)->used_children();
3588
0
    return const_child_range(Children.begin(), Children.end());
3589
0
  }
3590
3591
103k
  static bool classof(const OMPClause *T) {
3592
103k
    return T->getClauseKind() == OMPC_linear;
3593
103k
  }
3594
};
3595
3596
/// This represents clause 'aligned' in the '#pragma omp ...'
3597
/// directives.
3598
///
3599
/// \code
3600
/// #pragma omp simd aligned(a,b : 8)
3601
/// \endcode
3602
/// In this example directive '#pragma omp simd' has clause 'aligned'
3603
/// with variables 'a', 'b' and alignment '8'.
3604
class OMPAlignedClause final
3605
    : public OMPVarListClause<OMPAlignedClause>,
3606
      private llvm::TrailingObjects<OMPAlignedClause, Expr *> {
3607
  friend class OMPClauseReader;
3608
  friend OMPVarListClause;
3609
  friend TrailingObjects;
3610
3611
  /// Location of ':'.
3612
  SourceLocation ColonLoc;
3613
3614
  /// Sets the alignment for clause.
3615
1.93k
  void setAlignment(Expr *A) { *varlist_end() = A; }
3616
3617
  /// Build 'aligned' clause with given number of variables \a NumVars.
3618
  ///
3619
  /// \param StartLoc Starting location of the clause.
3620
  /// \param LParenLoc Location of '('.
3621
  /// \param ColonLoc Location of ':'.
3622
  /// \param EndLoc Ending location of the clause.
3623
  /// \param NumVars Number of variables.
3624
  OMPAlignedClause(SourceLocation StartLoc, SourceLocation LParenLoc,
3625
                   SourceLocation ColonLoc, SourceLocation EndLoc,
3626
                   unsigned NumVars)
3627
      : OMPVarListClause<OMPAlignedClause>(OMPC_aligned, StartLoc, LParenLoc,
3628
                                           EndLoc, NumVars),
3629
1.69k
        ColonLoc(ColonLoc) {}
3630
3631
  /// Build an empty clause.
3632
  ///
3633
  /// \param NumVars Number of variables.
3634
  explicit OMPAlignedClause(unsigned NumVars)
3635
      : OMPVarListClause<OMPAlignedClause>(OMPC_aligned, SourceLocation(),
3636
                                           SourceLocation(), SourceLocation(),
3637
244
                                           NumVars) {}
3638
3639
public:
3640
  /// Creates clause with a list of variables \a VL and alignment \a A.
3641
  ///
3642
  /// \param C AST Context.
3643
  /// \param StartLoc Starting location of the clause.
3644
  /// \param LParenLoc Location of '('.
3645
  /// \param ColonLoc Location of ':'.
3646
  /// \param EndLoc Ending location of the clause.
3647
  /// \param VL List of references to the variables.
3648
  /// \param A Alignment.
3649
  static OMPAlignedClause *Create(const ASTContext &C, SourceLocation StartLoc,
3650
                                  SourceLocation LParenLoc,
3651
                                  SourceLocation ColonLoc,
3652
                                  SourceLocation EndLoc, ArrayRef<Expr *> VL,
3653
                                  Expr *A);
3654
3655
  /// Creates an empty clause with the place for \a NumVars variables.
3656
  ///
3657
  /// \param C AST context.
3658
  /// \param NumVars Number of variables.
3659
  static OMPAlignedClause *CreateEmpty(const ASTContext &C, unsigned NumVars);
3660
3661
  /// Sets the location of ':'.
3662
244
  void setColonLoc(SourceLocation Loc) { ColonLoc = Loc; }
3663
3664
  /// Returns the location of ':'.
3665
712
  SourceLocation getColonLoc() const { return ColonLoc; }
3666
3667
  /// Returns alignment.
3668
1.41k
  Expr *getAlignment() { return *varlist_end(); }
3669
3670
  /// Returns alignment.
3671
534
  const Expr *getAlignment() const { return *varlist_end(); }
3672
3673
442
  child_range children() {
3674
442
    return child_range(reinterpret_cast<Stmt **>(varlist_begin()),
3675
442
                       reinterpret_cast<Stmt **>(varlist_end()));
3676
442
  }
3677
3678
0
  const_child_range children() const {
3679
0
    auto Children = const_cast<OMPAlignedClause *>(this)->children();
3680
0
    return const_child_range(Children.begin(), Children.end());
3681
0
  }
3682
3683
488
  child_range used_children() {
3684
488
    return child_range(child_iterator(), child_iterator());
3685
488
  }
3686
0
  const_child_range used_children() const {
3687
0
    return const_child_range(const_child_iterator(), const_child_iterator());
3688
0
  }
3689
3690
15.2k
  static bool classof(const OMPClause *T) {
3691
15.2k
    return T->getClauseKind() == OMPC_aligned;
3692
15.2k
  }
3693
};
3694
3695
/// This represents clause 'copyin' in the '#pragma omp ...' directives.
3696
///
3697
/// \code
3698
/// #pragma omp parallel copyin(a,b)
3699
/// \endcode
3700
/// In this example directive '#pragma omp parallel' has clause 'copyin'
3701
/// with the variables 'a' and 'b'.
3702
class OMPCopyinClause final
3703
    : public OMPVarListClause<OMPCopyinClause>,
3704
      private llvm::TrailingObjects<OMPCopyinClause, Expr *> {
3705
  // Class has 3 additional tail allocated arrays:
3706
  // 1. List of helper expressions for proper generation of assignment operation
3707
  // required for copyin clause. This list represents sources.
3708
  // 2. List of helper expressions for proper generation of assignment operation
3709
  // required for copyin clause. This list represents destinations.
3710
  // 3. List of helper expressions that represents assignment operation:
3711
  // \code
3712
  // DstExprs = SrcExprs;
3713
  // \endcode
3714
  // Required for proper codegen of propagation of master's thread values of
3715
  // threadprivate variables to local instances of that variables in other
3716
  // implicit threads.
3717
3718
  friend class OMPClauseReader;
3719
  friend OMPVarListClause;
3720
  friend TrailingObjects;
3721
3722
  /// Build clause with number of variables \a N.
3723
  ///
3724
  /// \param StartLoc Starting location of the clause.
3725
  /// \param LParenLoc Location of '('.
3726
  /// \param EndLoc Ending location of the clause.
3727
  /// \param N Number of the variables in the clause.
3728
  OMPCopyinClause(SourceLocation StartLoc, SourceLocation LParenLoc,
3729
                  SourceLocation EndLoc, unsigned N)
3730
      : OMPVarListClause<OMPCopyinClause>(OMPC_copyin, StartLoc, LParenLoc,
3731
397
                                          EndLoc, N) {}
3732
3733
  /// Build an empty clause.
3734
  ///
3735
  /// \param N Number of variables.
3736
  explicit OMPCopyinClause(unsigned N)
3737
      : OMPVarListClause<OMPCopyinClause>(OMPC_copyin, SourceLocation(),
3738
                                          SourceLocation(), SourceLocation(),
3739
74
                                          N) {}
3740
3741
  /// Set list of helper expressions, required for proper codegen of the
3742
  /// clause. These expressions represent source expression in the final
3743
  /// assignment statement performed by the copyin clause.
3744
  void setSourceExprs(ArrayRef<Expr *> SrcExprs);
3745
3746
  /// Get the list of helper source expressions.
3747
1.39k
  MutableArrayRef<Expr *> getSourceExprs() {
3748
1.39k
    return MutableArrayRef<Expr *>(varlist_end(), varlist_size());
3749
1.39k
  }
3750
378
  ArrayRef<const Expr *> getSourceExprs() const {
3751
378
    return llvm::makeArrayRef(varlist_end(), varlist_size());
3752
378
  }
3753
3754
  /// Set list of helper expressions, required for proper codegen of the
3755
  /// clause. These expressions represent destination expression in the final
3756
  /// assignment statement performed by the copyin clause.
3757
  void setDestinationExprs(ArrayRef<Expr *> DstExprs);
3758
3759
  /// Get the list of helper destination expressions.
3760
775
  MutableArrayRef<Expr *> getDestinationExprs() {
3761
775
    return MutableArrayRef<Expr *>(getSourceExprs().end(), varlist_size());
3762
775
  }
3763
252
  ArrayRef<const Expr *> getDestinationExprs() const {
3764
252
    return llvm::makeArrayRef(getSourceExprs().end(), varlist_size());
3765
252
  }
3766
3767
  /// Set list of helper assignment expressions, required for proper
3768
  /// codegen of the clause. These expressions are assignment expressions that
3769
  /// assign source helper expressions to destination helper expressions
3770
  /// correspondingly.
3771
  void setAssignmentOps(ArrayRef<Expr *> AssignmentOps);
3772
3773
  /// Get the list of helper assignment expressions.
3774
152
  MutableArrayRef<Expr *> getAssignmentOps() {
3775
152
    return MutableArrayRef<Expr *>(getDestinationExprs().end(), varlist_size());
3776
152
  }
3777
126
  ArrayRef<const Expr *> getAssignmentOps() const {
3778
126
    return llvm::makeArrayRef(getDestinationExprs().end(), varlist_size());
3779
126
  }
3780
3781
public:
3782
  /// Creates clause with a list of variables \a VL.
3783
  ///
3784
  /// \param C AST context.
3785
  /// \param StartLoc Starting location of the clause.
3786
  /// \param LParenLoc Location of '('.
3787
  /// \param EndLoc Ending location of the clause.
3788
  /// \param VL List of references to the variables.
3789
  /// \param SrcExprs List of helper expressions for proper generation of
3790
  /// assignment operation required for copyin clause. This list represents
3791
  /// sources.
3792
  /// \param DstExprs List of helper expressions for proper generation of
3793
  /// assignment operation required for copyin clause. This list represents
3794
  /// destinations.
3795
  /// \param AssignmentOps List of helper expressions that represents assignment
3796
  /// operation:
3797
  /// \code
3798
  /// DstExprs = SrcExprs;
3799
  /// \endcode
3800
  /// Required for proper codegen of propagation of master's thread values of
3801
  /// threadprivate variables to local instances of that variables in other
3802
  /// implicit threads.
3803
  static OMPCopyinClause *
3804
  Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
3805
         SourceLocation EndLoc, ArrayRef<Expr *> VL, ArrayRef<Expr *> SrcExprs,
3806
         ArrayRef<Expr *> DstExprs, ArrayRef<Expr *> AssignmentOps);
3807
3808
  /// Creates an empty clause with \a N variables.
3809
  ///
3810
  /// \param C AST context.
3811
  /// \param N The number of variables.
3812
  static OMPCopyinClause *CreateEmpty(const ASTContext &C, unsigned N);
3813
3814
  using helper_expr_iterator = MutableArrayRef<Expr *>::iterator;
3815
  using helper_expr_const_iterator = ArrayRef<const Expr *>::iterator;
3816
  using helper_expr_range = llvm::iterator_range<helper_expr_iterator>;
3817
  using helper_expr_const_range =
3818
      llvm::iterator_range<helper_expr_const_iterator>;
3819
3820
63
  helper_expr_const_range source_exprs() const {
3821
63
    return helper_expr_const_range(getSourceExprs().begin(),
3822
63
                                   getSourceExprs().end());
3823
63
  }
3824
3825
76
  helper_expr_range source_exprs() {
3826
76
    return helper_expr_range(getSourceExprs().begin(), getSourceExprs().end());
3827
76
  }
3828
3829
63
  helper_expr_const_range destination_exprs() const {
3830
63
    return helper_expr_const_range(getDestinationExprs().begin(),
3831
63
                                   getDestinationExprs().end());
3832
63
  }
3833
3834
76
  helper_expr_range destination_exprs() {
3835
76
    return helper_expr_range(getDestinationExprs().begin(),
3836
76
                             getDestinationExprs().end());
3837
76
  }
3838
3839
63
  helper_expr_const_range assignment_ops() const {
3840
63
    return helper_expr_const_range(getAssignmentOps().begin(),
3841
63
                                   getAssignmentOps().end());
3842
63
  }
3843
3844
76
  helper_expr_range assignment_ops() {
3845
76
    return helper_expr_range(getAssignmentOps().begin(),
3846
76
                             getAssignmentOps().end());
3847
76
  }
3848
3849
327
  child_range children() {
3850
327
    return child_range(reinterpret_cast<Stmt **>(varlist_begin()),
3851
327
                       reinterpret_cast<Stmt **>(varlist_end()));
3852
327
  }
3853
3854
0
  const_child_range children() const {
3855
0
    auto Children = const_cast<OMPCopyinClause *>(this)->children();
3856
0
    return const_child_range(Children.begin(), Children.end());
3857
0
  }
3858
3859
272
  child_range used_children() {
3860
272
    return child_range(child_iterator(), child_iterator());
3861
272
  }
3862
0
  const_child_range used_children() const {
3863
0
    return const_child_range(const_child_iterator(), const_child_iterator());
3864
0
  }
3865
3866
475
  static bool classof(const OMPClause *T) {
3867
475
    return T->getClauseKind() == OMPC_copyin;
3868
475
  }
3869
};
3870
3871
/// This represents clause 'copyprivate' in the '#pragma omp ...'
3872
/// directives.
3873
///
3874
/// \code
3875
/// #pragma omp single copyprivate(a,b)
3876
/// \endcode
3877
/// In this example directive '#pragma omp single' has clause 'copyprivate'
3878
/// with the variables 'a' and 'b'.
3879
class OMPCopyprivateClause final
3880
    : public OMPVarListClause<OMPCopyprivateClause>,
3881
      private llvm::TrailingObjects<OMPCopyprivateClause, Expr *> {
3882
  friend class OMPClauseReader;
3883
  friend OMPVarListClause;
3884
  friend TrailingObjects;
3885
3886
  /// Build clause with number of variables \a N.
3887
  ///
3888
  /// \param StartLoc Starting location of the clause.
3889
  /// \param LParenLoc Location of '('.
3890
  /// \param EndLoc Ending location of the clause.
3891
  /// \param N Number of the variables in the clause.
3892
  OMPCopyprivateClause(SourceLocation StartLoc, SourceLocation LParenLoc,
3893
                       SourceLocation EndLoc, unsigned N)
3894
      : OMPVarListClause<OMPCopyprivateClause>(OMPC_copyprivate, StartLoc,
3895
144
                                               LParenLoc, EndLoc, N) {}
3896
3897
  /// Build an empty clause.
3898
  ///
3899
  /// \param N Number of variables.
3900
  explicit OMPCopyprivateClause(unsigned N)
3901
      : OMPVarListClause<OMPCopyprivateClause>(
3902
            OMPC_copyprivate, SourceLocation(), SourceLocation(),
3903
18
            SourceLocation(), N) {}
3904
3905
  /// Set list of helper expressions, required for proper codegen of the
3906
  /// clause. These expressions represent source expression in the final
3907
  /// assignment statement performed by the copyprivate clause.
3908
  void setSourceExprs(ArrayRef<Expr *> SrcExprs);
3909
3910
  /// Get the list of helper source expressions.
3911
432
  MutableArrayRef<Expr *> getSourceExprs() {
3912
432
    return MutableArrayRef<Expr *>(varlist_end(), varlist_size());
3913
432
  }
3914
228
  ArrayRef<const Expr *> getSourceExprs() const {
3915
228
    return llvm::makeArrayRef(varlist_end(), varlist_size());
3916
228
  }
3917
3918
  /// Set list of helper expressions, required for proper codegen of the
3919
  /// clause. These expressions represent destination expression in the final
3920
  /// assignment statement performed by the copyprivate clause.
3921
  void setDestinationExprs(ArrayRef<Expr *> DstExprs);
3922
3923
  /// Get the list of helper destination expressions.
3924
234
  MutableArrayRef<Expr *> getDestinationExprs() {
3925
234
    return MutableArrayRef<Expr *>(getSourceExprs().end(), varlist_size());
3926
234
  }
3927
152
  ArrayRef<const Expr *> getDestinationExprs() const {
3928
152
    return llvm::makeArrayRef(getSourceExprs().end(), varlist_size());
3929
152
  }
3930
3931
  /// Set list of helper assignment expressions, required for proper
3932
  /// codegen of the clause. These expressions are assignment expressions that
3933
  /// assign source helper expressions to destination helper expressions
3934
  /// correspondingly.
3935
  void setAssignmentOps(ArrayRef<Expr *> AssignmentOps);
3936
3937
  /// Get the list of helper assignment expressions.
3938
36
  MutableArrayRef<Expr *> getAssignmentOps() {
3939
36
    return MutableArrayRef<Expr *>(getDestinationExprs().end(), varlist_size());
3940
36
  }
3941
76
  ArrayRef<const Expr *> getAssignmentOps() const {
3942
76
    return llvm::makeArrayRef(getDestinationExprs().end(), varlist_size());
3943
76
  }
3944
3945
public:
3946
  /// Creates clause with a list of variables \a VL.
3947
  ///
3948
  /// \param C AST context.
3949
  /// \param StartLoc Starting location of the clause.
3950
  /// \param LParenLoc Location of '('.
3951
  /// \param EndLoc Ending location of the clause.
3952
  /// \param VL List of references to the variables.
3953
  /// \param SrcExprs List of helper expressions for proper generation of
3954
  /// assignment operation required for copyprivate clause. This list represents
3955
  /// sources.
3956
  /// \param DstExprs List of helper expressions for proper generation of
3957
  /// assignment operation required for copyprivate clause. This list represents
3958
  /// destinations.
3959
  /// \param AssignmentOps List of helper expressions that represents assignment
3960
  /// operation:
3961
  /// \code
3962
  /// DstExprs = SrcExprs;
3963
  /// \endcode
3964
  /// Required for proper codegen of final assignment performed by the
3965
  /// copyprivate clause.
3966
  static OMPCopyprivateClause *
3967
  Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
3968
         SourceLocation EndLoc, ArrayRef<Expr *> VL, ArrayRef<Expr *> SrcExprs,
3969
         ArrayRef<Expr *> DstExprs, ArrayRef<Expr *> AssignmentOps);
3970
3971
  /// Creates an empty clause with \a N variables.
3972
  ///
3973
  /// \param C AST context.
3974
  /// \param N The number of variables.
3975
  static OMPCopyprivateClause *CreateEmpty(const ASTContext &C, unsigned N);
3976
3977
  using helper_expr_iterator = MutableArrayRef<Expr *>::iterator;
3978
  using helper_expr_const_iterator = ArrayRef<const Expr *>::iterator;
3979
  using helper_expr_range = llvm::iterator_range<helper_expr_iterator>;
3980
  using helper_expr_const_range =
3981
      llvm::iterator_range<helper_expr_const_iterator>;
3982
3983
38
  helper_expr_const_range source_exprs() const {
3984
38
    return helper_expr_const_range(getSourceExprs().begin(),
3985
38
                                   getSourceExprs().end());
3986
38
  }
3987
3988
18
  helper_expr_range source_exprs() {
3989
18
    return helper_expr_range(getSourceExprs().begin(), getSourceExprs().end());
3990
18
  }
3991
3992
38
  helper_expr_const_range destination_exprs() const {
3993
38
    return helper_expr_const_range(getDestinationExprs().begin(),
3994
38
                                   getDestinationExprs().end());
3995
38
  }
3996
3997
18
  helper_expr_range destination_exprs() {
3998
18
    return helper_expr_range(getDestinationExprs().begin(),
3999
18
                             getDestinationExprs().end());
4000
18
  }
4001
4002
38
  helper_expr_const_range assignment_ops() const {
4003
38
    return helper_expr_const_range(getAssignmentOps().begin(),
4004
38
                                   getAssignmentOps().end());
4005
38
  }
4006
4007
18
  helper_expr_range assignment_ops() {
4008
18
    return helper_expr_range(getAssignmentOps().begin(),
4009
18
                             getAssignmentOps().end());
4010
18
  }
4011
4012
206
  child_range children() {
4013
206
    return child_range(reinterpret_cast<Stmt **>(varlist_begin()),
4014
206
                       reinterpret_cast<Stmt **>(varlist_end()));
4015
206
  }
4016
4017
0
  const_child_range children() const {
4018
0
    auto Children = const_cast<OMPCopyprivateClause *>(this)->children();
4019
0
    return const_child_range(Children.begin(), Children.end());
4020
0
  }
4021
4022
36
  child_range used_children() {
4023
36
    return child_range(child_iterator(), child_iterator());
4024
36
  }
4025
0
  const_child_range used_children() const {
4026
0
    return const_child_range(const_child_iterator(), const_child_iterator());
4027
0
  }
4028
4029
111
  static bool classof(const OMPClause *T) {
4030
111
    return T->getClauseKind() == OMPC_copyprivate;
4031
111
  }
4032
};
4033
4034
/// This represents implicit clause 'flush' for the '#pragma omp flush'
4035
/// directive.
4036
/// This clause does not exist by itself, it can be only as a part of 'omp
4037
/// flush' directive. This clause is introduced to keep the original structure
4038
/// of \a OMPExecutableDirective class and its derivatives and to use the
4039
/// existing infrastructure of clauses with the list of variables.
4040
///
4041
/// \code
4042
/// #pragma omp flush(a,b)
4043
/// \endcode
4044
/// In this example directive '#pragma omp flush' has implicit clause 'flush'
4045
/// with the variables 'a' and 'b'.
4046
class OMPFlushClause final
4047
    : public OMPVarListClause<OMPFlushClause>,
4048
      private llvm::TrailingObjects<OMPFlushClause, Expr *> {
4049
  friend OMPVarListClause;
4050
  friend TrailingObjects;
4051
4052
  /// Build clause with number of variables \a N.
4053
  ///
4054
  /// \param StartLoc Starting location of the clause.
4055
  /// \param LParenLoc Location of '('.
4056
  /// \param EndLoc Ending location of the clause.
4057
  /// \param N Number of the variables in the clause.
4058
  OMPFlushClause(SourceLocation StartLoc, SourceLocation LParenLoc,
4059
                 SourceLocation EndLoc, unsigned N)
4060
      : OMPVarListClause<OMPFlushClause>(OMPC_flush, StartLoc, LParenLoc,
4061
90
                                         EndLoc, N) {}
4062
4063
  /// Build an empty clause.
4064
  ///
4065
  /// \param N Number of variables.
4066
  explicit OMPFlushClause(unsigned N)
4067
      : OMPVarListClause<OMPFlushClause>(OMPC_flush, SourceLocation(),
4068
                                         SourceLocation(), SourceLocation(),
4069
10
                                         N) {}
4070
4071
public:
4072
  /// Creates clause with a list of variables \a VL.
4073
  ///
4074
  /// \param C AST context.
4075
  /// \param StartLoc Starting location of the clause.
4076
  /// \param LParenLoc Location of '('.
4077
  /// \param EndLoc Ending location of the clause.
4078
  /// \param VL List of references to the variables.
4079
  static OMPFlushClause *Create(const ASTContext &C, SourceLocation StartLoc,
4080
                                SourceLocation LParenLoc, SourceLocation EndLoc,
4081
                                ArrayRef<Expr *> VL);
4082
4083
  /// Creates an empty clause with \a N variables.
4084
  ///
4085
  /// \param C AST context.
4086
  /// \param N The number of variables.
4087
  static OMPFlushClause *CreateEmpty(const ASTContext &C, unsigned N);
4088
4089
0
  child_range children() {
4090
0
    return child_range(reinterpret_cast<Stmt **>(varlist_begin()),
4091
0
                       reinterpret_cast<Stmt **>(varlist_end()));
4092
0
  }
4093
4094
0
  const_child_range children() const {
4095
0
    auto Children = const_cast<OMPFlushClause *>(this)->children();
4096
0
    return const_child_range(Children.begin(), Children.end());
4097
0
  }
4098
4099
28
  child_range used_children() {
4100
28
    return child_range(child_iterator(), child_iterator());
4101
28
  }
4102
0
  const_child_range used_children() const {
4103
0
    return const_child_range(const_child_iterator(), const_child_iterator());
4104
0
  }
4105
4106
200
  static bool classof(const OMPClause *T) {
4107
200
    return T->getClauseKind() == OMPC_flush;
4108
200
  }
4109
};
4110
4111
/// This represents implicit clause 'depend' for the '#pragma omp task'
4112
/// directive.
4113
///
4114
/// \code
4115
/// #pragma omp task depend(in:a,b)
4116
/// \endcode
4117
/// In this example directive '#pragma omp task' with clause 'depend' with the
4118
/// variables 'a' and 'b' with dependency 'in'.
4119
class OMPDependClause final
4120
    : public OMPVarListClause<OMPDependClause>,
4121
      private llvm::TrailingObjects<OMPDependClause, Expr *> {
4122
  friend class OMPClauseReader;
4123
  friend OMPVarListClause;
4124
  friend TrailingObjects;
4125
4126
  /// Dependency type (one of in, out, inout).
4127
  OpenMPDependClauseKind DepKind = OMPC_DEPEND_unknown;
4128
4129
  /// Dependency type location.
4130
  SourceLocation DepLoc;
4131
4132
  /// Colon location.
4133
  SourceLocation ColonLoc;
4134
4135
  /// Number of loops, associated with the depend clause.
4136
  unsigned NumLoops = 0;
4137
4138
  /// Build clause with number of variables \a N.
4139
  ///
4140
  /// \param StartLoc Starting location of the clause.
4141
  /// \param LParenLoc Location of '('.
4142
  /// \param EndLoc Ending location of the clause.
4143
  /// \param N Number of the variables in the clause.
4144
  /// \param NumLoops Number of loops that is associated with this depend
4145
  /// clause.
4146
  OMPDependClause(SourceLocation StartLoc, SourceLocation LParenLoc,
4147
                  SourceLocation EndLoc, unsigned N, unsigned NumLoops)
4148
      : OMPVarListClause<OMPDependClause>(OMPC_depend, StartLoc, LParenLoc,
4149
2.21k
                                          EndLoc, N), NumLoops(NumLoops) {}
4150
4151
  /// Build an empty clause.
4152
  ///
4153
  /// \param N Number of variables.
4154
  /// \param NumLoops Number of loops that is associated with this depend
4155
  /// clause.
4156
  explicit OMPDependClause(unsigned N, unsigned NumLoops)
4157
      : OMPVarListClause<OMPDependClause>(OMPC_depend, SourceLocation(),
4158
                                          SourceLocation(), SourceLocation(),
4159
                                          N),
4160
548
        NumLoops(NumLoops) {}
4161
4162
  /// Set dependency kind.
4163
2.75k
  void setDependencyKind(OpenMPDependClauseKind K) { DepKind = K; }
4164
4165
  /// Set dependency kind and its location.
4166
2.75k
  void setDependencyLoc(SourceLocation Loc) { DepLoc = Loc; }
4167
4168
  /// Set colon location.
4169
2.75k
  void setColonLoc(SourceLocation Loc) { ColonLoc = Loc; }
4170
4171
public:
4172
  /// Creates clause with a list of variables \a VL.
4173
  ///
4174
  /// \param C AST context.
4175
  /// \param StartLoc Starting location of the clause.
4176
  /// \param LParenLoc Location of '('.
4177
  /// \param EndLoc Ending location of the clause.
4178
  /// \param DepKind Dependency type.
4179
  /// \param DepLoc Location of the dependency type.
4180
  /// \param ColonLoc Colon location.
4181
  /// \param VL List of references to the variables.
4182
  /// \param NumLoops Number of loops that is associated with this depend
4183
  /// clause.
4184
  static OMPDependClause *Create(const ASTContext &C, SourceLocation StartLoc,
4185
                                 SourceLocation LParenLoc,
4186
                                 SourceLocation EndLoc,
4187
                                 OpenMPDependClauseKind DepKind,
4188
                                 SourceLocation DepLoc, SourceLocation ColonLoc,
4189
                                 ArrayRef<Expr *> VL, unsigned NumLoops);
4190
4191
  /// Creates an empty clause with \a N variables.
4192
  ///
4193
  /// \param C AST context.
4194
  /// \param N The number of variables.
4195
  /// \param NumLoops Number of loops that is associated with this depend
4196
  /// clause.
4197
  static OMPDependClause *CreateEmpty(const ASTContext &C, unsigned N,
4198
                                      unsigned NumLoops);
4199
4200
  /// Get dependency type.
4201
5.68k
  OpenMPDependClauseKind getDependencyKind() const { return DepKind; }
4202
4203
  /// Get dependency type location.
4204
1.29k
  SourceLocation getDependencyLoc() const { return DepLoc; }
4205
4206
  /// Get colon location.
4207
902
  SourceLocation getColonLoc() const { return ColonLoc; }
4208
4209
  /// Get number of loops associated with the clause.
4210
2.16k
  unsigned getNumLoops() const { return NumLoops; }
4211
4212
  /// Set the loop data for the depend clauses with 'sink|source' kind of
4213
  /// dependency.
4214
  void setLoopData(unsigned NumLoop, Expr *Cnt);
4215
4216
  /// Get the loop data.
4217
  Expr *getLoopData(unsigned NumLoop);
4218
  const Expr *getLoopData(unsigned NumLoop) const;
4219
4220
234
  child_range children() {
4221
234
    return child_range(reinterpret_cast<Stmt **>(varlist_begin()),
4222
234
                       reinterpret_cast<Stmt **>(varlist_end()));
4223
234
  }
4224
4225
0
  const_child_range children() const {
4226
0
    auto Children = const_cast<OMPDependClause *>(this)->children();
4227
0
    return const_child_range(Children.begin(), Children.end());
4228
0
  }
4229
4230
2.60k
  child_range used_children() {
4231
2.60k
    return child_range(child_iterator(), child_iterator());
4232
2.60k
  }
4233
0
  const_child_range used_children() const {
4234
0
    return const_child_range(const_child_iterator(), const_child_iterator());
4235
0
  }
4236
4237
11.5k
  static bool classof(const OMPClause *T) {
4238
11.5k
    return T->getClauseKind() == OMPC_depend;
4239
11.5k
  }
4240
};
4241
4242
/// This represents 'device' clause in the '#pragma omp ...'
4243
/// directive.
4244
///
4245
/// \code
4246
/// #pragma omp target device(a)
4247
/// \endcode
4248
/// In this example directive '#pragma omp target' has clause 'device'
4249
/// with single expression 'a'.
4250
class OMPDeviceClause : public OMPClause, public OMPClauseWithPreInit {
4251
  friend class OMPClauseReader;
4252
4253
  /// Location of '('.
4254
  SourceLocation LParenLoc;
4255
4256
  /// Device number.
4257
  Stmt *Device = nullptr;
4258
4259
  /// Set the device number.
4260
  ///
4261
  /// \param E Device number.
4262
301
  void setDevice(Expr *E) { Device = E; }
4263
4264
public:
4265
  /// Build 'device' clause.
4266
  ///
4267
  /// \param E Expression associated with this clause.
4268
  /// \param CaptureRegion Innermost OpenMP region where expressions in this
4269
  /// clause must be captured.
4270
  /// \param StartLoc Starting location of the clause.
4271
  /// \param LParenLoc Location of '('.
4272
  /// \param EndLoc Ending location of the clause.
4273
  OMPDeviceClause(Expr *E, Stmt *HelperE, OpenMPDirectiveKind CaptureRegion,
4274
                  SourceLocation StartLoc, SourceLocation LParenLoc,
4275
                  SourceLocation EndLoc)
4276
      : OMPClause(OMPC_device, StartLoc, EndLoc), OMPClauseWithPreInit(this),
4277
1.03k
        LParenLoc(LParenLoc), Device(E) {
4278
1.03k
    setPreInitStmt(HelperE, CaptureRegion);
4279
1.03k
  }
4280
4281
  /// Build an empty clause.
4282
  OMPDeviceClause()
4283
      : OMPClause(OMPC_device, SourceLocation(), SourceLocation()),
4284
301
        OMPClauseWithPreInit(this) {}
4285
4286
  /// Sets the location of '('.
4287
301
  void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
4288
4289
  /// Returns the location of '('.
4290
385
  SourceLocation getLParenLoc() const { return LParenLoc; }
4291
4292
  /// Return device number.
4293
417
  Expr *getDevice() { return cast<Expr>(Device); }
4294
4295
  /// Return device number.
4296
966
  Expr *getDevice() const { return cast<Expr>(Device); }
4297
4298
14
  child_range children() { return child_range(&Device, &Device + 1); }
4299
4300
0
  const_child_range children() const {
4301
0
    return const_child_range(&Device, &Device + 1);
4302
0
  }
4303
4304
1.26k
  child_range used_children() {
4305
1.26k
    return child_range(child_iterator(), child_iterator());
4306
1.26k
  }
4307
0
  const_child_range used_children() const {
4308
0
    return const_child_range(const_child_iterator(), const_child_iterator());
4309
0
  }
4310
4311
9.45k
  static bool classof(const OMPClause *T) {
4312
9.45k
    return T->getClauseKind() == OMPC_device;
4313
9.45k
  }
4314
};
4315
4316
/// This represents 'threads' clause in the '#pragma omp ...' directive.
4317
///
4318
/// \code
4319
/// #pragma omp ordered threads
4320
/// \endcode
4321
/// In this example directive '#pragma omp ordered' has simple 'threads' clause.
4322
class OMPThreadsClause : public OMPClause {
4323
public:
4324
  /// Build 'threads' clause.
4325
  ///
4326
  /// \param StartLoc Starting location of the clause.
4327
  /// \param EndLoc Ending location of the clause.
4328
  OMPThreadsClause(SourceLocation