Clang Project

clang_source_code/lib/AST/StmtOpenMP.cpp
1//===--- StmtOpenMP.cpp - Classes for OpenMP directives -------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file implements the subclesses of Stmt class declared in StmtOpenMP.h
10//
11//===----------------------------------------------------------------------===//
12
13#include "clang/AST/StmtOpenMP.h"
14
15#include "clang/AST/ASTContext.h"
16
17using namespace clang;
18
19void OMPExecutableDirective::setClauses(ArrayRef<OMPClause *> Clauses) {
20   (0) . __assert_fail ("Clauses.size() == getNumClauses() && \"Number of clauses is not the same as the preallocated buffer\"", "/home/seafit/code_projects/clang_source/clang/lib/AST/StmtOpenMP.cpp", 21, __PRETTY_FUNCTION__))" file_link="../../../include/assert.h.html#88" macro="true">assert(Clauses.size() == getNumClauses() &&
21 (0) . __assert_fail ("Clauses.size() == getNumClauses() && \"Number of clauses is not the same as the preallocated buffer\"", "/home/seafit/code_projects/clang_source/clang/lib/AST/StmtOpenMP.cpp", 21, __PRETTY_FUNCTION__))" file_link="../../../include/assert.h.html#88" macro="true">         "Number of clauses is not the same as the preallocated buffer");
22  std::copy(Clauses.begin(), Clauses.end(), getClauses().begin());
23}
24
25bool OMPExecutableDirective::isStandaloneDirective() const {
26  // Special case: 'omp target enter data', 'omp target exit data',
27  // 'omp target update' are stand-alone directives, but for implementation
28  // reasons they have empty synthetic structured block, to simplify codegen.
29  if (isa<OMPTargetEnterDataDirective>(this) ||
30      isa<OMPTargetExitDataDirective>(this) ||
31      isa<OMPTargetUpdateDirective>(this))
32    return true;
33  return !hasAssociatedStmt() || !getAssociatedStmt();
34}
35
36const Stmt *OMPExecutableDirective::getStructuredBlock() const {
37   (0) . __assert_fail ("!isStandaloneDirective() && \"Standalone Executable Directives don't have Structured Blocks.\"", "/home/seafit/code_projects/clang_source/clang/lib/AST/StmtOpenMP.cpp", 38, __PRETTY_FUNCTION__))" file_link="../../../include/assert.h.html#88" macro="true">assert(!isStandaloneDirective() &&
38 (0) . __assert_fail ("!isStandaloneDirective() && \"Standalone Executable Directives don't have Structured Blocks.\"", "/home/seafit/code_projects/clang_source/clang/lib/AST/StmtOpenMP.cpp", 38, __PRETTY_FUNCTION__))" file_link="../../../include/assert.h.html#88" macro="true">         "Standalone Executable Directives don't have Structured Blocks.");
39  if (auto *LD = dyn_cast<OMPLoopDirective>(this))
40    return LD->getBody();
41  return getInnermostCapturedStmt()->getCapturedStmt();
42}
43
44void OMPLoopDirective::setCounters(ArrayRef<Expr *> A) {
45   (0) . __assert_fail ("A.size() == getCollapsedNumber() && \"Number of loop counters is not the same as the collapsed number\"", "/home/seafit/code_projects/clang_source/clang/lib/AST/StmtOpenMP.cpp", 46, __PRETTY_FUNCTION__))" file_link="../../../include/assert.h.html#88" macro="true">assert(A.size() == getCollapsedNumber() &&
46 (0) . __assert_fail ("A.size() == getCollapsedNumber() && \"Number of loop counters is not the same as the collapsed number\"", "/home/seafit/code_projects/clang_source/clang/lib/AST/StmtOpenMP.cpp", 46, __PRETTY_FUNCTION__))" file_link="../../../include/assert.h.html#88" macro="true">         "Number of loop counters is not the same as the collapsed number");
47  std::copy(A.begin(), A.end(), getCounters().begin());
48}
49
50void OMPLoopDirective::setPrivateCounters(ArrayRef<Expr *> A) {
51   (0) . __assert_fail ("A.size() == getCollapsedNumber() && \"Number of loop private counters \" \"is not the same as the collapsed \" \"number\"", "/home/seafit/code_projects/clang_source/clang/lib/AST/StmtOpenMP.cpp", 53, __PRETTY_FUNCTION__))" file_link="../../../include/assert.h.html#88" macro="true">assert(A.size() == getCollapsedNumber() && "Number of loop private counters "
52 (0) . __assert_fail ("A.size() == getCollapsedNumber() && \"Number of loop private counters \" \"is not the same as the collapsed \" \"number\"", "/home/seafit/code_projects/clang_source/clang/lib/AST/StmtOpenMP.cpp", 53, __PRETTY_FUNCTION__))" file_link="../../../include/assert.h.html#88" macro="true">                                             "is not the same as the collapsed "
53 (0) . __assert_fail ("A.size() == getCollapsedNumber() && \"Number of loop private counters \" \"is not the same as the collapsed \" \"number\"", "/home/seafit/code_projects/clang_source/clang/lib/AST/StmtOpenMP.cpp", 53, __PRETTY_FUNCTION__))" file_link="../../../include/assert.h.html#88" macro="true">                                             "number");
54  std::copy(A.begin(), A.end(), getPrivateCounters().begin());
55}
56
57void OMPLoopDirective::setInits(ArrayRef<Expr *> A) {
58   (0) . __assert_fail ("A.size() == getCollapsedNumber() && \"Number of counter inits is not the same as the collapsed number\"", "/home/seafit/code_projects/clang_source/clang/lib/AST/StmtOpenMP.cpp", 59, __PRETTY_FUNCTION__))" file_link="../../../include/assert.h.html#88" macro="true">assert(A.size() == getCollapsedNumber() &&
59 (0) . __assert_fail ("A.size() == getCollapsedNumber() && \"Number of counter inits is not the same as the collapsed number\"", "/home/seafit/code_projects/clang_source/clang/lib/AST/StmtOpenMP.cpp", 59, __PRETTY_FUNCTION__))" file_link="../../../include/assert.h.html#88" macro="true">         "Number of counter inits is not the same as the collapsed number");
60  std::copy(A.begin(), A.end(), getInits().begin());
61}
62
63void OMPLoopDirective::setUpdates(ArrayRef<Expr *> A) {
64   (0) . __assert_fail ("A.size() == getCollapsedNumber() && \"Number of counter updates is not the same as the collapsed number\"", "/home/seafit/code_projects/clang_source/clang/lib/AST/StmtOpenMP.cpp", 65, __PRETTY_FUNCTION__))" file_link="../../../include/assert.h.html#88" macro="true">assert(A.size() == getCollapsedNumber() &&
65 (0) . __assert_fail ("A.size() == getCollapsedNumber() && \"Number of counter updates is not the same as the collapsed number\"", "/home/seafit/code_projects/clang_source/clang/lib/AST/StmtOpenMP.cpp", 65, __PRETTY_FUNCTION__))" file_link="../../../include/assert.h.html#88" macro="true">         "Number of counter updates is not the same as the collapsed number");
66  std::copy(A.begin(), A.end(), getUpdates().begin());
67}
68
69void OMPLoopDirective::setFinals(ArrayRef<Expr *> A) {
70   (0) . __assert_fail ("A.size() == getCollapsedNumber() && \"Number of counter finals is not the same as the collapsed number\"", "/home/seafit/code_projects/clang_source/clang/lib/AST/StmtOpenMP.cpp", 71, __PRETTY_FUNCTION__))" file_link="../../../include/assert.h.html#88" macro="true">assert(A.size() == getCollapsedNumber() &&
71 (0) . __assert_fail ("A.size() == getCollapsedNumber() && \"Number of counter finals is not the same as the collapsed number\"", "/home/seafit/code_projects/clang_source/clang/lib/AST/StmtOpenMP.cpp", 71, __PRETTY_FUNCTION__))" file_link="../../../include/assert.h.html#88" macro="true">         "Number of counter finals is not the same as the collapsed number");
72  std::copy(A.begin(), A.end(), getFinals().begin());
73}
74
75OMPParallelDirective *OMPParallelDirective::Create(
76    const ASTContext &CSourceLocation StartLocSourceLocation EndLoc,
77    ArrayRef<OMPClause *> ClausesStmt *AssociatedStmtbool HasCancel) {
78  unsigned Size =
79      llvm::alignTo(sizeof(OMPParallelDirective), alignof(OMPClause *));
80  void *Mem =
81      C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
82  OMPParallelDirective *Dir =
83      new (Mem) OMPParallelDirective(StartLoc, EndLoc, Clauses.size());
84  Dir->setClauses(Clauses);
85  Dir->setAssociatedStmt(AssociatedStmt);
86  Dir->setHasCancel(HasCancel);
87  return Dir;
88}
89
90OMPParallelDirective *OMPParallelDirective::CreateEmpty(const ASTContext &C,
91                                                        unsigned NumClauses,
92                                                        EmptyShell) {
93  unsigned Size =
94      llvm::alignTo(sizeof(OMPParallelDirective), alignof(OMPClause *));
95  void *Mem =
96      C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
97  return new (Mem) OMPParallelDirective(NumClauses);
98}
99
100OMPSimdDirective *
101OMPSimdDirective::Create(const ASTContext &CSourceLocation StartLoc,
102                         SourceLocation EndLocunsigned CollapsedNum,
103                         ArrayRef<OMPClause *> ClausesStmt *AssociatedStmt,
104                         const HelperExprs &Exprs) {
105  unsigned Size = llvm::alignTo(sizeof(OMPSimdDirective), alignof(OMPClause *));
106  void *Mem =
107      C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
108                 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_simd));
109  OMPSimdDirective *Dir = new (Mem)
110      OMPSimdDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
111  Dir->setClauses(Clauses);
112  Dir->setAssociatedStmt(AssociatedStmt);
113  Dir->setIterationVariable(Exprs.IterationVarRef);
114  Dir->setLastIteration(Exprs.LastIteration);
115  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
116  Dir->setPreCond(Exprs.PreCond);
117  Dir->setCond(Exprs.Cond);
118  Dir->setInit(Exprs.Init);
119  Dir->setInc(Exprs.Inc);
120  Dir->setCounters(Exprs.Counters);
121  Dir->setPrivateCounters(Exprs.PrivateCounters);
122  Dir->setInits(Exprs.Inits);
123  Dir->setUpdates(Exprs.Updates);
124  Dir->setFinals(Exprs.Finals);
125  Dir->setPreInits(Exprs.PreInits);
126  return Dir;
127}
128
129OMPSimdDirective *OMPSimdDirective::CreateEmpty(const ASTContext &C,
130                                                unsigned NumClauses,
131                                                unsigned CollapsedNum,
132                                                EmptyShell) {
133  unsigned Size = llvm::alignTo(sizeof(OMPSimdDirective), alignof(OMPClause *));
134  void *Mem =
135      C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
136                 sizeof(Stmt *) * numLoopChildren(CollapsedNumOMPD_simd));
137  return new (Mem) OMPSimdDirective(CollapsedNum, NumClauses);
138}
139
140OMPForDirective *
141OMPForDirective::Create(const ASTContext &CSourceLocation StartLoc,
142                        SourceLocation EndLocunsigned CollapsedNum,
143                        ArrayRef<OMPClause *> ClausesStmt *AssociatedStmt,
144                        const HelperExprs &Exprsbool HasCancel) {
145  unsigned Size = llvm::alignTo(sizeof(OMPForDirective), alignof(OMPClause *));
146  void *Mem =
147      C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
148                 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_for));
149  OMPForDirective *Dir =
150      new (Mem) OMPForDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
151  Dir->setClauses(Clauses);
152  Dir->setAssociatedStmt(AssociatedStmt);
153  Dir->setIterationVariable(Exprs.IterationVarRef);
154  Dir->setLastIteration(Exprs.LastIteration);
155  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
156  Dir->setPreCond(Exprs.PreCond);
157  Dir->setCond(Exprs.Cond);
158  Dir->setInit(Exprs.Init);
159  Dir->setInc(Exprs.Inc);
160  Dir->setIsLastIterVariable(Exprs.IL);
161  Dir->setLowerBoundVariable(Exprs.LB);
162  Dir->setUpperBoundVariable(Exprs.UB);
163  Dir->setStrideVariable(Exprs.ST);
164  Dir->setEnsureUpperBound(Exprs.EUB);
165  Dir->setNextLowerBound(Exprs.NLB);
166  Dir->setNextUpperBound(Exprs.NUB);
167  Dir->setNumIterations(Exprs.NumIterations);
168  Dir->setCounters(Exprs.Counters);
169  Dir->setPrivateCounters(Exprs.PrivateCounters);
170  Dir->setInits(Exprs.Inits);
171  Dir->setUpdates(Exprs.Updates);
172  Dir->setFinals(Exprs.Finals);
173  Dir->setPreInits(Exprs.PreInits);
174  Dir->setHasCancel(HasCancel);
175  return Dir;
176}
177
178OMPForDirective *OMPForDirective::CreateEmpty(const ASTContext &C,
179                                              unsigned NumClauses,
180                                              unsigned CollapsedNum,
181                                              EmptyShell) {
182  unsigned Size = llvm::alignTo(sizeof(OMPForDirective), alignof(OMPClause *));
183  void *Mem =
184      C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
185                 sizeof(Stmt *) * numLoopChildren(CollapsedNumOMPD_for));
186  return new (Mem) OMPForDirective(CollapsedNum, NumClauses);
187}
188
189OMPForSimdDirective *
190OMPForSimdDirective::Create(const ASTContext &CSourceLocation StartLoc,
191                            SourceLocation EndLocunsigned CollapsedNum,
192                            ArrayRef<OMPClause *> ClausesStmt *AssociatedStmt,
193                            const HelperExprs &Exprs) {
194  unsigned Size =
195      llvm::alignTo(sizeof(OMPForSimdDirective), alignof(OMPClause *));
196  void *Mem =
197      C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
198                 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_for_simd));
199  OMPForSimdDirective *Dir = new (Mem)
200      OMPForSimdDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
201  Dir->setClauses(Clauses);
202  Dir->setAssociatedStmt(AssociatedStmt);
203  Dir->setIterationVariable(Exprs.IterationVarRef);
204  Dir->setLastIteration(Exprs.LastIteration);
205  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
206  Dir->setPreCond(Exprs.PreCond);
207  Dir->setCond(Exprs.Cond);
208  Dir->setInit(Exprs.Init);
209  Dir->setInc(Exprs.Inc);
210  Dir->setIsLastIterVariable(Exprs.IL);
211  Dir->setLowerBoundVariable(Exprs.LB);
212  Dir->setUpperBoundVariable(Exprs.UB);
213  Dir->setStrideVariable(Exprs.ST);
214  Dir->setEnsureUpperBound(Exprs.EUB);
215  Dir->setNextLowerBound(Exprs.NLB);
216  Dir->setNextUpperBound(Exprs.NUB);
217  Dir->setNumIterations(Exprs.NumIterations);
218  Dir->setCounters(Exprs.Counters);
219  Dir->setPrivateCounters(Exprs.PrivateCounters);
220  Dir->setInits(Exprs.Inits);
221  Dir->setUpdates(Exprs.Updates);
222  Dir->setFinals(Exprs.Finals);
223  Dir->setPreInits(Exprs.PreInits);
224  return Dir;
225}
226
227OMPForSimdDirective *OMPForSimdDirective::CreateEmpty(const ASTContext &C,
228                                                      unsigned NumClauses,
229                                                      unsigned CollapsedNum,
230                                                      EmptyShell) {
231  unsigned Size =
232      llvm::alignTo(sizeof(OMPForSimdDirective), alignof(OMPClause *));
233  void *Mem =
234      C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
235                 sizeof(Stmt *) * numLoopChildren(CollapsedNumOMPD_for_simd));
236  return new (Mem) OMPForSimdDirective(CollapsedNum, NumClauses);
237}
238
239OMPSectionsDirective *OMPSectionsDirective::Create(
240    const ASTContext &CSourceLocation StartLocSourceLocation EndLoc,
241    ArrayRef<OMPClause *> ClausesStmt *AssociatedStmtbool HasCancel) {
242  unsigned Size =
243      llvm::alignTo(sizeof(OMPSectionsDirective), alignof(OMPClause *));
244  void *Mem =
245      C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
246  OMPSectionsDirective *Dir =
247      new (Mem) OMPSectionsDirective(StartLoc, EndLoc, Clauses.size());
248  Dir->setClauses(Clauses);
249  Dir->setAssociatedStmt(AssociatedStmt);
250  Dir->setHasCancel(HasCancel);
251  return Dir;
252}
253
254OMPSectionsDirective *OMPSectionsDirective::CreateEmpty(const ASTContext &C,
255                                                        unsigned NumClauses,
256                                                        EmptyShell) {
257  unsigned Size =
258      llvm::alignTo(sizeof(OMPSectionsDirective), alignof(OMPClause *));
259  void *Mem =
260      C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
261  return new (Mem) OMPSectionsDirective(NumClauses);
262}
263
264OMPSectionDirective *OMPSectionDirective::Create(const ASTContext &C,
265                                                 SourceLocation StartLoc,
266                                                 SourceLocation EndLoc,
267                                                 Stmt *AssociatedStmt,
268                                                 bool HasCancel) {
269  unsigned Size = llvm::alignTo(sizeof(OMPSectionDirective), alignof(Stmt *));
270  void *Mem = C.Allocate(Size + sizeof(Stmt *));
271  OMPSectionDirective *Dir = new (Mem) OMPSectionDirective(StartLoc, EndLoc);
272  Dir->setAssociatedStmt(AssociatedStmt);
273  Dir->setHasCancel(HasCancel);
274  return Dir;
275}
276
277OMPSectionDirective *OMPSectionDirective::CreateEmpty(const ASTContext &C,
278                                                      EmptyShell) {
279  unsigned Size = llvm::alignTo(sizeof(OMPSectionDirective), alignof(Stmt *));
280  void *Mem = C.Allocate(Size + sizeof(Stmt *));
281  return new (Mem) OMPSectionDirective();
282}
283
284OMPSingleDirective *OMPSingleDirective::Create(const ASTContext &C,
285                                               SourceLocation StartLoc,
286                                               SourceLocation EndLoc,
287                                               ArrayRef<OMPClause *> Clauses,
288                                               Stmt *AssociatedStmt) {
289  unsigned Size =
290      llvm::alignTo(sizeof(OMPSingleDirective), alignof(OMPClause *));
291  void *Mem =
292      C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
293  OMPSingleDirective *Dir =
294      new (Mem) OMPSingleDirective(StartLoc, EndLoc, Clauses.size());
295  Dir->setClauses(Clauses);
296  Dir->setAssociatedStmt(AssociatedStmt);
297  return Dir;
298}
299
300OMPSingleDirective *OMPSingleDirective::CreateEmpty(const ASTContext &C,
301                                                    unsigned NumClauses,
302                                                    EmptyShell) {
303  unsigned Size =
304      llvm::alignTo(sizeof(OMPSingleDirective), alignof(OMPClause *));
305  void *Mem =
306      C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
307  return new (Mem) OMPSingleDirective(NumClauses);
308}
309
310OMPMasterDirective *OMPMasterDirective::Create(const ASTContext &C,
311                                               SourceLocation StartLoc,
312                                               SourceLocation EndLoc,
313                                               Stmt *AssociatedStmt) {
314  unsigned Size = llvm::alignTo(sizeof(OMPMasterDirective), alignof(Stmt *));
315  void *Mem = C.Allocate(Size + sizeof(Stmt *));
316  OMPMasterDirective *Dir = new (Mem) OMPMasterDirective(StartLoc, EndLoc);
317  Dir->setAssociatedStmt(AssociatedStmt);
318  return Dir;
319}
320
321OMPMasterDirective *OMPMasterDirective::CreateEmpty(const ASTContext &C,
322                                                    EmptyShell) {
323  unsigned Size = llvm::alignTo(sizeof(OMPMasterDirective), alignof(Stmt *));
324  void *Mem = C.Allocate(Size + sizeof(Stmt *));
325  return new (Mem) OMPMasterDirective();
326}
327
328OMPCriticalDirective *OMPCriticalDirective::Create(
329    const ASTContext &Cconst DeclarationNameInfo &Name,
330    SourceLocation StartLocSourceLocation EndLoc,
331    ArrayRef<OMPClause *> ClausesStmt *AssociatedStmt) {
332  unsigned Size =
333      llvm::alignTo(sizeof(OMPCriticalDirective), alignof(OMPClause *));
334  void *Mem =
335      C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
336  OMPCriticalDirective *Dir =
337      new (Mem) OMPCriticalDirective(Name, StartLoc, EndLoc, Clauses.size());
338  Dir->setClauses(Clauses);
339  Dir->setAssociatedStmt(AssociatedStmt);
340  return Dir;
341}
342
343OMPCriticalDirective *OMPCriticalDirective::CreateEmpty(const ASTContext &C,
344                                                        unsigned NumClauses,
345                                                        EmptyShell) {
346  unsigned Size =
347      llvm::alignTo(sizeof(OMPCriticalDirective), alignof(OMPClause *));
348  void *Mem =
349      C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
350  return new (Mem) OMPCriticalDirective(NumClauses);
351}
352
353OMPParallelForDirective *OMPParallelForDirective::Create(
354    const ASTContext &CSourceLocation StartLocSourceLocation EndLoc,
355    unsigned CollapsedNumArrayRef<OMPClause *> ClausesStmt *AssociatedStmt,
356    const HelperExprs &Exprsbool HasCancel) {
357  unsigned Size =
358      llvm::alignTo(sizeof(OMPParallelForDirective), alignof(OMPClause *));
359  void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
360                         sizeof(Stmt *) *
361                             numLoopChildren(CollapsedNum, OMPD_parallel_for));
362  OMPParallelForDirective *Dir = new (Mem)
363      OMPParallelForDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
364  Dir->setClauses(Clauses);
365  Dir->setAssociatedStmt(AssociatedStmt);
366  Dir->setIterationVariable(Exprs.IterationVarRef);
367  Dir->setLastIteration(Exprs.LastIteration);
368  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
369  Dir->setPreCond(Exprs.PreCond);
370  Dir->setCond(Exprs.Cond);
371  Dir->setInit(Exprs.Init);
372  Dir->setInc(Exprs.Inc);
373  Dir->setIsLastIterVariable(Exprs.IL);
374  Dir->setLowerBoundVariable(Exprs.LB);
375  Dir->setUpperBoundVariable(Exprs.UB);
376  Dir->setStrideVariable(Exprs.ST);
377  Dir->setEnsureUpperBound(Exprs.EUB);
378  Dir->setNextLowerBound(Exprs.NLB);
379  Dir->setNextUpperBound(Exprs.NUB);
380  Dir->setNumIterations(Exprs.NumIterations);
381  Dir->setCounters(Exprs.Counters);
382  Dir->setPrivateCounters(Exprs.PrivateCounters);
383  Dir->setInits(Exprs.Inits);
384  Dir->setUpdates(Exprs.Updates);
385  Dir->setFinals(Exprs.Finals);
386  Dir->setPreInits(Exprs.PreInits);
387  Dir->setHasCancel(HasCancel);
388  return Dir;
389}
390
391OMPParallelForDirective *
392OMPParallelForDirective::CreateEmpty(const ASTContext &Cunsigned NumClauses,
393                                     unsigned CollapsedNumEmptyShell) {
394  unsigned Size =
395      llvm::alignTo(sizeof(OMPParallelForDirective), alignof(OMPClause *));
396  void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
397                         sizeof(Stmt *) *
398                             numLoopChildren(CollapsedNumOMPD_parallel_for));
399  return new (Mem) OMPParallelForDirective(CollapsedNum, NumClauses);
400}
401
402OMPParallelForSimdDirective *OMPParallelForSimdDirective::Create(
403    const ASTContext &CSourceLocation StartLocSourceLocation EndLoc,
404    unsigned CollapsedNumArrayRef<OMPClause *> ClausesStmt *AssociatedStmt,
405    const HelperExprs &Exprs) {
406  unsigned Size =
407      llvm::alignTo(sizeof(OMPParallelForSimdDirective), alignof(OMPClause *));
408  void *Mem = C.Allocate(
409      Size + sizeof(OMPClause *) * Clauses.size() +
410      sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_parallel_for_simd));
411  OMPParallelForSimdDirective *Dir = new (Mem) OMPParallelForSimdDirective(
412      StartLoc, EndLoc, CollapsedNum, Clauses.size());
413  Dir->setClauses(Clauses);
414  Dir->setAssociatedStmt(AssociatedStmt);
415  Dir->setIterationVariable(Exprs.IterationVarRef);
416  Dir->setLastIteration(Exprs.LastIteration);
417  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
418  Dir->setPreCond(Exprs.PreCond);
419  Dir->setCond(Exprs.Cond);
420  Dir->setInit(Exprs.Init);
421  Dir->setInc(Exprs.Inc);
422  Dir->setIsLastIterVariable(Exprs.IL);
423  Dir->setLowerBoundVariable(Exprs.LB);
424  Dir->setUpperBoundVariable(Exprs.UB);
425  Dir->setStrideVariable(Exprs.ST);
426  Dir->setEnsureUpperBound(Exprs.EUB);
427  Dir->setNextLowerBound(Exprs.NLB);
428  Dir->setNextUpperBound(Exprs.NUB);
429  Dir->setNumIterations(Exprs.NumIterations);
430  Dir->setCounters(Exprs.Counters);
431  Dir->setPrivateCounters(Exprs.PrivateCounters);
432  Dir->setInits(Exprs.Inits);
433  Dir->setUpdates(Exprs.Updates);
434  Dir->setFinals(Exprs.Finals);
435  Dir->setPreInits(Exprs.PreInits);
436  return Dir;
437}
438
439OMPParallelForSimdDirective *
440OMPParallelForSimdDirective::CreateEmpty(const ASTContext &C,
441                                         unsigned NumClauses,
442                                         unsigned CollapsedNumEmptyShell) {
443  unsigned Size =
444      llvm::alignTo(sizeof(OMPParallelForSimdDirective), alignof(OMPClause *));
445  void *Mem = C.Allocate(
446      Size + sizeof(OMPClause *) * NumClauses +
447      sizeof(Stmt *) * numLoopChildren(CollapsedNumOMPD_parallel_for_simd));
448  return new (Mem) OMPParallelForSimdDirective(CollapsedNum, NumClauses);
449}
450
451OMPParallelSectionsDirective *OMPParallelSectionsDirective::Create(
452    const ASTContext &CSourceLocation StartLocSourceLocation EndLoc,
453    ArrayRef<OMPClause *> ClausesStmt *AssociatedStmtbool HasCancel) {
454  unsigned Size =
455      llvm::alignTo(sizeof(OMPParallelSectionsDirective), alignof(OMPClause *));
456  void *Mem =
457      C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
458  OMPParallelSectionsDirective *Dir =
459      new (Mem) OMPParallelSectionsDirective(StartLoc, EndLoc, Clauses.size());
460  Dir->setClauses(Clauses);
461  Dir->setAssociatedStmt(AssociatedStmt);
462  Dir->setHasCancel(HasCancel);
463  return Dir;
464}
465
466OMPParallelSectionsDirective *
467OMPParallelSectionsDirective::CreateEmpty(const ASTContext &C,
468                                          unsigned NumClausesEmptyShell) {
469  unsigned Size =
470      llvm::alignTo(sizeof(OMPParallelSectionsDirective), alignof(OMPClause *));
471  void *Mem =
472      C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
473  return new (Mem) OMPParallelSectionsDirective(NumClauses);
474}
475
476OMPTaskDirective *
477OMPTaskDirective::Create(const ASTContext &CSourceLocation StartLoc,
478                         SourceLocation EndLocArrayRef<OMPClause *> Clauses,
479                         Stmt *AssociatedStmtbool HasCancel) {
480  unsigned Size = llvm::alignTo(sizeof(OMPTaskDirective), alignof(OMPClause *));
481  void *Mem =
482      C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
483  OMPTaskDirective *Dir =
484      new (Mem) OMPTaskDirective(StartLoc, EndLoc, Clauses.size());
485  Dir->setClauses(Clauses);
486  Dir->setAssociatedStmt(AssociatedStmt);
487  Dir->setHasCancel(HasCancel);
488  return Dir;
489}
490
491OMPTaskDirective *OMPTaskDirective::CreateEmpty(const ASTContext &C,
492                                                unsigned NumClauses,
493                                                EmptyShell) {
494  unsigned Size = llvm::alignTo(sizeof(OMPTaskDirective), alignof(OMPClause *));
495  void *Mem =
496      C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
497  return new (Mem) OMPTaskDirective(NumClauses);
498}
499
500OMPTaskyieldDirective *OMPTaskyieldDirective::Create(const ASTContext &C,
501                                                     SourceLocation StartLoc,
502                                                     SourceLocation EndLoc) {
503  void *Mem = C.Allocate(sizeof(OMPTaskyieldDirective));
504  OMPTaskyieldDirective *Dir =
505      new (Mem) OMPTaskyieldDirective(StartLoc, EndLoc);
506  return Dir;
507}
508
509OMPTaskyieldDirective *OMPTaskyieldDirective::CreateEmpty(const ASTContext &C,
510                                                          EmptyShell) {
511  void *Mem = C.Allocate(sizeof(OMPTaskyieldDirective));
512  return new (Mem) OMPTaskyieldDirective();
513}
514
515OMPBarrierDirective *OMPBarrierDirective::Create(const ASTContext &C,
516                                                 SourceLocation StartLoc,
517                                                 SourceLocation EndLoc) {
518  void *Mem = C.Allocate(sizeof(OMPBarrierDirective));
519  OMPBarrierDirective *Dir = new (Mem) OMPBarrierDirective(StartLoc, EndLoc);
520  return Dir;
521}
522
523OMPBarrierDirective *OMPBarrierDirective::CreateEmpty(const ASTContext &C,
524                                                      EmptyShell) {
525  void *Mem = C.Allocate(sizeof(OMPBarrierDirective));
526  return new (Mem) OMPBarrierDirective();
527}
528
529OMPTaskwaitDirective *OMPTaskwaitDirective::Create(const ASTContext &C,
530                                                   SourceLocation StartLoc,
531                                                   SourceLocation EndLoc) {
532  void *Mem = C.Allocate(sizeof(OMPTaskwaitDirective));
533  OMPTaskwaitDirective *Dir = new (Mem) OMPTaskwaitDirective(StartLoc, EndLoc);
534  return Dir;
535}
536
537OMPTaskwaitDirective *OMPTaskwaitDirective::CreateEmpty(const ASTContext &C,
538                                                        EmptyShell) {
539  void *Mem = C.Allocate(sizeof(OMPTaskwaitDirective));
540  return new (Mem) OMPTaskwaitDirective();
541}
542
543OMPTaskgroupDirective *OMPTaskgroupDirective::Create(
544    const ASTContext &CSourceLocation StartLocSourceLocation EndLoc,
545    ArrayRef<OMPClause *> ClausesStmt *AssociatedStmtExpr *ReductionRef) {
546  unsigned Size = llvm::alignTo(sizeof(OMPTaskgroupDirective) +
547                                    sizeof(OMPClause *) * Clauses.size(),
548                                alignof(Stmt *));
549  void *Mem = C.Allocate(Size + sizeof(Stmt *) + sizeof(Expr *));
550  OMPTaskgroupDirective *Dir =
551      new (Mem) OMPTaskgroupDirective(StartLoc, EndLoc, Clauses.size());
552  Dir->setAssociatedStmt(AssociatedStmt);
553  Dir->setReductionRef(ReductionRef);
554  Dir->setClauses(Clauses);
555  return Dir;
556}
557
558OMPTaskgroupDirective *OMPTaskgroupDirective::CreateEmpty(const ASTContext &C,
559                                                          unsigned NumClauses,
560                                                          EmptyShell) {
561  unsigned Size = llvm::alignTo(sizeof(OMPTaskgroupDirective) +
562                                    sizeof(OMPClause *) * NumClauses,
563                                alignof(Stmt *));
564  void *Mem = C.Allocate(Size + sizeof(Stmt *) + sizeof(Expr *));
565  return new (Mem) OMPTaskgroupDirective(NumClauses);
566}
567
568OMPCancellationPointDirective *OMPCancellationPointDirective::Create(
569    const ASTContext &CSourceLocation StartLocSourceLocation EndLoc,
570    OpenMPDirectiveKind CancelRegion) {
571  unsigned Size =
572      llvm::alignTo(sizeof(OMPCancellationPointDirective), alignof(Stmt *));
573  void *Mem = C.Allocate(Size);
574  OMPCancellationPointDirective *Dir =
575      new (Mem) OMPCancellationPointDirective(StartLoc, EndLoc);
576  Dir->setCancelRegion(CancelRegion);
577  return Dir;
578}
579
580OMPCancellationPointDirective *
581OMPCancellationPointDirective::CreateEmpty(const ASTContext &CEmptyShell) {
582  unsigned Size =
583      llvm::alignTo(sizeof(OMPCancellationPointDirective), alignof(Stmt *));
584  void *Mem = C.Allocate(Size);
585  return new (Mem) OMPCancellationPointDirective();
586}
587
588OMPCancelDirective *
589OMPCancelDirective::Create(const ASTContext &CSourceLocation StartLoc,
590                           SourceLocation EndLocArrayRef<OMPClause *> Clauses,
591                           OpenMPDirectiveKind CancelRegion) {
592  unsigned Size = llvm::alignTo(sizeof(OMPCancelDirective) +
593                                    sizeof(OMPClause *) * Clauses.size(),
594                                alignof(Stmt *));
595  void *Mem = C.Allocate(Size);
596  OMPCancelDirective *Dir =
597      new (Mem) OMPCancelDirective(StartLoc, EndLoc, Clauses.size());
598  Dir->setClauses(Clauses);
599  Dir->setCancelRegion(CancelRegion);
600  return Dir;
601}
602
603OMPCancelDirective *OMPCancelDirective::CreateEmpty(const ASTContext &C,
604                                                    unsigned NumClauses,
605                                                    EmptyShell) {
606  unsigned Size = llvm::alignTo(sizeof(OMPCancelDirective) +
607                                    sizeof(OMPClause *) * NumClauses,
608                                alignof(Stmt *));
609  void *Mem = C.Allocate(Size);
610  return new (Mem) OMPCancelDirective(NumClauses);
611}
612
613OMPFlushDirective *OMPFlushDirective::Create(const ASTContext &C,
614                                             SourceLocation StartLoc,
615                                             SourceLocation EndLoc,
616                                             ArrayRef<OMPClause *> Clauses) {
617  unsigned Size =
618      llvm::alignTo(sizeof(OMPFlushDirective), alignof(OMPClause *));
619  void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size());
620  OMPFlushDirective *Dir =
621      new (Mem) OMPFlushDirective(StartLoc, EndLoc, Clauses.size());
622  Dir->setClauses(Clauses);
623  return Dir;
624}
625
626OMPFlushDirective *OMPFlushDirective::CreateEmpty(const ASTContext &C,
627                                                  unsigned NumClauses,
628                                                  EmptyShell) {
629  unsigned Size =
630      llvm::alignTo(sizeof(OMPFlushDirective), alignof(OMPClause *));
631  void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses);
632  return new (Mem) OMPFlushDirective(NumClauses);
633}
634
635OMPOrderedDirective *OMPOrderedDirective::Create(const ASTContext &C,
636                                                 SourceLocation StartLoc,
637                                                 SourceLocation EndLoc,
638                                                 ArrayRef<OMPClause *> Clauses,
639                                                 Stmt *AssociatedStmt) {
640  unsigned Size =
641      llvm::alignTo(sizeof(OMPOrderedDirective), alignof(OMPClause *));
642  void *Mem =
643      C.Allocate(Size + sizeof(Stmt *) + sizeof(OMPClause *) * Clauses.size());
644  OMPOrderedDirective *Dir =
645      new (Mem) OMPOrderedDirective(StartLoc, EndLoc, Clauses.size());
646  Dir->setClauses(Clauses);
647  Dir->setAssociatedStmt(AssociatedStmt);
648  return Dir;
649}
650
651OMPOrderedDirective *OMPOrderedDirective::CreateEmpty(const ASTContext &C,
652                                                      unsigned NumClauses,
653                                                      EmptyShell) {
654  unsigned Size =
655      llvm::alignTo(sizeof(OMPOrderedDirective), alignof(OMPClause *));
656  void *Mem =
657      C.Allocate(Size + sizeof(Stmt *) + sizeof(OMPClause *) * NumClauses);
658  return new (Mem) OMPOrderedDirective(NumClauses);
659}
660
661OMPAtomicDirective *OMPAtomicDirective::Create(
662    const ASTContext &CSourceLocation StartLocSourceLocation EndLoc,
663    ArrayRef<OMPClause *> ClausesStmt *AssociatedStmtExpr *XExpr *V,
664    Expr *EExpr *UEbool IsXLHSInRHSPartbool IsPostfixUpdate) {
665  unsigned Size =
666      llvm::alignTo(sizeof(OMPAtomicDirective), alignof(OMPClause *));
667  void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
668                         5 * sizeof(Stmt *));
669  OMPAtomicDirective *Dir =
670      new (Mem) OMPAtomicDirective(StartLoc, EndLoc, Clauses.size());
671  Dir->setClauses(Clauses);
672  Dir->setAssociatedStmt(AssociatedStmt);
673  Dir->setX(X);
674  Dir->setV(V);
675  Dir->setExpr(E);
676  Dir->setUpdateExpr(UE);
677  Dir->IsXLHSInRHSPart = IsXLHSInRHSPart;
678  Dir->IsPostfixUpdate = IsPostfixUpdate;
679  return Dir;
680}
681
682OMPAtomicDirective *OMPAtomicDirective::CreateEmpty(const ASTContext &C,
683                                                    unsigned NumClauses,
684                                                    EmptyShell) {
685  unsigned Size =
686      llvm::alignTo(sizeof(OMPAtomicDirective), alignof(OMPClause *));
687  void *Mem =
688      C.Allocate(Size + sizeof(OMPClause *) * NumClauses + 5 * sizeof(Stmt *));
689  return new (Mem) OMPAtomicDirective(NumClauses);
690}
691
692OMPTargetDirective *OMPTargetDirective::Create(const ASTContext &C,
693                                               SourceLocation StartLoc,
694                                               SourceLocation EndLoc,
695                                               ArrayRef<OMPClause *> Clauses,
696                                               Stmt *AssociatedStmt) {
697  unsigned Size =
698      llvm::alignTo(sizeof(OMPTargetDirective), alignof(OMPClause *));
699  void *Mem =
700      C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
701  OMPTargetDirective *Dir =
702      new (Mem) OMPTargetDirective(StartLoc, EndLoc, Clauses.size());
703  Dir->setClauses(Clauses);
704  Dir->setAssociatedStmt(AssociatedStmt);
705  return Dir;
706}
707
708OMPTargetDirective *OMPTargetDirective::CreateEmpty(const ASTContext &C,
709                                                    unsigned NumClauses,
710                                                    EmptyShell) {
711  unsigned Size =
712      llvm::alignTo(sizeof(OMPTargetDirective), alignof(OMPClause *));
713  void *Mem =
714      C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
715  return new (Mem) OMPTargetDirective(NumClauses);
716}
717
718OMPTargetParallelDirective *OMPTargetParallelDirective::Create(
719    const ASTContext &CSourceLocation StartLocSourceLocation EndLoc,
720    ArrayRef<OMPClause *> ClausesStmt *AssociatedStmt) {
721  unsigned Size =
722      llvm::alignTo(sizeof(OMPTargetParallelDirective), alignof(OMPClause *));
723  void *Mem =
724      C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
725  OMPTargetParallelDirective *Dir =
726      new (Mem) OMPTargetParallelDirective(StartLoc, EndLoc, Clauses.size());
727  Dir->setClauses(Clauses);
728  Dir->setAssociatedStmt(AssociatedStmt);
729  return Dir;
730}
731
732OMPTargetParallelDirective *
733OMPTargetParallelDirective::CreateEmpty(const ASTContext &C,
734                                        unsigned NumClausesEmptyShell) {
735  unsigned Size =
736      llvm::alignTo(sizeof(OMPTargetParallelDirective), alignof(OMPClause *));
737  void *Mem =
738      C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
739  return new (Mem) OMPTargetParallelDirective(NumClauses);
740}
741
742OMPTargetParallelForDirective *OMPTargetParallelForDirective::Create(
743    const ASTContext &CSourceLocation StartLocSourceLocation EndLoc,
744    unsigned CollapsedNumArrayRef<OMPClause *> ClausesStmt *AssociatedStmt,
745    const HelperExprs &Exprsbool HasCancel) {
746  unsigned Size = llvm::alignTo(sizeof(OMPTargetParallelForDirective),
747                                alignof(OMPClause *));
748  void *Mem = C.Allocate(
749      Size + sizeof(OMPClause *) * Clauses.size() +
750      sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_target_parallel_for));
751  OMPTargetParallelForDirective *Dir = new (Mem) OMPTargetParallelForDirective(
752      StartLoc, EndLoc, CollapsedNum, Clauses.size());
753  Dir->setClauses(Clauses);
754  Dir->setAssociatedStmt(AssociatedStmt);
755  Dir->setIterationVariable(Exprs.IterationVarRef);
756  Dir->setLastIteration(Exprs.LastIteration);
757  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
758  Dir->setPreCond(Exprs.PreCond);
759  Dir->setCond(Exprs.Cond);
760  Dir->setInit(Exprs.Init);
761  Dir->setInc(Exprs.Inc);
762  Dir->setIsLastIterVariable(Exprs.IL);
763  Dir->setLowerBoundVariable(Exprs.LB);
764  Dir->setUpperBoundVariable(Exprs.UB);
765  Dir->setStrideVariable(Exprs.ST);
766  Dir->setEnsureUpperBound(Exprs.EUB);
767  Dir->setNextLowerBound(Exprs.NLB);
768  Dir->setNextUpperBound(Exprs.NUB);
769  Dir->setNumIterations(Exprs.NumIterations);
770  Dir->setCounters(Exprs.Counters);
771  Dir->setPrivateCounters(Exprs.PrivateCounters);
772  Dir->setInits(Exprs.Inits);
773  Dir->setUpdates(Exprs.Updates);
774  Dir->setFinals(Exprs.Finals);
775  Dir->setPreInits(Exprs.PreInits);
776  Dir->setHasCancel(HasCancel);
777  return Dir;
778}
779
780OMPTargetParallelForDirective *
781OMPTargetParallelForDirective::CreateEmpty(const ASTContext &C,
782                                           unsigned NumClauses,
783                                           unsigned CollapsedNumEmptyShell) {
784  unsigned Size = llvm::alignTo(sizeof(OMPTargetParallelForDirective),
785                                alignof(OMPClause *));
786  void *Mem = C.Allocate(
787      Size + sizeof(OMPClause *) * NumClauses +
788      sizeof(Stmt *) * numLoopChildren(CollapsedNumOMPD_target_parallel_for));
789  return new (Mem) OMPTargetParallelForDirective(CollapsedNum, NumClauses);
790}
791
792OMPTargetDataDirective *OMPTargetDataDirective::Create(
793    const ASTContext &CSourceLocation StartLocSourceLocation EndLoc,
794    ArrayRef<OMPClause *> ClausesStmt *AssociatedStmt) {
795  void *Mem = C.Allocate(
796      llvm::alignTo(sizeof(OMPTargetDataDirective), alignof(OMPClause *)) +
797      sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
798  OMPTargetDataDirective *Dir =
799      new (Mem) OMPTargetDataDirective(StartLoc, EndLoc, Clauses.size());
800  Dir->setClauses(Clauses);
801  Dir->setAssociatedStmt(AssociatedStmt);
802  return Dir;
803}
804
805OMPTargetDataDirective *OMPTargetDataDirective::CreateEmpty(const ASTContext &C,
806                                                            unsigned N,
807                                                            EmptyShell) {
808  void *Mem = C.Allocate(
809      llvm::alignTo(sizeof(OMPTargetDataDirective), alignof(OMPClause *)) +
810      sizeof(OMPClause *) * N + sizeof(Stmt *));
811  return new (Mem) OMPTargetDataDirective(N);
812}
813
814OMPTargetEnterDataDirective *OMPTargetEnterDataDirective::Create(
815    const ASTContext &CSourceLocation StartLocSourceLocation EndLoc,
816    ArrayRef<OMPClause *> ClausesStmt *AssociatedStmt) {
817  void *Mem = C.Allocate(
818      llvm::alignTo(sizeof(OMPTargetEnterDataDirective), alignof(OMPClause *)) +
819      sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
820  OMPTargetEnterDataDirective *Dir =
821      new (Mem) OMPTargetEnterDataDirective(StartLoc, EndLoc, Clauses.size());
822  Dir->setClauses(Clauses);
823  Dir->setAssociatedStmt(AssociatedStmt);
824  return Dir;
825}
826
827OMPTargetEnterDataDirective *
828OMPTargetEnterDataDirective::CreateEmpty(const ASTContext &Cunsigned N,
829                                         EmptyShell) {
830  void *Mem = C.Allocate(
831      llvm::alignTo(sizeof(OMPTargetEnterDataDirective), alignof(OMPClause *)) +
832      sizeof(OMPClause *) * N + sizeof(Stmt *));
833  return new (Mem) OMPTargetEnterDataDirective(N);
834}
835
836OMPTargetExitDataDirective *OMPTargetExitDataDirective::Create(
837    const ASTContext &CSourceLocation StartLocSourceLocation EndLoc,
838    ArrayRef<OMPClause *> ClausesStmt *AssociatedStmt) {
839  void *Mem = C.Allocate(
840      llvm::alignTo(sizeof(OMPTargetExitDataDirective), alignof(OMPClause *)) +
841      sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
842  OMPTargetExitDataDirective *Dir =
843      new (Mem) OMPTargetExitDataDirective(StartLoc, EndLoc, Clauses.size());
844  Dir->setClauses(Clauses);
845  Dir->setAssociatedStmt(AssociatedStmt);
846  return Dir;
847}
848
849OMPTargetExitDataDirective *
850OMPTargetExitDataDirective::CreateEmpty(const ASTContext &Cunsigned N,
851                                        EmptyShell) {
852  void *Mem = C.Allocate(
853      llvm::alignTo(sizeof(OMPTargetExitDataDirective), alignof(OMPClause *)) +
854      sizeof(OMPClause *) * N + sizeof(Stmt *));
855  return new (Mem) OMPTargetExitDataDirective(N);
856}
857
858OMPTeamsDirective *OMPTeamsDirective::Create(const ASTContext &C,
859                                             SourceLocation StartLoc,
860                                             SourceLocation EndLoc,
861                                             ArrayRef<OMPClause *> Clauses,
862                                             Stmt *AssociatedStmt) {
863  unsigned Size =
864      llvm::alignTo(sizeof(OMPTeamsDirective), alignof(OMPClause *));
865  void *Mem =
866      C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
867  OMPTeamsDirective *Dir =
868      new (Mem) OMPTeamsDirective(StartLoc, EndLoc, Clauses.size());
869  Dir->setClauses(Clauses);
870  Dir->setAssociatedStmt(AssociatedStmt);
871  return Dir;
872}
873
874OMPTeamsDirective *OMPTeamsDirective::CreateEmpty(const ASTContext &C,
875                                                  unsigned NumClauses,
876                                                  EmptyShell) {
877  unsigned Size =
878      llvm::alignTo(sizeof(OMPTeamsDirective), alignof(OMPClause *));
879  void *Mem =
880      C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
881  return new (Mem) OMPTeamsDirective(NumClauses);
882}
883
884OMPTaskLoopDirective *OMPTaskLoopDirective::Create(
885    const ASTContext &CSourceLocation StartLocSourceLocation EndLoc,
886    unsigned CollapsedNumArrayRef<OMPClause *> ClausesStmt *AssociatedStmt,
887    const HelperExprs &Exprs) {
888  unsigned Size =
889      llvm::alignTo(sizeof(OMPTaskLoopDirective), alignof(OMPClause *));
890  void *Mem =
891      C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
892                 sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_taskloop));
893  OMPTaskLoopDirective *Dir = new (Mem)
894      OMPTaskLoopDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
895  Dir->setClauses(Clauses);
896  Dir->setAssociatedStmt(AssociatedStmt);
897  Dir->setIterationVariable(Exprs.IterationVarRef);
898  Dir->setLastIteration(Exprs.LastIteration);
899  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
900  Dir->setPreCond(Exprs.PreCond);
901  Dir->setCond(Exprs.Cond);
902  Dir->setInit(Exprs.Init);
903  Dir->setInc(Exprs.Inc);
904  Dir->setIsLastIterVariable(Exprs.IL);
905  Dir->setLowerBoundVariable(Exprs.LB);
906  Dir->setUpperBoundVariable(Exprs.UB);
907  Dir->setStrideVariable(Exprs.ST);
908  Dir->setEnsureUpperBound(Exprs.EUB);
909  Dir->setNextLowerBound(Exprs.NLB);
910  Dir->setNextUpperBound(Exprs.NUB);
911  Dir->setNumIterations(Exprs.NumIterations);
912  Dir->setCounters(Exprs.Counters);
913  Dir->setPrivateCounters(Exprs.PrivateCounters);
914  Dir->setInits(Exprs.Inits);
915  Dir->setUpdates(Exprs.Updates);
916  Dir->setFinals(Exprs.Finals);
917  Dir->setPreInits(Exprs.PreInits);
918  return Dir;
919}
920
921OMPTaskLoopDirective *OMPTaskLoopDirective::CreateEmpty(const ASTContext &C,
922                                                        unsigned NumClauses,
923                                                        unsigned CollapsedNum,
924                                                        EmptyShell) {
925  unsigned Size =
926      llvm::alignTo(sizeof(OMPTaskLoopDirective), alignof(OMPClause *));
927  void *Mem =
928      C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
929                 sizeof(Stmt *) * numLoopChildren(CollapsedNumOMPD_taskloop));
930  return new (Mem) OMPTaskLoopDirective(CollapsedNum, NumClauses);
931}
932
933OMPTaskLoopSimdDirective *OMPTaskLoopSimdDirective::Create(
934    const ASTContext &CSourceLocation StartLocSourceLocation EndLoc,
935    unsigned CollapsedNumArrayRef<OMPClause *> ClausesStmt *AssociatedStmt,
936    const HelperExprs &Exprs) {
937  unsigned Size =
938      llvm::alignTo(sizeof(OMPTaskLoopSimdDirective), alignof(OMPClause *));
939  void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
940                         sizeof(Stmt *) *
941                             numLoopChildren(CollapsedNum, OMPD_taskloop_simd));
942  OMPTaskLoopSimdDirective *Dir = new (Mem)
943      OMPTaskLoopSimdDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
944  Dir->setClauses(Clauses);
945  Dir->setAssociatedStmt(AssociatedStmt);
946  Dir->setIterationVariable(Exprs.IterationVarRef);
947  Dir->setLastIteration(Exprs.LastIteration);
948  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
949  Dir->setPreCond(Exprs.PreCond);
950  Dir->setCond(Exprs.Cond);
951  Dir->setInit(Exprs.Init);
952  Dir->setInc(Exprs.Inc);
953  Dir->setIsLastIterVariable(Exprs.IL);
954  Dir->setLowerBoundVariable(Exprs.LB);
955  Dir->setUpperBoundVariable(Exprs.UB);
956  Dir->setStrideVariable(Exprs.ST);
957  Dir->setEnsureUpperBound(Exprs.EUB);
958  Dir->setNextLowerBound(Exprs.NLB);
959  Dir->setNextUpperBound(Exprs.NUB);
960  Dir->setNumIterations(Exprs.NumIterations);
961  Dir->setCounters(Exprs.Counters);
962  Dir->setPrivateCounters(Exprs.PrivateCounters);
963  Dir->setInits(Exprs.Inits);
964  Dir->setUpdates(Exprs.Updates);
965  Dir->setFinals(Exprs.Finals);
966  Dir->setPreInits(Exprs.PreInits);
967  return Dir;
968}
969
970OMPTaskLoopSimdDirective *
971OMPTaskLoopSimdDirective::CreateEmpty(const ASTContext &Cunsigned NumClauses,
972                                      unsigned CollapsedNumEmptyShell) {
973  unsigned Size =
974      llvm::alignTo(sizeof(OMPTaskLoopSimdDirective), alignof(OMPClause *));
975  void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
976                         sizeof(Stmt *) *
977                             numLoopChildren(CollapsedNumOMPD_taskloop_simd));
978  return new (Mem) OMPTaskLoopSimdDirective(CollapsedNum, NumClauses);
979}
980
981OMPDistributeDirective *OMPDistributeDirective::Create(
982    const ASTContext &CSourceLocation StartLocSourceLocation EndLoc,
983    unsigned CollapsedNumArrayRef<OMPClause *> ClausesStmt *AssociatedStmt,
984    const HelperExprs &Exprs) {
985  unsigned Size =
986      llvm::alignTo(sizeof(OMPDistributeDirective), alignof(OMPClause *));
987  void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
988                         sizeof(Stmt *) *
989                             numLoopChildren(CollapsedNum, OMPD_distribute));
990  OMPDistributeDirective *Dir = new (Mem)
991      OMPDistributeDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
992  Dir->setClauses(Clauses);
993  Dir->setAssociatedStmt(AssociatedStmt);
994  Dir->setIterationVariable(Exprs.IterationVarRef);
995  Dir->setLastIteration(Exprs.LastIteration);
996  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
997  Dir->setPreCond(Exprs.PreCond);
998  Dir->setCond(Exprs.Cond);
999  Dir->setInit(Exprs.Init);
1000  Dir->setInc(Exprs.Inc);
1001  Dir->setIsLastIterVariable(Exprs.IL);
1002  Dir->setLowerBoundVariable(Exprs.LB);
1003  Dir->setUpperBoundVariable(Exprs.UB);
1004  Dir->setStrideVariable(Exprs.ST);
1005  Dir->setEnsureUpperBound(Exprs.EUB);
1006  Dir->setNextLowerBound(Exprs.NLB);
1007  Dir->setNextUpperBound(Exprs.NUB);
1008  Dir->setNumIterations(Exprs.NumIterations);
1009  Dir->setCounters(Exprs.Counters);
1010  Dir->setPrivateCounters(Exprs.PrivateCounters);
1011  Dir->setInits(Exprs.Inits);
1012  Dir->setUpdates(Exprs.Updates);
1013  Dir->setFinals(Exprs.Finals);
1014  Dir->setPreInits(Exprs.PreInits);
1015  return Dir;
1016}
1017
1018OMPDistributeDirective *
1019OMPDistributeDirective::CreateEmpty(const ASTContext &Cunsigned NumClauses,
1020                                    unsigned CollapsedNumEmptyShell) {
1021  unsigned Size =
1022      llvm::alignTo(sizeof(OMPDistributeDirective), alignof(OMPClause *));
1023  void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
1024                         sizeof(Stmt *) *
1025                             numLoopChildren(CollapsedNumOMPD_distribute));
1026  return new (Mem) OMPDistributeDirective(CollapsedNum, NumClauses);
1027}
1028
1029OMPTargetUpdateDirective *OMPTargetUpdateDirective::Create(
1030    const ASTContext &CSourceLocation StartLocSourceLocation EndLoc,
1031    ArrayRef<OMPClause *> ClausesStmt *AssociatedStmt) {
1032  unsigned Size =
1033      llvm::alignTo(sizeof(OMPTargetUpdateDirective), alignof(OMPClause *));
1034  void *Mem =
1035      C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
1036  OMPTargetUpdateDirective *Dir =
1037      new (Mem) OMPTargetUpdateDirective(StartLoc, EndLoc, Clauses.size());
1038  Dir->setClauses(Clauses);
1039  Dir->setAssociatedStmt(AssociatedStmt);
1040  return Dir;
1041}
1042
1043OMPTargetUpdateDirective *
1044OMPTargetUpdateDirective::CreateEmpty(const ASTContext &Cunsigned NumClauses,
1045                                      EmptyShell) {
1046  unsigned Size =
1047      llvm::alignTo(sizeof(OMPTargetUpdateDirective), alignof(OMPClause *));
1048  void *Mem =
1049      C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
1050  return new (Mem) OMPTargetUpdateDirective(NumClauses);
1051}
1052
1053OMPDistributeParallelForDirective *OMPDistributeParallelForDirective::Create(
1054    const ASTContext &CSourceLocation StartLocSourceLocation EndLoc,
1055    unsigned CollapsedNumArrayRef<OMPClause *> ClausesStmt *AssociatedStmt,
1056    const HelperExprs &Exprsbool HasCancel) {
1057  unsigned Size = llvm::alignTo(sizeof(OMPDistributeParallelForDirective),
1058                                alignof(OMPClause *));
1059  void *Mem = C.Allocate(
1060      Size + sizeof(OMPClause *) * Clauses.size() +
1061      sizeof(Stmt *) *
1062          numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for));
1063  OMPDistributeParallelForDirective *Dir =
1064      new (Mem) OMPDistributeParallelForDirective(StartLoc, EndLoc,
1065                                                  CollapsedNum, Clauses.size());
1066  Dir->setClauses(Clauses);
1067  Dir->setAssociatedStmt(AssociatedStmt);
1068  Dir->setIterationVariable(Exprs.IterationVarRef);
1069  Dir->setLastIteration(Exprs.LastIteration);
1070  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1071  Dir->setPreCond(Exprs.PreCond);
1072  Dir->setCond(Exprs.Cond);
1073  Dir->setInit(Exprs.Init);
1074  Dir->setInc(Exprs.Inc);
1075  Dir->setIsLastIterVariable(Exprs.IL);
1076  Dir->setLowerBoundVariable(Exprs.LB);
1077  Dir->setUpperBoundVariable(Exprs.UB);
1078  Dir->setStrideVariable(Exprs.ST);
1079  Dir->setEnsureUpperBound(Exprs.EUB);
1080  Dir->setNextLowerBound(Exprs.NLB);
1081  Dir->setNextUpperBound(Exprs.NUB);
1082  Dir->setNumIterations(Exprs.NumIterations);
1083  Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1084  Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
1085  Dir->setDistInc(Exprs.DistInc);
1086  Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
1087  Dir->setCounters(Exprs.Counters);
1088  Dir->setPrivateCounters(Exprs.PrivateCounters);
1089  Dir->setInits(Exprs.Inits);
1090  Dir->setUpdates(Exprs.Updates);
1091  Dir->setFinals(Exprs.Finals);
1092  Dir->setPreInits(Exprs.PreInits);
1093  Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1094  Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1095  Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1096  Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1097  Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1098  Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1099  Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
1100  Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
1101  Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
1102  Dir->HasCancel = HasCancel;
1103  return Dir;
1104}
1105
1106OMPDistributeParallelForDirective *
1107OMPDistributeParallelForDirective::CreateEmpty(const ASTContext &C,
1108                                               unsigned NumClauses,
1109                                               unsigned CollapsedNum,
1110                                               EmptyShell) {
1111  unsigned Size = llvm::alignTo(sizeof(OMPDistributeParallelForDirective),
1112                                alignof(OMPClause *));
1113  void *Mem = C.Allocate(
1114      Size + sizeof(OMPClause *) * NumClauses +
1115      sizeof(Stmt *) *
1116          numLoopChildren(CollapsedNumOMPD_distribute_parallel_for));
1117  return new (Mem) OMPDistributeParallelForDirective(CollapsedNum, NumClauses);
1118}
1119
1120OMPDistributeParallelForSimdDirective *
1121OMPDistributeParallelForSimdDirective::Create(
1122    const ASTContext &CSourceLocation StartLocSourceLocation EndLoc,
1123    unsigned CollapsedNumArrayRef<OMPClause *> ClausesStmt *AssociatedStmt,
1124    const HelperExprs &Exprs) {
1125  unsigned Size = llvm::alignTo(sizeof(OMPDistributeParallelForSimdDirective),
1126                                alignof(OMPClause *));
1127  void *Mem = C.Allocate(
1128      Size + sizeof(OMPClause *) * Clauses.size() +
1129      sizeof(Stmt *) *
1130          numLoopChildren(CollapsedNum, OMPD_distribute_parallel_for_simd));
1131  OMPDistributeParallelForSimdDirective *Dir = new (Mem)
1132      OMPDistributeParallelForSimdDirective(StartLoc, EndLoc, CollapsedNum,
1133                                            Clauses.size());
1134  Dir->setClauses(Clauses);
1135  Dir->setAssociatedStmt(AssociatedStmt);
1136  Dir->setIterationVariable(Exprs.IterationVarRef);
1137  Dir->setLastIteration(Exprs.LastIteration);
1138  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1139  Dir->setPreCond(Exprs.PreCond);
1140  Dir->setCond(Exprs.Cond);
1141  Dir->setInit(Exprs.Init);
1142  Dir->setInc(Exprs.Inc);
1143  Dir->setIsLastIterVariable(Exprs.IL);
1144  Dir->setLowerBoundVariable(Exprs.LB);
1145  Dir->setUpperBoundVariable(Exprs.UB);
1146  Dir->setStrideVariable(Exprs.ST);
1147  Dir->setEnsureUpperBound(Exprs.EUB);
1148  Dir->setNextLowerBound(Exprs.NLB);
1149  Dir->setNextUpperBound(Exprs.NUB);
1150  Dir->setNumIterations(Exprs.NumIterations);
1151  Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1152  Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
1153  Dir->setDistInc(Exprs.DistInc);
1154  Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
1155  Dir->setCounters(Exprs.Counters);
1156  Dir->setPrivateCounters(Exprs.PrivateCounters);
1157  Dir->setInits(Exprs.Inits);
1158  Dir->setUpdates(Exprs.Updates);
1159  Dir->setFinals(Exprs.Finals);
1160  Dir->setPreInits(Exprs.PreInits);
1161  Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1162  Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1163  Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1164  Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1165  Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1166  Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1167  Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
1168  Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
1169  Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
1170  return Dir;
1171}
1172
1173OMPDistributeParallelForSimdDirective *
1174OMPDistributeParallelForSimdDirective::CreateEmpty(const ASTContext &C,
1175                                                   unsigned NumClauses,
1176                                                   unsigned CollapsedNum,
1177                                                   EmptyShell) {
1178  unsigned Size = llvm::alignTo(sizeof(OMPDistributeParallelForSimdDirective),
1179                                alignof(OMPClause *));
1180  void *Mem = C.Allocate(
1181      Size + sizeof(OMPClause *) * NumClauses +
1182      sizeof(Stmt *) *
1183          numLoopChildren(CollapsedNumOMPD_distribute_parallel_for_simd));
1184  return new (Mem)
1185      OMPDistributeParallelForSimdDirective(CollapsedNum, NumClauses);
1186}
1187
1188OMPDistributeSimdDirective *OMPDistributeSimdDirective::Create(
1189    const ASTContext &CSourceLocation StartLocSourceLocation EndLoc,
1190    unsigned CollapsedNumArrayRef<OMPClause *> ClausesStmt *AssociatedStmt,
1191    const HelperExprs &Exprs) {
1192  unsigned Size =
1193      llvm::alignTo(sizeof(OMPDistributeSimdDirective), alignof(OMPClause *));
1194  void *Mem = C.Allocate(
1195      Size + sizeof(OMPClause *) * Clauses.size() +
1196      sizeof(Stmt *) *
1197          numLoopChildren(CollapsedNum, OMPD_distribute_simd));
1198  OMPDistributeSimdDirective *Dir = new (Mem) OMPDistributeSimdDirective(
1199      StartLoc, EndLoc, CollapsedNum, Clauses.size());
1200  Dir->setClauses(Clauses);
1201  Dir->setAssociatedStmt(AssociatedStmt);
1202  Dir->setIterationVariable(Exprs.IterationVarRef);
1203  Dir->setLastIteration(Exprs.LastIteration);
1204  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1205  Dir->setPreCond(Exprs.PreCond);
1206  Dir->setCond(Exprs.Cond);
1207  Dir->setInit(Exprs.Init);
1208  Dir->setInc(Exprs.Inc);
1209  Dir->setIsLastIterVariable(Exprs.IL);
1210  Dir->setLowerBoundVariable(Exprs.LB);
1211  Dir->setUpperBoundVariable(Exprs.UB);
1212  Dir->setStrideVariable(Exprs.ST);
1213  Dir->setEnsureUpperBound(Exprs.EUB);
1214  Dir->setNextLowerBound(Exprs.NLB);
1215  Dir->setNextUpperBound(Exprs.NUB);
1216  Dir->setNumIterations(Exprs.NumIterations);
1217  Dir->setCounters(Exprs.Counters);
1218  Dir->setPrivateCounters(Exprs.PrivateCounters);
1219  Dir->setInits(Exprs.Inits);
1220  Dir->setUpdates(Exprs.Updates);
1221  Dir->setFinals(Exprs.Finals);
1222  Dir->setPreInits(Exprs.PreInits);
1223  return Dir;
1224}
1225
1226OMPDistributeSimdDirective *
1227OMPDistributeSimdDirective::CreateEmpty(const ASTContext &C,
1228                                        unsigned NumClauses,
1229                                        unsigned CollapsedNumEmptyShell) {
1230  unsigned Size =
1231      llvm::alignTo(sizeof(OMPDistributeSimdDirective), alignof(OMPClause *));
1232  void *Mem = C.Allocate(
1233      Size + sizeof(OMPClause *) * NumClauses +
1234      sizeof(Stmt *) *
1235          numLoopChildren(CollapsedNumOMPD_distribute_simd));
1236  return new (Mem) OMPDistributeSimdDirective(CollapsedNum, NumClauses);
1237}
1238
1239OMPTargetParallelForSimdDirective *OMPTargetParallelForSimdDirective::Create(
1240    const ASTContext &CSourceLocation StartLocSourceLocation EndLoc,
1241    unsigned CollapsedNumArrayRef<OMPClause *> ClausesStmt *AssociatedStmt,
1242    const HelperExprs &Exprs) {
1243  unsigned Size = llvm::alignTo(sizeof(OMPTargetParallelForSimdDirective),
1244                                alignof(OMPClause *));
1245  void *Mem = C.Allocate(
1246      Size + sizeof(OMPClause *) * Clauses.size() +
1247      sizeof(Stmt *) *
1248          numLoopChildren(CollapsedNum, OMPD_target_parallel_for_simd));
1249  OMPTargetParallelForSimdDirective *Dir =
1250      new (Mem) OMPTargetParallelForSimdDirective(StartLoc, EndLoc,
1251                                                  CollapsedNum, Clauses.size());
1252  Dir->setClauses(Clauses);
1253  Dir->setAssociatedStmt(AssociatedStmt);
1254  Dir->setIterationVariable(Exprs.IterationVarRef);
1255  Dir->setLastIteration(Exprs.LastIteration);
1256  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1257  Dir->setPreCond(Exprs.PreCond);
1258  Dir->setCond(Exprs.Cond);
1259  Dir->setInit(Exprs.Init);
1260  Dir->setInc(Exprs.Inc);
1261  Dir->setIsLastIterVariable(Exprs.IL);
1262  Dir->setLowerBoundVariable(Exprs.LB);
1263  Dir->setUpperBoundVariable(Exprs.UB);
1264  Dir->setStrideVariable(Exprs.ST);
1265  Dir->setEnsureUpperBound(Exprs.EUB);
1266  Dir->setNextLowerBound(Exprs.NLB);
1267  Dir->setNextUpperBound(Exprs.NUB);
1268  Dir->setNumIterations(Exprs.NumIterations);
1269  Dir->setCounters(Exprs.Counters);
1270  Dir->setPrivateCounters(Exprs.PrivateCounters);
1271  Dir->setInits(Exprs.Inits);
1272  Dir->setUpdates(Exprs.Updates);
1273  Dir->setFinals(Exprs.Finals);
1274  Dir->setPreInits(Exprs.PreInits);
1275  return Dir;
1276}
1277
1278OMPTargetParallelForSimdDirective *
1279OMPTargetParallelForSimdDirective::CreateEmpty(const ASTContext &C,
1280                                               unsigned NumClauses,
1281                                               unsigned CollapsedNum,
1282                                               EmptyShell) {
1283  unsigned Size = llvm::alignTo(sizeof(OMPTargetParallelForSimdDirective),
1284                                alignof(OMPClause *));
1285  void *Mem = C.Allocate(
1286      Size + sizeof(OMPClause *) * NumClauses +
1287      sizeof(Stmt *) *
1288          numLoopChildren(CollapsedNumOMPD_target_parallel_for_simd));
1289  return new (Mem) OMPTargetParallelForSimdDirective(CollapsedNum, NumClauses);
1290}
1291
1292OMPTargetSimdDirective *
1293OMPTargetSimdDirective::Create(const ASTContext &CSourceLocation StartLoc,
1294                               SourceLocation EndLocunsigned CollapsedNum,
1295                               ArrayRef<OMPClause *> Clauses,
1296                               Stmt *AssociatedStmtconst HelperExprs &Exprs) {
1297  unsigned Size =
1298      llvm::alignTo(sizeof(OMPTargetSimdDirective), alignof(OMPClause *));
1299  void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
1300                         sizeof(Stmt *) *
1301                             numLoopChildren(CollapsedNum, OMPD_target_simd));
1302  OMPTargetSimdDirective *Dir = new (Mem)
1303      OMPTargetSimdDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());
1304  Dir->setClauses(Clauses);
1305  Dir->setAssociatedStmt(AssociatedStmt);
1306  Dir->setIterationVariable(Exprs.IterationVarRef);
1307  Dir->setLastIteration(Exprs.LastIteration);
1308  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1309  Dir->setPreCond(Exprs.PreCond);
1310  Dir->setCond(Exprs.Cond);
1311  Dir->setInit(Exprs.Init);
1312  Dir->setInc(Exprs.Inc);
1313  Dir->setCounters(Exprs.Counters);
1314  Dir->setPrivateCounters(Exprs.PrivateCounters);
1315  Dir->setInits(Exprs.Inits);
1316  Dir->setUpdates(Exprs.Updates);
1317  Dir->setFinals(Exprs.Finals);
1318  Dir->setPreInits(Exprs.PreInits);
1319  return Dir;
1320}
1321
1322OMPTargetSimdDirective *
1323OMPTargetSimdDirective::CreateEmpty(const ASTContext &Cunsigned NumClauses,
1324                                    unsigned CollapsedNumEmptyShell) {
1325  unsigned Size =
1326      llvm::alignTo(sizeof(OMPTargetSimdDirective), alignof(OMPClause *));
1327  void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
1328                         sizeof(Stmt *) *
1329                             numLoopChildren(CollapsedNumOMPD_target_simd));
1330  return new (Mem) OMPTargetSimdDirective(CollapsedNum, NumClauses);
1331}
1332
1333OMPTeamsDistributeDirective *OMPTeamsDistributeDirective::Create(
1334    const ASTContext &CSourceLocation StartLocSourceLocation EndLoc,
1335    unsigned CollapsedNumArrayRef<OMPClause *> ClausesStmt *AssociatedStmt,
1336    const HelperExprs &Exprs) {
1337  unsigned Size =
1338      llvm::alignTo(sizeof(OMPTeamsDistributeDirective), alignof(OMPClause *));
1339  void *Mem = C.Allocate(
1340      Size + sizeof(OMPClause *) * Clauses.size() +
1341      sizeof(Stmt *) * numLoopChildren(CollapsedNum, OMPD_teams_distribute));
1342  OMPTeamsDistributeDirective *Dir = new (Mem) OMPTeamsDistributeDirective(
1343      StartLoc, EndLoc, CollapsedNum, Clauses.size());
1344  Dir->setClauses(Clauses);
1345  Dir->setAssociatedStmt(AssociatedStmt);
1346  Dir->setIterationVariable(Exprs.IterationVarRef);
1347  Dir->setLastIteration(Exprs.LastIteration);
1348  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1349  Dir->setPreCond(Exprs.PreCond);
1350  Dir->setCond(Exprs.Cond);
1351  Dir->setInit(Exprs.Init);
1352  Dir->setInc(Exprs.Inc);
1353  Dir->setIsLastIterVariable(Exprs.IL);
1354  Dir->setLowerBoundVariable(Exprs.LB);
1355  Dir->setUpperBoundVariable(Exprs.UB);
1356  Dir->setStrideVariable(Exprs.ST);
1357  Dir->setEnsureUpperBound(Exprs.EUB);
1358  Dir->setNextLowerBound(Exprs.NLB);
1359  Dir->setNextUpperBound(Exprs.NUB);
1360  Dir->setNumIterations(Exprs.NumIterations);
1361  Dir->setCounters(Exprs.Counters);
1362  Dir->setPrivateCounters(Exprs.PrivateCounters);
1363  Dir->setInits(Exprs.Inits);
1364  Dir->setUpdates(Exprs.Updates);
1365  Dir->setFinals(Exprs.Finals);
1366  Dir->setPreInits(Exprs.PreInits);
1367  return Dir;
1368}
1369
1370OMPTeamsDistributeDirective *
1371OMPTeamsDistributeDirective::CreateEmpty(const ASTContext &C,
1372                                         unsigned NumClauses,
1373                                         unsigned CollapsedNumEmptyShell) {
1374  unsigned Size =
1375      llvm::alignTo(sizeof(OMPTeamsDistributeDirective), alignof(OMPClause *));
1376  void *Mem = C.Allocate(
1377      Size + sizeof(OMPClause *) * NumClauses +
1378      sizeof(Stmt *) * numLoopChildren(CollapsedNumOMPD_teams_distribute));
1379  return new (Mem) OMPTeamsDistributeDirective(CollapsedNum, NumClauses);
1380}
1381
1382OMPTeamsDistributeSimdDirective *OMPTeamsDistributeSimdDirective::Create(
1383    const ASTContext &CSourceLocation StartLocSourceLocation EndLoc,
1384    unsigned CollapsedNumArrayRef<OMPClause *> ClausesStmt *AssociatedStmt,
1385    const HelperExprs &Exprs) {
1386  unsigned Size = llvm::alignTo(sizeof(OMPTeamsDistributeSimdDirective),
1387                                alignof(OMPClause *));
1388  void *Mem =
1389      C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
1390                 sizeof(Stmt *) *
1391                     numLoopChildren(CollapsedNum, OMPD_teams_distribute_simd));
1392  OMPTeamsDistributeSimdDirective *Dir =
1393      new (Mem) OMPTeamsDistributeSimdDirective(StartLoc, EndLoc, CollapsedNum,
1394                                                Clauses.size());
1395  Dir->setClauses(Clauses);
1396  Dir->setAssociatedStmt(AssociatedStmt);
1397  Dir->setIterationVariable(Exprs.IterationVarRef);
1398  Dir->setLastIteration(Exprs.LastIteration);
1399  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1400  Dir->setPreCond(Exprs.PreCond);
1401  Dir->setCond(Exprs.Cond);
1402  Dir->setInit(Exprs.Init);
1403  Dir->setInc(Exprs.Inc);
1404  Dir->setIsLastIterVariable(Exprs.IL);
1405  Dir->setLowerBoundVariable(Exprs.LB);
1406  Dir->setUpperBoundVariable(Exprs.UB);
1407  Dir->setStrideVariable(Exprs.ST);
1408  Dir->setEnsureUpperBound(Exprs.EUB);
1409  Dir->setNextLowerBound(Exprs.NLB);
1410  Dir->setNextUpperBound(Exprs.NUB);
1411  Dir->setNumIterations(Exprs.NumIterations);
1412  Dir->setCounters(Exprs.Counters);
1413  Dir->setPrivateCounters(Exprs.PrivateCounters);
1414  Dir->setInits(Exprs.Inits);
1415  Dir->setUpdates(Exprs.Updates);
1416  Dir->setFinals(Exprs.Finals);
1417  Dir->setPreInits(Exprs.PreInits);
1418  return Dir;
1419}
1420
1421OMPTeamsDistributeSimdDirective *OMPTeamsDistributeSimdDirective::CreateEmpty(
1422    const ASTContext &Cunsigned NumClausesunsigned CollapsedNum,
1423    EmptyShell) {
1424  unsigned Size = llvm::alignTo(sizeof(OMPTeamsDistributeSimdDirective),
1425                                alignof(OMPClause *));
1426  void *Mem =
1427      C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
1428                 sizeof(Stmt *) *
1429                     numLoopChildren(CollapsedNumOMPD_teams_distribute_simd));
1430  return new (Mem) OMPTeamsDistributeSimdDirective(CollapsedNum, NumClauses);
1431}
1432
1433OMPTeamsDistributeParallelForSimdDirective *
1434OMPTeamsDistributeParallelForSimdDirective::Create(
1435    const ASTContext &CSourceLocation StartLocSourceLocation EndLoc,
1436    unsigned CollapsedNumArrayRef<OMPClause *> ClausesStmt *AssociatedStmt,
1437    const HelperExprs &Exprs) {
1438  auto Size = llvm::alignTo(sizeof(OMPTeamsDistributeParallelForSimdDirective),
1439                            alignof(OMPClause *));
1440  void *Mem =
1441      C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
1442                 sizeof(Stmt *) *
1443                     numLoopChildren(CollapsedNum,
1444                                     OMPD_teams_distribute_parallel_for_simd));
1445  OMPTeamsDistributeParallelForSimdDirective *Dir = new (Mem)
1446      OMPTeamsDistributeParallelForSimdDirective(StartLoc, EndLoc, CollapsedNum,
1447                                                 Clauses.size());
1448  Dir->setClauses(Clauses);
1449  Dir->setAssociatedStmt(AssociatedStmt);
1450  Dir->setIterationVariable(Exprs.IterationVarRef);
1451  Dir->setLastIteration(Exprs.LastIteration);
1452  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1453  Dir->setPreCond(Exprs.PreCond);
1454  Dir->setCond(Exprs.Cond);
1455  Dir->setInit(Exprs.Init);
1456  Dir->setInc(Exprs.Inc);
1457  Dir->setIsLastIterVariable(Exprs.IL);
1458  Dir->setLowerBoundVariable(Exprs.LB);
1459  Dir->setUpperBoundVariable(Exprs.UB);
1460  Dir->setStrideVariable(Exprs.ST);
1461  Dir->setEnsureUpperBound(Exprs.EUB);
1462  Dir->setNextLowerBound(Exprs.NLB);
1463  Dir->setNextUpperBound(Exprs.NUB);
1464  Dir->setNumIterations(Exprs.NumIterations);
1465  Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1466  Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
1467  Dir->setDistInc(Exprs.DistInc);
1468  Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
1469  Dir->setCounters(Exprs.Counters);
1470  Dir->setPrivateCounters(Exprs.PrivateCounters);
1471  Dir->setInits(Exprs.Inits);
1472  Dir->setUpdates(Exprs.Updates);
1473  Dir->setFinals(Exprs.Finals);
1474  Dir->setPreInits(Exprs.PreInits);
1475  Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1476  Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1477  Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1478  Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1479  Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1480  Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1481  Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
1482  Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
1483  Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
1484  return Dir;
1485}
1486
1487OMPTeamsDistributeParallelForSimdDirective *
1488OMPTeamsDistributeParallelForSimdDirective::CreateEmpty(const ASTContext &C,
1489                                                        unsigned NumClauses,
1490                                                        unsigned CollapsedNum,
1491                                                        EmptyShell) {
1492  auto Size = llvm::alignTo(sizeof(OMPTeamsDistributeParallelForSimdDirective),
1493                            alignof(OMPClause *));
1494  void *Mem =
1495      C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
1496                 sizeof(Stmt *) *
1497                     numLoopChildren(CollapsedNum,
1498                                     OMPD_teams_distribute_parallel_for_simd));
1499  return new (Mem)
1500      OMPTeamsDistributeParallelForSimdDirective(CollapsedNum, NumClauses);
1501}
1502
1503OMPTeamsDistributeParallelForDirective *
1504OMPTeamsDistributeParallelForDirective::Create(
1505    const ASTContext &CSourceLocation StartLocSourceLocation EndLoc,
1506    unsigned CollapsedNumArrayRef<OMPClause *> ClausesStmt *AssociatedStmt,
1507    const HelperExprs &Exprsbool HasCancel) {
1508  auto Size = llvm::alignTo(sizeof(OMPTeamsDistributeParallelForDirective),
1509                            alignof(OMPClause *));
1510  void *Mem = C.Allocate(
1511      Size + sizeof(OMPClause *) * Clauses.size() +
1512      sizeof(Stmt *) *
1513          numLoopChildren(CollapsedNum, OMPD_teams_distribute_parallel_for));
1514  OMPTeamsDistributeParallelForDirective *Dir = new (Mem)
1515      OMPTeamsDistributeParallelForDirective(StartLoc, EndLoc, CollapsedNum,
1516                                             Clauses.size());
1517  Dir->setClauses(Clauses);
1518  Dir->setAssociatedStmt(AssociatedStmt);
1519  Dir->setIterationVariable(Exprs.IterationVarRef);
1520  Dir->setLastIteration(Exprs.LastIteration);
1521  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1522  Dir->setPreCond(Exprs.PreCond);
1523  Dir->setCond(Exprs.Cond);
1524  Dir->setInit(Exprs.Init);
1525  Dir->setInc(Exprs.Inc);
1526  Dir->setIsLastIterVariable(Exprs.IL);
1527  Dir->setLowerBoundVariable(Exprs.LB);
1528  Dir->setUpperBoundVariable(Exprs.UB);
1529  Dir->setStrideVariable(Exprs.ST);
1530  Dir->setEnsureUpperBound(Exprs.EUB);
1531  Dir->setNextLowerBound(Exprs.NLB);
1532  Dir->setNextUpperBound(Exprs.NUB);
1533  Dir->setNumIterations(Exprs.NumIterations);
1534  Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1535  Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
1536  Dir->setDistInc(Exprs.DistInc);
1537  Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
1538  Dir->setCounters(Exprs.Counters);
1539  Dir->setPrivateCounters(Exprs.PrivateCounters);
1540  Dir->setInits(Exprs.Inits);
1541  Dir->setUpdates(Exprs.Updates);
1542  Dir->setFinals(Exprs.Finals);
1543  Dir->setPreInits(Exprs.PreInits);
1544  Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1545  Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1546  Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1547  Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1548  Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1549  Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1550  Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
1551  Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
1552  Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
1553  Dir->HasCancel = HasCancel;
1554  return Dir;
1555}
1556
1557OMPTeamsDistributeParallelForDirective *
1558OMPTeamsDistributeParallelForDirective::CreateEmpty(const ASTContext &C,
1559                                                    unsigned NumClauses,
1560                                                    unsigned CollapsedNum,
1561                                                    EmptyShell) {
1562  auto Size = llvm::alignTo(sizeof(OMPTeamsDistributeParallelForDirective),
1563                            alignof(OMPClause *));
1564  void *Mem = C.Allocate(
1565      Size + sizeof(OMPClause *) * NumClauses +
1566      sizeof(Stmt *) *
1567          numLoopChildren(CollapsedNum, OMPD_teams_distribute_parallel_for));
1568  return new (Mem)
1569      OMPTeamsDistributeParallelForDirective(CollapsedNum, NumClauses);
1570}
1571
1572OMPTargetTeamsDirective *OMPTargetTeamsDirective::Create(
1573    const ASTContext &CSourceLocation StartLocSourceLocation EndLoc,
1574    ArrayRef<OMPClause *> ClausesStmt *AssociatedStmt) {
1575  auto Size =
1576      llvm::alignTo(sizeof(OMPTargetTeamsDirective), alignof(OMPClause *));
1577  void *Mem =
1578      C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
1579  OMPTargetTeamsDirective *Dir =
1580      new (Mem) OMPTargetTeamsDirective(StartLoc, EndLoc, Clauses.size());
1581  Dir->setClauses(Clauses);
1582  Dir->setAssociatedStmt(AssociatedStmt);
1583  return Dir;
1584}
1585
1586OMPTargetTeamsDirective *
1587OMPTargetTeamsDirective::CreateEmpty(const ASTContext &Cunsigned NumClauses,
1588                                     EmptyShell) {
1589  auto Size =
1590      llvm::alignTo(sizeof(OMPTargetTeamsDirective), alignof(OMPClause *));
1591  void *Mem =
1592      C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
1593  return new (Mem) OMPTargetTeamsDirective(NumClauses);
1594}
1595
1596OMPTargetTeamsDistributeDirective *OMPTargetTeamsDistributeDirective::Create(
1597    const ASTContext &CSourceLocation StartLocSourceLocation EndLoc,
1598    unsigned CollapsedNumArrayRef<OMPClause *> ClausesStmt *AssociatedStmt,
1599    const HelperExprs &Exprs) {
1600  auto Size = llvm::alignTo(sizeof(OMPTargetTeamsDistributeDirective),
1601                            alignof(OMPClause *));
1602  void *Mem = C.Allocate(
1603      Size + sizeof(OMPClause *) * Clauses.size() +
1604      sizeof(Stmt *) *
1605          numLoopChildren(CollapsedNum, OMPD_target_teams_distribute));
1606  OMPTargetTeamsDistributeDirective *Dir =
1607      new (Mem) OMPTargetTeamsDistributeDirective(StartLoc, EndLoc, CollapsedNum,
1608                                                  Clauses.size());
1609  Dir->setClauses(Clauses);
1610  Dir->setAssociatedStmt(AssociatedStmt);
1611  Dir->setIterationVariable(Exprs.IterationVarRef);
1612  Dir->setLastIteration(Exprs.LastIteration);
1613  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1614  Dir->setPreCond(Exprs.PreCond);
1615  Dir->setCond(Exprs.Cond);
1616  Dir->setInit(Exprs.Init);
1617  Dir->setInc(Exprs.Inc);
1618  Dir->setIsLastIterVariable(Exprs.IL);
1619  Dir->setLowerBoundVariable(Exprs.LB);
1620  Dir->setUpperBoundVariable(Exprs.UB);
1621  Dir->setStrideVariable(Exprs.ST);
1622  Dir->setEnsureUpperBound(Exprs.EUB);
1623  Dir->setNextLowerBound(Exprs.NLB);
1624  Dir->setNextUpperBound(Exprs.NUB);
1625  Dir->setNumIterations(Exprs.NumIterations);
1626  Dir->setCounters(Exprs.Counters);
1627  Dir->setPrivateCounters(Exprs.PrivateCounters);
1628  Dir->setInits(Exprs.Inits);
1629  Dir->setUpdates(Exprs.Updates);
1630  Dir->setFinals(Exprs.Finals);
1631  Dir->setPreInits(Exprs.PreInits);
1632  return Dir;
1633}
1634
1635OMPTargetTeamsDistributeDirective *
1636OMPTargetTeamsDistributeDirective::CreateEmpty(const ASTContext &C,
1637                                               unsigned NumClauses,
1638                                               unsigned CollapsedNum,
1639                                               EmptyShell) {
1640  auto Size = llvm::alignTo(sizeof(OMPTargetTeamsDistributeDirective),
1641                            alignof(OMPClause *));
1642  void *Mem = C.Allocate(
1643      Size + sizeof(OMPClause *) * NumClauses +
1644      sizeof(Stmt *) *
1645           numLoopChildren(CollapsedNum, OMPD_target_teams_distribute));
1646  return new (Mem) OMPTargetTeamsDistributeDirective(CollapsedNum, NumClauses);
1647}
1648
1649OMPTargetTeamsDistributeParallelForDirective *
1650OMPTargetTeamsDistributeParallelForDirective::Create(
1651    const ASTContext &CSourceLocation StartLocSourceLocation EndLoc,
1652    unsigned CollapsedNumArrayRef<OMPClause *> ClausesStmt *AssociatedStmt,
1653    const HelperExprs &Exprsbool HasCancel) {
1654  auto Size =
1655      llvm::alignTo(sizeof(OMPTargetTeamsDistributeParallelForDirective),
1656                    alignof(OMPClause *));
1657  void *Mem = C.Allocate(
1658      Size + sizeof(OMPClause *) * Clauses.size() +
1659      sizeof(Stmt *) *
1660          numLoopChildren(CollapsedNum,
1661                          OMPD_target_teams_distribute_parallel_for));
1662  OMPTargetTeamsDistributeParallelForDirective *Dir =
1663      new (Mem) OMPTargetTeamsDistributeParallelForDirective(
1664           StartLoc, EndLoc, CollapsedNum, Clauses.size());
1665  Dir->setClauses(Clauses);
1666  Dir->setAssociatedStmt(AssociatedStmt);
1667  Dir->setIterationVariable(Exprs.IterationVarRef);
1668  Dir->setLastIteration(Exprs.LastIteration);
1669  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1670  Dir->setPreCond(Exprs.PreCond);
1671  Dir->setCond(Exprs.Cond);
1672  Dir->setInit(Exprs.Init);
1673  Dir->setInc(Exprs.Inc);
1674  Dir->setIsLastIterVariable(Exprs.IL);
1675  Dir->setLowerBoundVariable(Exprs.LB);
1676  Dir->setUpperBoundVariable(Exprs.UB);
1677  Dir->setStrideVariable(Exprs.ST);
1678  Dir->setEnsureUpperBound(Exprs.EUB);
1679  Dir->setNextLowerBound(Exprs.NLB);
1680  Dir->setNextUpperBound(Exprs.NUB);
1681  Dir->setNumIterations(Exprs.NumIterations);
1682  Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1683  Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
1684  Dir->setDistInc(Exprs.DistInc);
1685  Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
1686  Dir->setCounters(Exprs.Counters);
1687  Dir->setPrivateCounters(Exprs.PrivateCounters);
1688  Dir->setInits(Exprs.Inits);
1689  Dir->setUpdates(Exprs.Updates);
1690  Dir->setFinals(Exprs.Finals);
1691  Dir->setPreInits(Exprs.PreInits);
1692  Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1693  Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1694  Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1695  Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1696  Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1697  Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1698  Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
1699  Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
1700  Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
1701  Dir->HasCancel = HasCancel;
1702  return Dir;
1703}
1704
1705OMPTargetTeamsDistributeParallelForDirective *
1706OMPTargetTeamsDistributeParallelForDirective::CreateEmpty(const ASTContext &C,
1707                                                          unsigned NumClauses,
1708                                                          unsigned CollapsedNum,
1709                                                          EmptyShell) {
1710  auto Size =
1711      llvm::alignTo(sizeof(OMPTargetTeamsDistributeParallelForDirective),
1712                    alignof(OMPClause *));
1713  void *Mem = C.Allocate(
1714      Size + sizeof(OMPClause *) * NumClauses +
1715      sizeof(Stmt *) *
1716           numLoopChildren(CollapsedNum,
1717                           OMPD_target_teams_distribute_parallel_for));
1718  return new (Mem)
1719      OMPTargetTeamsDistributeParallelForDirective(CollapsedNum, NumClauses);
1720}
1721
1722OMPTargetTeamsDistributeParallelForSimdDirective *
1723OMPTargetTeamsDistributeParallelForSimdDirective::Create(
1724    const ASTContext &CSourceLocation StartLocSourceLocation EndLoc,
1725    unsigned CollapsedNumArrayRef<OMPClause *> ClausesStmt *AssociatedStmt,
1726    const HelperExprs &Exprs) {
1727  auto Size =
1728      llvm::alignTo(sizeof(OMPTargetTeamsDistributeParallelForSimdDirective),
1729                    alignof(OMPClause *));
1730  void *Mem = C.Allocate(
1731      Size + sizeof(OMPClause *) * Clauses.size() +
1732      sizeof(Stmt *) *
1733          numLoopChildren(CollapsedNum,
1734                          OMPD_target_teams_distribute_parallel_for_simd));
1735  OMPTargetTeamsDistributeParallelForSimdDirective *Dir =
1736      new (Mem) OMPTargetTeamsDistributeParallelForSimdDirective(
1737           StartLoc, EndLoc, CollapsedNum, Clauses.size());
1738  Dir->setClauses(Clauses);
1739  Dir->setAssociatedStmt(AssociatedStmt);
1740  Dir->setIterationVariable(Exprs.IterationVarRef);
1741  Dir->setLastIteration(Exprs.LastIteration);
1742  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1743  Dir->setPreCond(Exprs.PreCond);
1744  Dir->setCond(Exprs.Cond);
1745  Dir->setInit(Exprs.Init);
1746  Dir->setInc(Exprs.Inc);
1747  Dir->setIsLastIterVariable(Exprs.IL);
1748  Dir->setLowerBoundVariable(Exprs.LB);
1749  Dir->setUpperBoundVariable(Exprs.UB);
1750  Dir->setStrideVariable(Exprs.ST);
1751  Dir->setEnsureUpperBound(Exprs.EUB);
1752  Dir->setNextLowerBound(Exprs.NLB);
1753  Dir->setNextUpperBound(Exprs.NUB);
1754  Dir->setNumIterations(Exprs.NumIterations);
1755  Dir->setPrevLowerBoundVariable(Exprs.PrevLB);
1756  Dir->setPrevUpperBoundVariable(Exprs.PrevUB);
1757  Dir->setDistInc(Exprs.DistInc);
1758  Dir->setPrevEnsureUpperBound(Exprs.PrevEUB);
1759  Dir->setCounters(Exprs.Counters);
1760  Dir->setPrivateCounters(Exprs.PrivateCounters);
1761  Dir->setInits(Exprs.Inits);
1762  Dir->setUpdates(Exprs.Updates);
1763  Dir->setFinals(Exprs.Finals);
1764  Dir->setPreInits(Exprs.PreInits);
1765  Dir->setCombinedLowerBoundVariable(Exprs.DistCombinedFields.LB);
1766  Dir->setCombinedUpperBoundVariable(Exprs.DistCombinedFields.UB);
1767  Dir->setCombinedEnsureUpperBound(Exprs.DistCombinedFields.EUB);
1768  Dir->setCombinedInit(Exprs.DistCombinedFields.Init);
1769  Dir->setCombinedCond(Exprs.DistCombinedFields.Cond);
1770  Dir->setCombinedNextLowerBound(Exprs.DistCombinedFields.NLB);
1771  Dir->setCombinedNextUpperBound(Exprs.DistCombinedFields.NUB);
1772  Dir->setCombinedDistCond(Exprs.DistCombinedFields.DistCond);
1773  Dir->setCombinedParForInDistCond(Exprs.DistCombinedFields.ParForInDistCond);
1774  return Dir;
1775}
1776
1777OMPTargetTeamsDistributeParallelForSimdDirective *
1778OMPTargetTeamsDistributeParallelForSimdDirective::CreateEmpty(
1779    const ASTContext &Cunsigned NumClausesunsigned CollapsedNum,
1780    EmptyShell) {
1781  auto Size =
1782      llvm::alignTo(sizeof(OMPTargetTeamsDistributeParallelForSimdDirective),
1783                    alignof(OMPClause *));
1784  void *Mem = C.Allocate(
1785      Size + sizeof(OMPClause *) * NumClauses +
1786      sizeof(Stmt *) *
1787          numLoopChildren(CollapsedNum,
1788                          OMPD_target_teams_distribute_parallel_for_simd));
1789  return new (Mem) OMPTargetTeamsDistributeParallelForSimdDirective(
1790      CollapsedNum, NumClauses);
1791}
1792
1793OMPTargetTeamsDistributeSimdDirective *
1794OMPTargetTeamsDistributeSimdDirective::Create(
1795    const ASTContext &CSourceLocation StartLocSourceLocation EndLoc,
1796    unsigned CollapsedNumArrayRef<OMPClause *> ClausesStmt *AssociatedStmt,
1797    const HelperExprs &Exprs) {
1798  auto Size = llvm::alignTo(sizeof(OMPTargetTeamsDistributeSimdDirective),
1799                            alignof(OMPClause *));
1800  void *Mem = C.Allocate(
1801      Size + sizeof(OMPClause *) * Clauses.size() +
1802      sizeof(Stmt *) *
1803          numLoopChildren(CollapsedNum, OMPD_target_teams_distribute_simd));
1804  OMPTargetTeamsDistributeSimdDirective *Dir = new (Mem)
1805      OMPTargetTeamsDistributeSimdDirective(StartLoc, EndLoc, CollapsedNum,
1806                                            Clauses.size());
1807  Dir->setClauses(Clauses);
1808  Dir->setAssociatedStmt(AssociatedStmt);
1809  Dir->setIterationVariable(Exprs.IterationVarRef);
1810  Dir->setLastIteration(Exprs.LastIteration);
1811  Dir->setCalcLastIteration(Exprs.CalcLastIteration);
1812  Dir->setPreCond(Exprs.PreCond);
1813  Dir->setCond(Exprs.Cond);
1814  Dir->setInit(Exprs.Init);
1815  Dir->setInc(Exprs.Inc);
1816  Dir->setIsLastIterVariable(Exprs.IL);
1817  Dir->setLowerBoundVariable(Exprs.LB);
1818  Dir->setUpperBoundVariable(Exprs.UB);
1819  Dir->setStrideVariable(Exprs.ST);
1820  Dir->setEnsureUpperBound(Exprs.EUB);
1821  Dir->setNextLowerBound(Exprs.NLB);
1822  Dir->setNextUpperBound(Exprs.NUB);
1823  Dir->setNumIterations(Exprs.NumIterations);
1824  Dir->setCounters(Exprs.Counters);
1825  Dir->setPrivateCounters(Exprs.PrivateCounters);
1826  Dir->setInits(Exprs.Inits);
1827  Dir->setUpdates(Exprs.Updates);
1828  Dir->setFinals(Exprs.Finals);
1829  Dir->setPreInits(Exprs.PreInits);
1830  return Dir;
1831}
1832
1833OMPTargetTeamsDistributeSimdDirective *
1834OMPTargetTeamsDistributeSimdDirective::CreateEmpty(const ASTContext &C,
1835                                                   unsigned NumClauses,
1836                                                   unsigned CollapsedNum,
1837                                                   EmptyShell) {
1838  auto Size = llvm::alignTo(sizeof(OMPTargetTeamsDistributeSimdDirective),
1839                            alignof(OMPClause *));
1840  void *Mem = C.Allocate(
1841      Size + sizeof(OMPClause *) * NumClauses +
1842      sizeof(Stmt *) *
1843          numLoopChildren(CollapsedNum, OMPD_target_teams_distribute_simd));
1844  return new (Mem)
1845      OMPTargetTeamsDistributeSimdDirective(CollapsedNum, NumClauses);
1846}
1847
clang::OMPExecutableDirective::setClauses
clang::OMPExecutableDirective::isStandaloneDirective
clang::OMPExecutableDirective::getStructuredBlock
clang::OMPLoopDirective::setCounters
clang::OMPLoopDirective::setPrivateCounters
clang::OMPLoopDirective::setInits
clang::OMPLoopDirective::setUpdates
clang::OMPLoopDirective::setFinals
clang::OMPParallelDirective::Create
clang::OMPParallelDirective::CreateEmpty
clang::OMPSimdDirective::Create
clang::OMPSimdDirective::CreateEmpty
clang::OMPForDirective::Create
clang::OMPForDirective::CreateEmpty
clang::OMPForSimdDirective::Create
clang::OMPForSimdDirective::CreateEmpty
clang::OMPSectionsDirective::Create
clang::OMPSectionsDirective::CreateEmpty
clang::OMPSectionDirective::Create
clang::OMPSectionDirective::CreateEmpty
clang::OMPSingleDirective::Create
clang::OMPSingleDirective::CreateEmpty
clang::OMPMasterDirective::Create
clang::OMPMasterDirective::CreateEmpty
clang::OMPCriticalDirective::Create
clang::OMPCriticalDirective::CreateEmpty
clang::OMPParallelForDirective::Create
clang::OMPParallelForDirective::CreateEmpty
clang::OMPParallelForSimdDirective::Create
clang::OMPParallelForSimdDirective::CreateEmpty
clang::OMPParallelSectionsDirective::Create
clang::OMPParallelSectionsDirective::CreateEmpty
clang::OMPTaskDirective::Create
clang::OMPTaskDirective::CreateEmpty
clang::OMPTaskyieldDirective::Create
clang::OMPTaskyieldDirective::CreateEmpty
clang::OMPBarrierDirective::Create
clang::OMPBarrierDirective::CreateEmpty
clang::OMPTaskwaitDirective::Create
clang::OMPTaskwaitDirective::CreateEmpty
clang::OMPTaskgroupDirective::Create
clang::OMPTaskgroupDirective::CreateEmpty
clang::OMPCancellationPointDirective::Create
clang::OMPCancellationPointDirective::CreateEmpty
clang::OMPCancelDirective::Create
clang::OMPCancelDirective::CreateEmpty
clang::OMPFlushDirective::Create
clang::OMPFlushDirective::CreateEmpty
clang::OMPOrderedDirective::Create
clang::OMPOrderedDirective::CreateEmpty
clang::OMPAtomicDirective::Create
clang::OMPAtomicDirective::CreateEmpty
clang::OMPTargetDirective::Create
clang::OMPTargetDirective::CreateEmpty
clang::OMPTargetParallelDirective::Create
clang::OMPTargetParallelDirective::CreateEmpty
clang::OMPTargetParallelForDirective::Create
clang::OMPTargetParallelForDirective::CreateEmpty
clang::OMPTargetDataDirective::Create
clang::OMPTargetDataDirective::CreateEmpty
clang::OMPTargetEnterDataDirective::Create
clang::OMPTargetEnterDataDirective::CreateEmpty
clang::OMPTargetExitDataDirective::Create
clang::OMPTargetExitDataDirective::CreateEmpty
clang::OMPTeamsDirective::Create
clang::OMPTeamsDirective::CreateEmpty
clang::OMPTaskLoopDirective::Create
clang::OMPTaskLoopDirective::CreateEmpty
clang::OMPTaskLoopSimdDirective::Create
clang::OMPTaskLoopSimdDirective::CreateEmpty
clang::OMPDistributeDirective::Create
clang::OMPDistributeDirective::CreateEmpty
clang::OMPTargetUpdateDirective::Create
clang::OMPTargetUpdateDirective::CreateEmpty
clang::OMPDistributeParallelForDirective::Create
clang::OMPDistributeParallelForDirective::CreateEmpty
clang::OMPDistributeParallelForSimdDirective::Create
clang::OMPDistributeParallelForSimdDirective::CreateEmpty
clang::OMPDistributeSimdDirective::Create
clang::OMPDistributeSimdDirective::CreateEmpty
clang::OMPTargetParallelForSimdDirective::Create
clang::OMPTargetParallelForSimdDirective::CreateEmpty
clang::OMPTargetSimdDirective::Create
clang::OMPTargetSimdDirective::CreateEmpty
clang::OMPTeamsDistributeDirective::Create
clang::OMPTeamsDistributeDirective::CreateEmpty
clang::OMPTeamsDistributeSimdDirective::Create
clang::OMPTeamsDistributeSimdDirective::CreateEmpty
clang::OMPTeamsDistributeParallelForSimdDirective::Create
clang::OMPTeamsDistributeParallelForSimdDirective::CreateEmpty
clang::OMPTeamsDistributeParallelForDirective::Create
clang::OMPTeamsDistributeParallelForDirective::CreateEmpty
clang::OMPTargetTeamsDirective::Create
clang::OMPTargetTeamsDirective::CreateEmpty
clang::OMPTargetTeamsDistributeDirective::Create
clang::OMPTargetTeamsDistributeDirective::CreateEmpty
clang::OMPTargetTeamsDistributeParallelForDirective::Create
clang::OMPTargetTeamsDistributeParallelForDirective::CreateEmpty
clang::OMPTargetTeamsDistributeParallelForSimdDirective::Create
clang::OMPTargetTeamsDistributeParallelForSimdDirective::CreateEmpty
clang::OMPTargetTeamsDistributeSimdDirective::Create
clang::OMPTargetTeamsDistributeSimdDirective::CreateEmpty