Coverage Report

Created: 2019-07-24 05:18

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