Coverage Report

Created: 2018-11-16 02:38

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