File: | tools/clang/lib/AST/OpenMPClause.cpp |
Warning: | line 1041, column 3 Called C++ object pointer is null |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
1 | //===- OpenMPClause.cpp - Classes for OpenMP clauses ----------------------===// | |||
2 | // | |||
3 | // The LLVM Compiler Infrastructure | |||
4 | // | |||
5 | // This file is distributed under the University of Illinois Open Source | |||
6 | // License. See LICENSE.TXT for details. | |||
7 | // | |||
8 | //===----------------------------------------------------------------------===// | |||
9 | // | |||
10 | // This file implements the subclesses of Stmt class declared in OpenMPClause.h | |||
11 | // | |||
12 | //===----------------------------------------------------------------------===// | |||
13 | ||||
14 | #include "clang/AST/OpenMPClause.h" | |||
15 | #include "clang/AST/ASTContext.h" | |||
16 | #include "clang/AST/Decl.h" | |||
17 | #include "clang/AST/DeclOpenMP.h" | |||
18 | #include "clang/Basic/LLVM.h" | |||
19 | #include "llvm/ADT/SmallPtrSet.h" | |||
20 | #include "llvm/Support/Casting.h" | |||
21 | #include "llvm/Support/ErrorHandling.h" | |||
22 | #include <algorithm> | |||
23 | #include <cassert> | |||
24 | ||||
25 | using namespace clang; | |||
26 | ||||
27 | OMPClause::child_range OMPClause::children() { | |||
28 | switch (getClauseKind()) { | |||
29 | default: | |||
30 | break; | |||
31 | #define OPENMP_CLAUSE(Name, Class) \ | |||
32 | case OMPC_##Name: \ | |||
33 | return static_cast<Class *>(this)->children(); | |||
34 | #include "clang/Basic/OpenMPKinds.def" | |||
35 | } | |||
36 | llvm_unreachable("unknown OMPClause")::llvm::llvm_unreachable_internal("unknown OMPClause", "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 36); | |||
37 | } | |||
38 | ||||
39 | OMPClauseWithPreInit *OMPClauseWithPreInit::get(OMPClause *C) { | |||
40 | auto *Res = OMPClauseWithPreInit::get(const_cast<const OMPClause *>(C)); | |||
41 | return Res ? const_cast<OMPClauseWithPreInit *>(Res) : nullptr; | |||
42 | } | |||
43 | ||||
44 | const OMPClauseWithPreInit *OMPClauseWithPreInit::get(const OMPClause *C) { | |||
45 | switch (C->getClauseKind()) { | |||
46 | case OMPC_schedule: | |||
47 | return static_cast<const OMPScheduleClause *>(C); | |||
48 | case OMPC_dist_schedule: | |||
49 | return static_cast<const OMPDistScheduleClause *>(C); | |||
50 | case OMPC_firstprivate: | |||
51 | return static_cast<const OMPFirstprivateClause *>(C); | |||
52 | case OMPC_lastprivate: | |||
53 | return static_cast<const OMPLastprivateClause *>(C); | |||
54 | case OMPC_reduction: | |||
55 | return static_cast<const OMPReductionClause *>(C); | |||
56 | case OMPC_task_reduction: | |||
57 | return static_cast<const OMPTaskReductionClause *>(C); | |||
58 | case OMPC_in_reduction: | |||
59 | return static_cast<const OMPInReductionClause *>(C); | |||
60 | case OMPC_linear: | |||
61 | return static_cast<const OMPLinearClause *>(C); | |||
62 | case OMPC_if: | |||
63 | return static_cast<const OMPIfClause *>(C); | |||
64 | case OMPC_num_threads: | |||
65 | return static_cast<const OMPNumThreadsClause *>(C); | |||
66 | case OMPC_num_teams: | |||
67 | return static_cast<const OMPNumTeamsClause *>(C); | |||
68 | case OMPC_thread_limit: | |||
69 | return static_cast<const OMPThreadLimitClause *>(C); | |||
70 | case OMPC_device: | |||
71 | return static_cast<const OMPDeviceClause *>(C); | |||
72 | case OMPC_default: | |||
73 | case OMPC_proc_bind: | |||
74 | case OMPC_final: | |||
75 | case OMPC_safelen: | |||
76 | case OMPC_simdlen: | |||
77 | case OMPC_collapse: | |||
78 | case OMPC_private: | |||
79 | case OMPC_shared: | |||
80 | case OMPC_aligned: | |||
81 | case OMPC_copyin: | |||
82 | case OMPC_copyprivate: | |||
83 | case OMPC_ordered: | |||
84 | case OMPC_nowait: | |||
85 | case OMPC_untied: | |||
86 | case OMPC_mergeable: | |||
87 | case OMPC_threadprivate: | |||
88 | case OMPC_flush: | |||
89 | case OMPC_read: | |||
90 | case OMPC_write: | |||
91 | case OMPC_update: | |||
92 | case OMPC_capture: | |||
93 | case OMPC_seq_cst: | |||
94 | case OMPC_depend: | |||
95 | case OMPC_threads: | |||
96 | case OMPC_simd: | |||
97 | case OMPC_map: | |||
98 | case OMPC_priority: | |||
99 | case OMPC_grainsize: | |||
100 | case OMPC_nogroup: | |||
101 | case OMPC_num_tasks: | |||
102 | case OMPC_hint: | |||
103 | case OMPC_defaultmap: | |||
104 | case OMPC_unknown: | |||
105 | case OMPC_uniform: | |||
106 | case OMPC_to: | |||
107 | case OMPC_from: | |||
108 | case OMPC_use_device_ptr: | |||
109 | case OMPC_is_device_ptr: | |||
110 | case OMPC_unified_address: | |||
111 | case OMPC_unified_shared_memory: | |||
112 | case OMPC_reverse_offload: | |||
113 | case OMPC_dynamic_allocators: | |||
114 | case OMPC_atomic_default_mem_order: | |||
115 | break; | |||
116 | } | |||
117 | ||||
118 | return nullptr; | |||
119 | } | |||
120 | ||||
121 | OMPClauseWithPostUpdate *OMPClauseWithPostUpdate::get(OMPClause *C) { | |||
122 | auto *Res = OMPClauseWithPostUpdate::get(const_cast<const OMPClause *>(C)); | |||
123 | return Res ? const_cast<OMPClauseWithPostUpdate *>(Res) : nullptr; | |||
124 | } | |||
125 | ||||
126 | const OMPClauseWithPostUpdate *OMPClauseWithPostUpdate::get(const OMPClause *C) { | |||
127 | switch (C->getClauseKind()) { | |||
128 | case OMPC_lastprivate: | |||
129 | return static_cast<const OMPLastprivateClause *>(C); | |||
130 | case OMPC_reduction: | |||
131 | return static_cast<const OMPReductionClause *>(C); | |||
132 | case OMPC_task_reduction: | |||
133 | return static_cast<const OMPTaskReductionClause *>(C); | |||
134 | case OMPC_in_reduction: | |||
135 | return static_cast<const OMPInReductionClause *>(C); | |||
136 | case OMPC_linear: | |||
137 | return static_cast<const OMPLinearClause *>(C); | |||
138 | case OMPC_schedule: | |||
139 | case OMPC_dist_schedule: | |||
140 | case OMPC_firstprivate: | |||
141 | case OMPC_default: | |||
142 | case OMPC_proc_bind: | |||
143 | case OMPC_if: | |||
144 | case OMPC_final: | |||
145 | case OMPC_num_threads: | |||
146 | case OMPC_safelen: | |||
147 | case OMPC_simdlen: | |||
148 | case OMPC_collapse: | |||
149 | case OMPC_private: | |||
150 | case OMPC_shared: | |||
151 | case OMPC_aligned: | |||
152 | case OMPC_copyin: | |||
153 | case OMPC_copyprivate: | |||
154 | case OMPC_ordered: | |||
155 | case OMPC_nowait: | |||
156 | case OMPC_untied: | |||
157 | case OMPC_mergeable: | |||
158 | case OMPC_threadprivate: | |||
159 | case OMPC_flush: | |||
160 | case OMPC_read: | |||
161 | case OMPC_write: | |||
162 | case OMPC_update: | |||
163 | case OMPC_capture: | |||
164 | case OMPC_seq_cst: | |||
165 | case OMPC_depend: | |||
166 | case OMPC_device: | |||
167 | case OMPC_threads: | |||
168 | case OMPC_simd: | |||
169 | case OMPC_map: | |||
170 | case OMPC_num_teams: | |||
171 | case OMPC_thread_limit: | |||
172 | case OMPC_priority: | |||
173 | case OMPC_grainsize: | |||
174 | case OMPC_nogroup: | |||
175 | case OMPC_num_tasks: | |||
176 | case OMPC_hint: | |||
177 | case OMPC_defaultmap: | |||
178 | case OMPC_unknown: | |||
179 | case OMPC_uniform: | |||
180 | case OMPC_to: | |||
181 | case OMPC_from: | |||
182 | case OMPC_use_device_ptr: | |||
183 | case OMPC_is_device_ptr: | |||
184 | case OMPC_unified_address: | |||
185 | case OMPC_unified_shared_memory: | |||
186 | case OMPC_reverse_offload: | |||
187 | case OMPC_dynamic_allocators: | |||
188 | case OMPC_atomic_default_mem_order: | |||
189 | break; | |||
190 | } | |||
191 | ||||
192 | return nullptr; | |||
193 | } | |||
194 | ||||
195 | OMPOrderedClause *OMPOrderedClause::Create(const ASTContext &C, Expr *Num, | |||
196 | unsigned NumLoops, | |||
197 | SourceLocation StartLoc, | |||
198 | SourceLocation LParenLoc, | |||
199 | SourceLocation EndLoc) { | |||
200 | void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(2 * NumLoops)); | |||
201 | auto *Clause = | |||
202 | new (Mem) OMPOrderedClause(Num, NumLoops, StartLoc, LParenLoc, EndLoc); | |||
203 | for (unsigned I = 0; I < NumLoops; ++I) { | |||
204 | Clause->setLoopNumIterations(I, nullptr); | |||
205 | Clause->setLoopCounter(I, nullptr); | |||
206 | } | |||
207 | return Clause; | |||
208 | } | |||
209 | ||||
210 | OMPOrderedClause *OMPOrderedClause::CreateEmpty(const ASTContext &C, | |||
211 | unsigned NumLoops) { | |||
212 | void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(2 * NumLoops)); | |||
213 | auto *Clause = new (Mem) OMPOrderedClause(NumLoops); | |||
214 | for (unsigned I = 0; I < NumLoops; ++I) { | |||
215 | Clause->setLoopNumIterations(I, nullptr); | |||
216 | Clause->setLoopCounter(I, nullptr); | |||
217 | } | |||
218 | return Clause; | |||
219 | } | |||
220 | ||||
221 | void OMPOrderedClause::setLoopNumIterations(unsigned NumLoop, | |||
222 | Expr *NumIterations) { | |||
223 | assert(NumLoop < NumberOfLoops && "out of loops number.")((NumLoop < NumberOfLoops && "out of loops number." ) ? static_cast<void> (0) : __assert_fail ("NumLoop < NumberOfLoops && \"out of loops number.\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 223, __PRETTY_FUNCTION__)); | |||
224 | getTrailingObjects<Expr *>()[NumLoop] = NumIterations; | |||
225 | } | |||
226 | ||||
227 | ArrayRef<Expr *> OMPOrderedClause::getLoopNumIterations() const { | |||
228 | return llvm::makeArrayRef(getTrailingObjects<Expr *>(), NumberOfLoops); | |||
229 | } | |||
230 | ||||
231 | void OMPOrderedClause::setLoopCounter(unsigned NumLoop, Expr *Counter) { | |||
232 | assert(NumLoop < NumberOfLoops && "out of loops number.")((NumLoop < NumberOfLoops && "out of loops number." ) ? static_cast<void> (0) : __assert_fail ("NumLoop < NumberOfLoops && \"out of loops number.\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 232, __PRETTY_FUNCTION__)); | |||
233 | getTrailingObjects<Expr *>()[NumberOfLoops + NumLoop] = Counter; | |||
234 | } | |||
235 | ||||
236 | Expr *OMPOrderedClause::getLoopCounter(unsigned NumLoop) { | |||
237 | assert(NumLoop < NumberOfLoops && "out of loops number.")((NumLoop < NumberOfLoops && "out of loops number." ) ? static_cast<void> (0) : __assert_fail ("NumLoop < NumberOfLoops && \"out of loops number.\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 237, __PRETTY_FUNCTION__)); | |||
238 | return getTrailingObjects<Expr *>()[NumberOfLoops + NumLoop]; | |||
239 | } | |||
240 | ||||
241 | const Expr *OMPOrderedClause::getLoopCounter(unsigned NumLoop) const { | |||
242 | assert(NumLoop < NumberOfLoops && "out of loops number.")((NumLoop < NumberOfLoops && "out of loops number." ) ? static_cast<void> (0) : __assert_fail ("NumLoop < NumberOfLoops && \"out of loops number.\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 242, __PRETTY_FUNCTION__)); | |||
243 | return getTrailingObjects<Expr *>()[NumberOfLoops + NumLoop]; | |||
244 | } | |||
245 | ||||
246 | void OMPPrivateClause::setPrivateCopies(ArrayRef<Expr *> VL) { | |||
247 | assert(VL.size() == varlist_size() &&((VL.size() == varlist_size() && "Number of private copies is not the same as the preallocated buffer" ) ? static_cast<void> (0) : __assert_fail ("VL.size() == varlist_size() && \"Number of private copies is not the same as the preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 248, __PRETTY_FUNCTION__)) | |||
248 | "Number of private copies is not the same as the preallocated buffer")((VL.size() == varlist_size() && "Number of private copies is not the same as the preallocated buffer" ) ? static_cast<void> (0) : __assert_fail ("VL.size() == varlist_size() && \"Number of private copies is not the same as the preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 248, __PRETTY_FUNCTION__)); | |||
249 | std::copy(VL.begin(), VL.end(), varlist_end()); | |||
250 | } | |||
251 | ||||
252 | OMPPrivateClause * | |||
253 | OMPPrivateClause::Create(const ASTContext &C, SourceLocation StartLoc, | |||
254 | SourceLocation LParenLoc, SourceLocation EndLoc, | |||
255 | ArrayRef<Expr *> VL, ArrayRef<Expr *> PrivateVL) { | |||
256 | // Allocate space for private variables and initializer expressions. | |||
257 | void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(2 * VL.size())); | |||
258 | OMPPrivateClause *Clause = | |||
259 | new (Mem) OMPPrivateClause(StartLoc, LParenLoc, EndLoc, VL.size()); | |||
260 | Clause->setVarRefs(VL); | |||
261 | Clause->setPrivateCopies(PrivateVL); | |||
262 | return Clause; | |||
263 | } | |||
264 | ||||
265 | OMPPrivateClause *OMPPrivateClause::CreateEmpty(const ASTContext &C, | |||
266 | unsigned N) { | |||
267 | void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(2 * N)); | |||
268 | return new (Mem) OMPPrivateClause(N); | |||
269 | } | |||
270 | ||||
271 | void OMPFirstprivateClause::setPrivateCopies(ArrayRef<Expr *> VL) { | |||
272 | assert(VL.size() == varlist_size() &&((VL.size() == varlist_size() && "Number of private copies is not the same as the preallocated buffer" ) ? static_cast<void> (0) : __assert_fail ("VL.size() == varlist_size() && \"Number of private copies is not the same as the preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 273, __PRETTY_FUNCTION__)) | |||
273 | "Number of private copies is not the same as the preallocated buffer")((VL.size() == varlist_size() && "Number of private copies is not the same as the preallocated buffer" ) ? static_cast<void> (0) : __assert_fail ("VL.size() == varlist_size() && \"Number of private copies is not the same as the preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 273, __PRETTY_FUNCTION__)); | |||
274 | std::copy(VL.begin(), VL.end(), varlist_end()); | |||
275 | } | |||
276 | ||||
277 | void OMPFirstprivateClause::setInits(ArrayRef<Expr *> VL) { | |||
278 | assert(VL.size() == varlist_size() &&((VL.size() == varlist_size() && "Number of inits is not the same as the preallocated buffer" ) ? static_cast<void> (0) : __assert_fail ("VL.size() == varlist_size() && \"Number of inits is not the same as the preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 279, __PRETTY_FUNCTION__)) | |||
279 | "Number of inits is not the same as the preallocated buffer")((VL.size() == varlist_size() && "Number of inits is not the same as the preallocated buffer" ) ? static_cast<void> (0) : __assert_fail ("VL.size() == varlist_size() && \"Number of inits is not the same as the preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 279, __PRETTY_FUNCTION__)); | |||
280 | std::copy(VL.begin(), VL.end(), getPrivateCopies().end()); | |||
281 | } | |||
282 | ||||
283 | OMPFirstprivateClause * | |||
284 | OMPFirstprivateClause::Create(const ASTContext &C, SourceLocation StartLoc, | |||
285 | SourceLocation LParenLoc, SourceLocation EndLoc, | |||
286 | ArrayRef<Expr *> VL, ArrayRef<Expr *> PrivateVL, | |||
287 | ArrayRef<Expr *> InitVL, Stmt *PreInit) { | |||
288 | void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(3 * VL.size())); | |||
289 | OMPFirstprivateClause *Clause = | |||
290 | new (Mem) OMPFirstprivateClause(StartLoc, LParenLoc, EndLoc, VL.size()); | |||
291 | Clause->setVarRefs(VL); | |||
292 | Clause->setPrivateCopies(PrivateVL); | |||
293 | Clause->setInits(InitVL); | |||
294 | Clause->setPreInitStmt(PreInit); | |||
295 | return Clause; | |||
296 | } | |||
297 | ||||
298 | OMPFirstprivateClause *OMPFirstprivateClause::CreateEmpty(const ASTContext &C, | |||
299 | unsigned N) { | |||
300 | void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(3 * N)); | |||
301 | return new (Mem) OMPFirstprivateClause(N); | |||
302 | } | |||
303 | ||||
304 | void OMPLastprivateClause::setPrivateCopies(ArrayRef<Expr *> PrivateCopies) { | |||
305 | assert(PrivateCopies.size() == varlist_size() &&((PrivateCopies.size() == varlist_size() && "Number of private copies is not the same as the preallocated buffer" ) ? static_cast<void> (0) : __assert_fail ("PrivateCopies.size() == varlist_size() && \"Number of private copies is not the same as the preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 306, __PRETTY_FUNCTION__)) | |||
306 | "Number of private copies is not the same as the preallocated buffer")((PrivateCopies.size() == varlist_size() && "Number of private copies is not the same as the preallocated buffer" ) ? static_cast<void> (0) : __assert_fail ("PrivateCopies.size() == varlist_size() && \"Number of private copies is not the same as the preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 306, __PRETTY_FUNCTION__)); | |||
307 | std::copy(PrivateCopies.begin(), PrivateCopies.end(), varlist_end()); | |||
308 | } | |||
309 | ||||
310 | void OMPLastprivateClause::setSourceExprs(ArrayRef<Expr *> SrcExprs) { | |||
311 | assert(SrcExprs.size() == varlist_size() && "Number of source expressions is "((SrcExprs.size() == varlist_size() && "Number of source expressions is " "not the same as the " "preallocated buffer") ? static_cast< void> (0) : __assert_fail ("SrcExprs.size() == varlist_size() && \"Number of source expressions is \" \"not the same as the \" \"preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 313, __PRETTY_FUNCTION__)) | |||
312 | "not the same as the "((SrcExprs.size() == varlist_size() && "Number of source expressions is " "not the same as the " "preallocated buffer") ? static_cast< void> (0) : __assert_fail ("SrcExprs.size() == varlist_size() && \"Number of source expressions is \" \"not the same as the \" \"preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 313, __PRETTY_FUNCTION__)) | |||
313 | "preallocated buffer")((SrcExprs.size() == varlist_size() && "Number of source expressions is " "not the same as the " "preallocated buffer") ? static_cast< void> (0) : __assert_fail ("SrcExprs.size() == varlist_size() && \"Number of source expressions is \" \"not the same as the \" \"preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 313, __PRETTY_FUNCTION__)); | |||
314 | std::copy(SrcExprs.begin(), SrcExprs.end(), getPrivateCopies().end()); | |||
315 | } | |||
316 | ||||
317 | void OMPLastprivateClause::setDestinationExprs(ArrayRef<Expr *> DstExprs) { | |||
318 | assert(DstExprs.size() == varlist_size() && "Number of destination "((DstExprs.size() == varlist_size() && "Number of destination " "expressions is not the same as " "the preallocated buffer") ? static_cast<void> (0) : __assert_fail ("DstExprs.size() == varlist_size() && \"Number of destination \" \"expressions is not the same as \" \"the preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 320, __PRETTY_FUNCTION__)) | |||
319 | "expressions is not the same as "((DstExprs.size() == varlist_size() && "Number of destination " "expressions is not the same as " "the preallocated buffer") ? static_cast<void> (0) : __assert_fail ("DstExprs.size() == varlist_size() && \"Number of destination \" \"expressions is not the same as \" \"the preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 320, __PRETTY_FUNCTION__)) | |||
320 | "the preallocated buffer")((DstExprs.size() == varlist_size() && "Number of destination " "expressions is not the same as " "the preallocated buffer") ? static_cast<void> (0) : __assert_fail ("DstExprs.size() == varlist_size() && \"Number of destination \" \"expressions is not the same as \" \"the preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 320, __PRETTY_FUNCTION__)); | |||
321 | std::copy(DstExprs.begin(), DstExprs.end(), getSourceExprs().end()); | |||
322 | } | |||
323 | ||||
324 | void OMPLastprivateClause::setAssignmentOps(ArrayRef<Expr *> AssignmentOps) { | |||
325 | assert(AssignmentOps.size() == varlist_size() &&((AssignmentOps.size() == varlist_size() && "Number of assignment expressions is not the same as the preallocated " "buffer") ? static_cast<void> (0) : __assert_fail ("AssignmentOps.size() == varlist_size() && \"Number of assignment expressions is not the same as the preallocated \" \"buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 327, __PRETTY_FUNCTION__)) | |||
326 | "Number of assignment expressions is not the same as the preallocated "((AssignmentOps.size() == varlist_size() && "Number of assignment expressions is not the same as the preallocated " "buffer") ? static_cast<void> (0) : __assert_fail ("AssignmentOps.size() == varlist_size() && \"Number of assignment expressions is not the same as the preallocated \" \"buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 327, __PRETTY_FUNCTION__)) | |||
327 | "buffer")((AssignmentOps.size() == varlist_size() && "Number of assignment expressions is not the same as the preallocated " "buffer") ? static_cast<void> (0) : __assert_fail ("AssignmentOps.size() == varlist_size() && \"Number of assignment expressions is not the same as the preallocated \" \"buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 327, __PRETTY_FUNCTION__)); | |||
328 | std::copy(AssignmentOps.begin(), AssignmentOps.end(), | |||
329 | getDestinationExprs().end()); | |||
330 | } | |||
331 | ||||
332 | OMPLastprivateClause *OMPLastprivateClause::Create( | |||
333 | const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, | |||
334 | SourceLocation EndLoc, ArrayRef<Expr *> VL, ArrayRef<Expr *> SrcExprs, | |||
335 | ArrayRef<Expr *> DstExprs, ArrayRef<Expr *> AssignmentOps, Stmt *PreInit, | |||
336 | Expr *PostUpdate) { | |||
337 | void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(5 * VL.size())); | |||
338 | OMPLastprivateClause *Clause = | |||
339 | new (Mem) OMPLastprivateClause(StartLoc, LParenLoc, EndLoc, VL.size()); | |||
340 | Clause->setVarRefs(VL); | |||
341 | Clause->setSourceExprs(SrcExprs); | |||
342 | Clause->setDestinationExprs(DstExprs); | |||
343 | Clause->setAssignmentOps(AssignmentOps); | |||
344 | Clause->setPreInitStmt(PreInit); | |||
345 | Clause->setPostUpdateExpr(PostUpdate); | |||
346 | return Clause; | |||
347 | } | |||
348 | ||||
349 | OMPLastprivateClause *OMPLastprivateClause::CreateEmpty(const ASTContext &C, | |||
350 | unsigned N) { | |||
351 | void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(5 * N)); | |||
352 | return new (Mem) OMPLastprivateClause(N); | |||
353 | } | |||
354 | ||||
355 | OMPSharedClause *OMPSharedClause::Create(const ASTContext &C, | |||
356 | SourceLocation StartLoc, | |||
357 | SourceLocation LParenLoc, | |||
358 | SourceLocation EndLoc, | |||
359 | ArrayRef<Expr *> VL) { | |||
360 | void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(VL.size())); | |||
361 | OMPSharedClause *Clause = | |||
362 | new (Mem) OMPSharedClause(StartLoc, LParenLoc, EndLoc, VL.size()); | |||
363 | Clause->setVarRefs(VL); | |||
364 | return Clause; | |||
365 | } | |||
366 | ||||
367 | OMPSharedClause *OMPSharedClause::CreateEmpty(const ASTContext &C, unsigned N) { | |||
368 | void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(N)); | |||
369 | return new (Mem) OMPSharedClause(N); | |||
370 | } | |||
371 | ||||
372 | void OMPLinearClause::setPrivates(ArrayRef<Expr *> PL) { | |||
373 | assert(PL.size() == varlist_size() &&((PL.size() == varlist_size() && "Number of privates is not the same as the preallocated buffer" ) ? static_cast<void> (0) : __assert_fail ("PL.size() == varlist_size() && \"Number of privates is not the same as the preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 374, __PRETTY_FUNCTION__)) | |||
374 | "Number of privates is not the same as the preallocated buffer")((PL.size() == varlist_size() && "Number of privates is not the same as the preallocated buffer" ) ? static_cast<void> (0) : __assert_fail ("PL.size() == varlist_size() && \"Number of privates is not the same as the preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 374, __PRETTY_FUNCTION__)); | |||
375 | std::copy(PL.begin(), PL.end(), varlist_end()); | |||
376 | } | |||
377 | ||||
378 | void OMPLinearClause::setInits(ArrayRef<Expr *> IL) { | |||
379 | assert(IL.size() == varlist_size() &&((IL.size() == varlist_size() && "Number of inits is not the same as the preallocated buffer" ) ? static_cast<void> (0) : __assert_fail ("IL.size() == varlist_size() && \"Number of inits is not the same as the preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 380, __PRETTY_FUNCTION__)) | |||
380 | "Number of inits is not the same as the preallocated buffer")((IL.size() == varlist_size() && "Number of inits is not the same as the preallocated buffer" ) ? static_cast<void> (0) : __assert_fail ("IL.size() == varlist_size() && \"Number of inits is not the same as the preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 380, __PRETTY_FUNCTION__)); | |||
381 | std::copy(IL.begin(), IL.end(), getPrivates().end()); | |||
382 | } | |||
383 | ||||
384 | void OMPLinearClause::setUpdates(ArrayRef<Expr *> UL) { | |||
385 | assert(UL.size() == varlist_size() &&((UL.size() == varlist_size() && "Number of updates is not the same as the preallocated buffer" ) ? static_cast<void> (0) : __assert_fail ("UL.size() == varlist_size() && \"Number of updates is not the same as the preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 386, __PRETTY_FUNCTION__)) | |||
386 | "Number of updates is not the same as the preallocated buffer")((UL.size() == varlist_size() && "Number of updates is not the same as the preallocated buffer" ) ? static_cast<void> (0) : __assert_fail ("UL.size() == varlist_size() && \"Number of updates is not the same as the preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 386, __PRETTY_FUNCTION__)); | |||
387 | std::copy(UL.begin(), UL.end(), getInits().end()); | |||
388 | } | |||
389 | ||||
390 | void OMPLinearClause::setFinals(ArrayRef<Expr *> FL) { | |||
391 | assert(FL.size() == varlist_size() &&((FL.size() == varlist_size() && "Number of final updates is not the same as the preallocated buffer" ) ? static_cast<void> (0) : __assert_fail ("FL.size() == varlist_size() && \"Number of final updates is not the same as the preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 392, __PRETTY_FUNCTION__)) | |||
392 | "Number of final updates is not the same as the preallocated buffer")((FL.size() == varlist_size() && "Number of final updates is not the same as the preallocated buffer" ) ? static_cast<void> (0) : __assert_fail ("FL.size() == varlist_size() && \"Number of final updates is not the same as the preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 392, __PRETTY_FUNCTION__)); | |||
393 | std::copy(FL.begin(), FL.end(), getUpdates().end()); | |||
394 | } | |||
395 | ||||
396 | OMPLinearClause *OMPLinearClause::Create( | |||
397 | const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, | |||
398 | OpenMPLinearClauseKind Modifier, SourceLocation ModifierLoc, | |||
399 | SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef<Expr *> VL, | |||
400 | ArrayRef<Expr *> PL, ArrayRef<Expr *> IL, Expr *Step, Expr *CalcStep, | |||
401 | Stmt *PreInit, Expr *PostUpdate) { | |||
402 | // Allocate space for 4 lists (Vars, Inits, Updates, Finals) and 2 expressions | |||
403 | // (Step and CalcStep). | |||
404 | void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(5 * VL.size() + 2)); | |||
405 | OMPLinearClause *Clause = new (Mem) OMPLinearClause( | |||
406 | StartLoc, LParenLoc, Modifier, ModifierLoc, ColonLoc, EndLoc, VL.size()); | |||
407 | Clause->setVarRefs(VL); | |||
408 | Clause->setPrivates(PL); | |||
409 | Clause->setInits(IL); | |||
410 | // Fill update and final expressions with zeroes, they are provided later, | |||
411 | // after the directive construction. | |||
412 | std::fill(Clause->getInits().end(), Clause->getInits().end() + VL.size(), | |||
413 | nullptr); | |||
414 | std::fill(Clause->getUpdates().end(), Clause->getUpdates().end() + VL.size(), | |||
415 | nullptr); | |||
416 | Clause->setStep(Step); | |||
417 | Clause->setCalcStep(CalcStep); | |||
418 | Clause->setPreInitStmt(PreInit); | |||
419 | Clause->setPostUpdateExpr(PostUpdate); | |||
420 | return Clause; | |||
421 | } | |||
422 | ||||
423 | OMPLinearClause *OMPLinearClause::CreateEmpty(const ASTContext &C, | |||
424 | unsigned NumVars) { | |||
425 | // Allocate space for 4 lists (Vars, Inits, Updates, Finals) and 2 expressions | |||
426 | // (Step and CalcStep). | |||
427 | void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(5 * NumVars + 2)); | |||
428 | return new (Mem) OMPLinearClause(NumVars); | |||
429 | } | |||
430 | ||||
431 | OMPAlignedClause * | |||
432 | OMPAlignedClause::Create(const ASTContext &C, SourceLocation StartLoc, | |||
433 | SourceLocation LParenLoc, SourceLocation ColonLoc, | |||
434 | SourceLocation EndLoc, ArrayRef<Expr *> VL, Expr *A) { | |||
435 | void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(VL.size() + 1)); | |||
436 | OMPAlignedClause *Clause = new (Mem) | |||
437 | OMPAlignedClause(StartLoc, LParenLoc, ColonLoc, EndLoc, VL.size()); | |||
438 | Clause->setVarRefs(VL); | |||
439 | Clause->setAlignment(A); | |||
440 | return Clause; | |||
441 | } | |||
442 | ||||
443 | OMPAlignedClause *OMPAlignedClause::CreateEmpty(const ASTContext &C, | |||
444 | unsigned NumVars) { | |||
445 | void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(NumVars + 1)); | |||
446 | return new (Mem) OMPAlignedClause(NumVars); | |||
447 | } | |||
448 | ||||
449 | void OMPCopyinClause::setSourceExprs(ArrayRef<Expr *> SrcExprs) { | |||
450 | assert(SrcExprs.size() == varlist_size() && "Number of source expressions is "((SrcExprs.size() == varlist_size() && "Number of source expressions is " "not the same as the " "preallocated buffer") ? static_cast< void> (0) : __assert_fail ("SrcExprs.size() == varlist_size() && \"Number of source expressions is \" \"not the same as the \" \"preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 452, __PRETTY_FUNCTION__)) | |||
451 | "not the same as the "((SrcExprs.size() == varlist_size() && "Number of source expressions is " "not the same as the " "preallocated buffer") ? static_cast< void> (0) : __assert_fail ("SrcExprs.size() == varlist_size() && \"Number of source expressions is \" \"not the same as the \" \"preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 452, __PRETTY_FUNCTION__)) | |||
452 | "preallocated buffer")((SrcExprs.size() == varlist_size() && "Number of source expressions is " "not the same as the " "preallocated buffer") ? static_cast< void> (0) : __assert_fail ("SrcExprs.size() == varlist_size() && \"Number of source expressions is \" \"not the same as the \" \"preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 452, __PRETTY_FUNCTION__)); | |||
453 | std::copy(SrcExprs.begin(), SrcExprs.end(), varlist_end()); | |||
454 | } | |||
455 | ||||
456 | void OMPCopyinClause::setDestinationExprs(ArrayRef<Expr *> DstExprs) { | |||
457 | assert(DstExprs.size() == varlist_size() && "Number of destination "((DstExprs.size() == varlist_size() && "Number of destination " "expressions is not the same as " "the preallocated buffer") ? static_cast<void> (0) : __assert_fail ("DstExprs.size() == varlist_size() && \"Number of destination \" \"expressions is not the same as \" \"the preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 459, __PRETTY_FUNCTION__)) | |||
458 | "expressions is not the same as "((DstExprs.size() == varlist_size() && "Number of destination " "expressions is not the same as " "the preallocated buffer") ? static_cast<void> (0) : __assert_fail ("DstExprs.size() == varlist_size() && \"Number of destination \" \"expressions is not the same as \" \"the preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 459, __PRETTY_FUNCTION__)) | |||
459 | "the preallocated buffer")((DstExprs.size() == varlist_size() && "Number of destination " "expressions is not the same as " "the preallocated buffer") ? static_cast<void> (0) : __assert_fail ("DstExprs.size() == varlist_size() && \"Number of destination \" \"expressions is not the same as \" \"the preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 459, __PRETTY_FUNCTION__)); | |||
460 | std::copy(DstExprs.begin(), DstExprs.end(), getSourceExprs().end()); | |||
461 | } | |||
462 | ||||
463 | void OMPCopyinClause::setAssignmentOps(ArrayRef<Expr *> AssignmentOps) { | |||
464 | assert(AssignmentOps.size() == varlist_size() &&((AssignmentOps.size() == varlist_size() && "Number of assignment expressions is not the same as the preallocated " "buffer") ? static_cast<void> (0) : __assert_fail ("AssignmentOps.size() == varlist_size() && \"Number of assignment expressions is not the same as the preallocated \" \"buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 466, __PRETTY_FUNCTION__)) | |||
465 | "Number of assignment expressions is not the same as the preallocated "((AssignmentOps.size() == varlist_size() && "Number of assignment expressions is not the same as the preallocated " "buffer") ? static_cast<void> (0) : __assert_fail ("AssignmentOps.size() == varlist_size() && \"Number of assignment expressions is not the same as the preallocated \" \"buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 466, __PRETTY_FUNCTION__)) | |||
466 | "buffer")((AssignmentOps.size() == varlist_size() && "Number of assignment expressions is not the same as the preallocated " "buffer") ? static_cast<void> (0) : __assert_fail ("AssignmentOps.size() == varlist_size() && \"Number of assignment expressions is not the same as the preallocated \" \"buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 466, __PRETTY_FUNCTION__)); | |||
467 | std::copy(AssignmentOps.begin(), AssignmentOps.end(), | |||
468 | getDestinationExprs().end()); | |||
469 | } | |||
470 | ||||
471 | OMPCopyinClause *OMPCopyinClause::Create( | |||
472 | const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, | |||
473 | SourceLocation EndLoc, ArrayRef<Expr *> VL, ArrayRef<Expr *> SrcExprs, | |||
474 | ArrayRef<Expr *> DstExprs, ArrayRef<Expr *> AssignmentOps) { | |||
475 | void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(4 * VL.size())); | |||
476 | OMPCopyinClause *Clause = | |||
477 | new (Mem) OMPCopyinClause(StartLoc, LParenLoc, EndLoc, VL.size()); | |||
478 | Clause->setVarRefs(VL); | |||
479 | Clause->setSourceExprs(SrcExprs); | |||
480 | Clause->setDestinationExprs(DstExprs); | |||
481 | Clause->setAssignmentOps(AssignmentOps); | |||
482 | return Clause; | |||
483 | } | |||
484 | ||||
485 | OMPCopyinClause *OMPCopyinClause::CreateEmpty(const ASTContext &C, unsigned N) { | |||
486 | void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(4 * N)); | |||
487 | return new (Mem) OMPCopyinClause(N); | |||
488 | } | |||
489 | ||||
490 | void OMPCopyprivateClause::setSourceExprs(ArrayRef<Expr *> SrcExprs) { | |||
491 | assert(SrcExprs.size() == varlist_size() && "Number of source expressions is "((SrcExprs.size() == varlist_size() && "Number of source expressions is " "not the same as the " "preallocated buffer") ? static_cast< void> (0) : __assert_fail ("SrcExprs.size() == varlist_size() && \"Number of source expressions is \" \"not the same as the \" \"preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 493, __PRETTY_FUNCTION__)) | |||
492 | "not the same as the "((SrcExprs.size() == varlist_size() && "Number of source expressions is " "not the same as the " "preallocated buffer") ? static_cast< void> (0) : __assert_fail ("SrcExprs.size() == varlist_size() && \"Number of source expressions is \" \"not the same as the \" \"preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 493, __PRETTY_FUNCTION__)) | |||
493 | "preallocated buffer")((SrcExprs.size() == varlist_size() && "Number of source expressions is " "not the same as the " "preallocated buffer") ? static_cast< void> (0) : __assert_fail ("SrcExprs.size() == varlist_size() && \"Number of source expressions is \" \"not the same as the \" \"preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 493, __PRETTY_FUNCTION__)); | |||
494 | std::copy(SrcExprs.begin(), SrcExprs.end(), varlist_end()); | |||
495 | } | |||
496 | ||||
497 | void OMPCopyprivateClause::setDestinationExprs(ArrayRef<Expr *> DstExprs) { | |||
498 | assert(DstExprs.size() == varlist_size() && "Number of destination "((DstExprs.size() == varlist_size() && "Number of destination " "expressions is not the same as " "the preallocated buffer") ? static_cast<void> (0) : __assert_fail ("DstExprs.size() == varlist_size() && \"Number of destination \" \"expressions is not the same as \" \"the preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 500, __PRETTY_FUNCTION__)) | |||
499 | "expressions is not the same as "((DstExprs.size() == varlist_size() && "Number of destination " "expressions is not the same as " "the preallocated buffer") ? static_cast<void> (0) : __assert_fail ("DstExprs.size() == varlist_size() && \"Number of destination \" \"expressions is not the same as \" \"the preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 500, __PRETTY_FUNCTION__)) | |||
500 | "the preallocated buffer")((DstExprs.size() == varlist_size() && "Number of destination " "expressions is not the same as " "the preallocated buffer") ? static_cast<void> (0) : __assert_fail ("DstExprs.size() == varlist_size() && \"Number of destination \" \"expressions is not the same as \" \"the preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 500, __PRETTY_FUNCTION__)); | |||
501 | std::copy(DstExprs.begin(), DstExprs.end(), getSourceExprs().end()); | |||
502 | } | |||
503 | ||||
504 | void OMPCopyprivateClause::setAssignmentOps(ArrayRef<Expr *> AssignmentOps) { | |||
505 | assert(AssignmentOps.size() == varlist_size() &&((AssignmentOps.size() == varlist_size() && "Number of assignment expressions is not the same as the preallocated " "buffer") ? static_cast<void> (0) : __assert_fail ("AssignmentOps.size() == varlist_size() && \"Number of assignment expressions is not the same as the preallocated \" \"buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 507, __PRETTY_FUNCTION__)) | |||
506 | "Number of assignment expressions is not the same as the preallocated "((AssignmentOps.size() == varlist_size() && "Number of assignment expressions is not the same as the preallocated " "buffer") ? static_cast<void> (0) : __assert_fail ("AssignmentOps.size() == varlist_size() && \"Number of assignment expressions is not the same as the preallocated \" \"buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 507, __PRETTY_FUNCTION__)) | |||
507 | "buffer")((AssignmentOps.size() == varlist_size() && "Number of assignment expressions is not the same as the preallocated " "buffer") ? static_cast<void> (0) : __assert_fail ("AssignmentOps.size() == varlist_size() && \"Number of assignment expressions is not the same as the preallocated \" \"buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 507, __PRETTY_FUNCTION__)); | |||
508 | std::copy(AssignmentOps.begin(), AssignmentOps.end(), | |||
509 | getDestinationExprs().end()); | |||
510 | } | |||
511 | ||||
512 | OMPCopyprivateClause *OMPCopyprivateClause::Create( | |||
513 | const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, | |||
514 | SourceLocation EndLoc, ArrayRef<Expr *> VL, ArrayRef<Expr *> SrcExprs, | |||
515 | ArrayRef<Expr *> DstExprs, ArrayRef<Expr *> AssignmentOps) { | |||
516 | void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(4 * VL.size())); | |||
517 | OMPCopyprivateClause *Clause = | |||
518 | new (Mem) OMPCopyprivateClause(StartLoc, LParenLoc, EndLoc, VL.size()); | |||
519 | Clause->setVarRefs(VL); | |||
520 | Clause->setSourceExprs(SrcExprs); | |||
521 | Clause->setDestinationExprs(DstExprs); | |||
522 | Clause->setAssignmentOps(AssignmentOps); | |||
523 | return Clause; | |||
524 | } | |||
525 | ||||
526 | OMPCopyprivateClause *OMPCopyprivateClause::CreateEmpty(const ASTContext &C, | |||
527 | unsigned N) { | |||
528 | void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(4 * N)); | |||
529 | return new (Mem) OMPCopyprivateClause(N); | |||
530 | } | |||
531 | ||||
532 | void OMPReductionClause::setPrivates(ArrayRef<Expr *> Privates) { | |||
533 | assert(Privates.size() == varlist_size() &&((Privates.size() == varlist_size() && "Number of private copies is not the same as the preallocated buffer" ) ? static_cast<void> (0) : __assert_fail ("Privates.size() == varlist_size() && \"Number of private copies is not the same as the preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 534, __PRETTY_FUNCTION__)) | |||
534 | "Number of private copies is not the same as the preallocated buffer")((Privates.size() == varlist_size() && "Number of private copies is not the same as the preallocated buffer" ) ? static_cast<void> (0) : __assert_fail ("Privates.size() == varlist_size() && \"Number of private copies is not the same as the preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 534, __PRETTY_FUNCTION__)); | |||
535 | std::copy(Privates.begin(), Privates.end(), varlist_end()); | |||
536 | } | |||
537 | ||||
538 | void OMPReductionClause::setLHSExprs(ArrayRef<Expr *> LHSExprs) { | |||
539 | assert(((LHSExprs.size() == varlist_size() && "Number of LHS expressions is not the same as the preallocated buffer" ) ? static_cast<void> (0) : __assert_fail ("LHSExprs.size() == varlist_size() && \"Number of LHS expressions is not the same as the preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 541, __PRETTY_FUNCTION__)) | |||
540 | LHSExprs.size() == varlist_size() &&((LHSExprs.size() == varlist_size() && "Number of LHS expressions is not the same as the preallocated buffer" ) ? static_cast<void> (0) : __assert_fail ("LHSExprs.size() == varlist_size() && \"Number of LHS expressions is not the same as the preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 541, __PRETTY_FUNCTION__)) | |||
541 | "Number of LHS expressions is not the same as the preallocated buffer")((LHSExprs.size() == varlist_size() && "Number of LHS expressions is not the same as the preallocated buffer" ) ? static_cast<void> (0) : __assert_fail ("LHSExprs.size() == varlist_size() && \"Number of LHS expressions is not the same as the preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 541, __PRETTY_FUNCTION__)); | |||
542 | std::copy(LHSExprs.begin(), LHSExprs.end(), getPrivates().end()); | |||
543 | } | |||
544 | ||||
545 | void OMPReductionClause::setRHSExprs(ArrayRef<Expr *> RHSExprs) { | |||
546 | assert(((RHSExprs.size() == varlist_size() && "Number of RHS expressions is not the same as the preallocated buffer" ) ? static_cast<void> (0) : __assert_fail ("RHSExprs.size() == varlist_size() && \"Number of RHS expressions is not the same as the preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 548, __PRETTY_FUNCTION__)) | |||
547 | RHSExprs.size() == varlist_size() &&((RHSExprs.size() == varlist_size() && "Number of RHS expressions is not the same as the preallocated buffer" ) ? static_cast<void> (0) : __assert_fail ("RHSExprs.size() == varlist_size() && \"Number of RHS expressions is not the same as the preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 548, __PRETTY_FUNCTION__)) | |||
548 | "Number of RHS expressions is not the same as the preallocated buffer")((RHSExprs.size() == varlist_size() && "Number of RHS expressions is not the same as the preallocated buffer" ) ? static_cast<void> (0) : __assert_fail ("RHSExprs.size() == varlist_size() && \"Number of RHS expressions is not the same as the preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 548, __PRETTY_FUNCTION__)); | |||
549 | std::copy(RHSExprs.begin(), RHSExprs.end(), getLHSExprs().end()); | |||
550 | } | |||
551 | ||||
552 | void OMPReductionClause::setReductionOps(ArrayRef<Expr *> ReductionOps) { | |||
553 | assert(ReductionOps.size() == varlist_size() && "Number of reduction "((ReductionOps.size() == varlist_size() && "Number of reduction " "expressions is not the same " "as the preallocated buffer") ? static_cast<void> (0) : __assert_fail ("ReductionOps.size() == varlist_size() && \"Number of reduction \" \"expressions is not the same \" \"as the preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 555, __PRETTY_FUNCTION__)) | |||
554 | "expressions is not the same "((ReductionOps.size() == varlist_size() && "Number of reduction " "expressions is not the same " "as the preallocated buffer") ? static_cast<void> (0) : __assert_fail ("ReductionOps.size() == varlist_size() && \"Number of reduction \" \"expressions is not the same \" \"as the preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 555, __PRETTY_FUNCTION__)) | |||
555 | "as the preallocated buffer")((ReductionOps.size() == varlist_size() && "Number of reduction " "expressions is not the same " "as the preallocated buffer") ? static_cast<void> (0) : __assert_fail ("ReductionOps.size() == varlist_size() && \"Number of reduction \" \"expressions is not the same \" \"as the preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 555, __PRETTY_FUNCTION__)); | |||
556 | std::copy(ReductionOps.begin(), ReductionOps.end(), getRHSExprs().end()); | |||
557 | } | |||
558 | ||||
559 | OMPReductionClause *OMPReductionClause::Create( | |||
560 | const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, | |||
561 | SourceLocation EndLoc, SourceLocation ColonLoc, ArrayRef<Expr *> VL, | |||
562 | NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, | |||
563 | ArrayRef<Expr *> Privates, ArrayRef<Expr *> LHSExprs, | |||
564 | ArrayRef<Expr *> RHSExprs, ArrayRef<Expr *> ReductionOps, Stmt *PreInit, | |||
565 | Expr *PostUpdate) { | |||
566 | void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(5 * VL.size())); | |||
567 | OMPReductionClause *Clause = new (Mem) OMPReductionClause( | |||
568 | StartLoc, LParenLoc, EndLoc, ColonLoc, VL.size(), QualifierLoc, NameInfo); | |||
569 | Clause->setVarRefs(VL); | |||
570 | Clause->setPrivates(Privates); | |||
571 | Clause->setLHSExprs(LHSExprs); | |||
572 | Clause->setRHSExprs(RHSExprs); | |||
573 | Clause->setReductionOps(ReductionOps); | |||
574 | Clause->setPreInitStmt(PreInit); | |||
575 | Clause->setPostUpdateExpr(PostUpdate); | |||
576 | return Clause; | |||
577 | } | |||
578 | ||||
579 | OMPReductionClause *OMPReductionClause::CreateEmpty(const ASTContext &C, | |||
580 | unsigned N) { | |||
581 | void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(5 * N)); | |||
582 | return new (Mem) OMPReductionClause(N); | |||
583 | } | |||
584 | ||||
585 | void OMPTaskReductionClause::setPrivates(ArrayRef<Expr *> Privates) { | |||
586 | assert(Privates.size() == varlist_size() &&((Privates.size() == varlist_size() && "Number of private copies is not the same as the preallocated buffer" ) ? static_cast<void> (0) : __assert_fail ("Privates.size() == varlist_size() && \"Number of private copies is not the same as the preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 587, __PRETTY_FUNCTION__)) | |||
587 | "Number of private copies is not the same as the preallocated buffer")((Privates.size() == varlist_size() && "Number of private copies is not the same as the preallocated buffer" ) ? static_cast<void> (0) : __assert_fail ("Privates.size() == varlist_size() && \"Number of private copies is not the same as the preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 587, __PRETTY_FUNCTION__)); | |||
588 | std::copy(Privates.begin(), Privates.end(), varlist_end()); | |||
589 | } | |||
590 | ||||
591 | void OMPTaskReductionClause::setLHSExprs(ArrayRef<Expr *> LHSExprs) { | |||
592 | assert(((LHSExprs.size() == varlist_size() && "Number of LHS expressions is not the same as the preallocated buffer" ) ? static_cast<void> (0) : __assert_fail ("LHSExprs.size() == varlist_size() && \"Number of LHS expressions is not the same as the preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 594, __PRETTY_FUNCTION__)) | |||
593 | LHSExprs.size() == varlist_size() &&((LHSExprs.size() == varlist_size() && "Number of LHS expressions is not the same as the preallocated buffer" ) ? static_cast<void> (0) : __assert_fail ("LHSExprs.size() == varlist_size() && \"Number of LHS expressions is not the same as the preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 594, __PRETTY_FUNCTION__)) | |||
594 | "Number of LHS expressions is not the same as the preallocated buffer")((LHSExprs.size() == varlist_size() && "Number of LHS expressions is not the same as the preallocated buffer" ) ? static_cast<void> (0) : __assert_fail ("LHSExprs.size() == varlist_size() && \"Number of LHS expressions is not the same as the preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 594, __PRETTY_FUNCTION__)); | |||
595 | std::copy(LHSExprs.begin(), LHSExprs.end(), getPrivates().end()); | |||
596 | } | |||
597 | ||||
598 | void OMPTaskReductionClause::setRHSExprs(ArrayRef<Expr *> RHSExprs) { | |||
599 | assert(((RHSExprs.size() == varlist_size() && "Number of RHS expressions is not the same as the preallocated buffer" ) ? static_cast<void> (0) : __assert_fail ("RHSExprs.size() == varlist_size() && \"Number of RHS expressions is not the same as the preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 601, __PRETTY_FUNCTION__)) | |||
600 | RHSExprs.size() == varlist_size() &&((RHSExprs.size() == varlist_size() && "Number of RHS expressions is not the same as the preallocated buffer" ) ? static_cast<void> (0) : __assert_fail ("RHSExprs.size() == varlist_size() && \"Number of RHS expressions is not the same as the preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 601, __PRETTY_FUNCTION__)) | |||
601 | "Number of RHS expressions is not the same as the preallocated buffer")((RHSExprs.size() == varlist_size() && "Number of RHS expressions is not the same as the preallocated buffer" ) ? static_cast<void> (0) : __assert_fail ("RHSExprs.size() == varlist_size() && \"Number of RHS expressions is not the same as the preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 601, __PRETTY_FUNCTION__)); | |||
602 | std::copy(RHSExprs.begin(), RHSExprs.end(), getLHSExprs().end()); | |||
603 | } | |||
604 | ||||
605 | void OMPTaskReductionClause::setReductionOps(ArrayRef<Expr *> ReductionOps) { | |||
606 | assert(ReductionOps.size() == varlist_size() && "Number of task reduction "((ReductionOps.size() == varlist_size() && "Number of task reduction " "expressions is not the same " "as the preallocated buffer") ? static_cast<void> (0) : __assert_fail ("ReductionOps.size() == varlist_size() && \"Number of task reduction \" \"expressions is not the same \" \"as the preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 608, __PRETTY_FUNCTION__)) | |||
607 | "expressions is not the same "((ReductionOps.size() == varlist_size() && "Number of task reduction " "expressions is not the same " "as the preallocated buffer") ? static_cast<void> (0) : __assert_fail ("ReductionOps.size() == varlist_size() && \"Number of task reduction \" \"expressions is not the same \" \"as the preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 608, __PRETTY_FUNCTION__)) | |||
608 | "as the preallocated buffer")((ReductionOps.size() == varlist_size() && "Number of task reduction " "expressions is not the same " "as the preallocated buffer") ? static_cast<void> (0) : __assert_fail ("ReductionOps.size() == varlist_size() && \"Number of task reduction \" \"expressions is not the same \" \"as the preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 608, __PRETTY_FUNCTION__)); | |||
609 | std::copy(ReductionOps.begin(), ReductionOps.end(), getRHSExprs().end()); | |||
610 | } | |||
611 | ||||
612 | OMPTaskReductionClause *OMPTaskReductionClause::Create( | |||
613 | const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, | |||
614 | SourceLocation EndLoc, SourceLocation ColonLoc, ArrayRef<Expr *> VL, | |||
615 | NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, | |||
616 | ArrayRef<Expr *> Privates, ArrayRef<Expr *> LHSExprs, | |||
617 | ArrayRef<Expr *> RHSExprs, ArrayRef<Expr *> ReductionOps, Stmt *PreInit, | |||
618 | Expr *PostUpdate) { | |||
619 | void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(5 * VL.size())); | |||
620 | OMPTaskReductionClause *Clause = new (Mem) OMPTaskReductionClause( | |||
621 | StartLoc, LParenLoc, EndLoc, ColonLoc, VL.size(), QualifierLoc, NameInfo); | |||
622 | Clause->setVarRefs(VL); | |||
623 | Clause->setPrivates(Privates); | |||
624 | Clause->setLHSExprs(LHSExprs); | |||
625 | Clause->setRHSExprs(RHSExprs); | |||
626 | Clause->setReductionOps(ReductionOps); | |||
627 | Clause->setPreInitStmt(PreInit); | |||
628 | Clause->setPostUpdateExpr(PostUpdate); | |||
629 | return Clause; | |||
630 | } | |||
631 | ||||
632 | OMPTaskReductionClause *OMPTaskReductionClause::CreateEmpty(const ASTContext &C, | |||
633 | unsigned N) { | |||
634 | void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(5 * N)); | |||
635 | return new (Mem) OMPTaskReductionClause(N); | |||
636 | } | |||
637 | ||||
638 | void OMPInReductionClause::setPrivates(ArrayRef<Expr *> Privates) { | |||
639 | assert(Privates.size() == varlist_size() &&((Privates.size() == varlist_size() && "Number of private copies is not the same as the preallocated buffer" ) ? static_cast<void> (0) : __assert_fail ("Privates.size() == varlist_size() && \"Number of private copies is not the same as the preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 640, __PRETTY_FUNCTION__)) | |||
640 | "Number of private copies is not the same as the preallocated buffer")((Privates.size() == varlist_size() && "Number of private copies is not the same as the preallocated buffer" ) ? static_cast<void> (0) : __assert_fail ("Privates.size() == varlist_size() && \"Number of private copies is not the same as the preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 640, __PRETTY_FUNCTION__)); | |||
641 | std::copy(Privates.begin(), Privates.end(), varlist_end()); | |||
642 | } | |||
643 | ||||
644 | void OMPInReductionClause::setLHSExprs(ArrayRef<Expr *> LHSExprs) { | |||
645 | assert(((LHSExprs.size() == varlist_size() && "Number of LHS expressions is not the same as the preallocated buffer" ) ? static_cast<void> (0) : __assert_fail ("LHSExprs.size() == varlist_size() && \"Number of LHS expressions is not the same as the preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 647, __PRETTY_FUNCTION__)) | |||
646 | LHSExprs.size() == varlist_size() &&((LHSExprs.size() == varlist_size() && "Number of LHS expressions is not the same as the preallocated buffer" ) ? static_cast<void> (0) : __assert_fail ("LHSExprs.size() == varlist_size() && \"Number of LHS expressions is not the same as the preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 647, __PRETTY_FUNCTION__)) | |||
647 | "Number of LHS expressions is not the same as the preallocated buffer")((LHSExprs.size() == varlist_size() && "Number of LHS expressions is not the same as the preallocated buffer" ) ? static_cast<void> (0) : __assert_fail ("LHSExprs.size() == varlist_size() && \"Number of LHS expressions is not the same as the preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 647, __PRETTY_FUNCTION__)); | |||
648 | std::copy(LHSExprs.begin(), LHSExprs.end(), getPrivates().end()); | |||
649 | } | |||
650 | ||||
651 | void OMPInReductionClause::setRHSExprs(ArrayRef<Expr *> RHSExprs) { | |||
652 | assert(((RHSExprs.size() == varlist_size() && "Number of RHS expressions is not the same as the preallocated buffer" ) ? static_cast<void> (0) : __assert_fail ("RHSExprs.size() == varlist_size() && \"Number of RHS expressions is not the same as the preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 654, __PRETTY_FUNCTION__)) | |||
653 | RHSExprs.size() == varlist_size() &&((RHSExprs.size() == varlist_size() && "Number of RHS expressions is not the same as the preallocated buffer" ) ? static_cast<void> (0) : __assert_fail ("RHSExprs.size() == varlist_size() && \"Number of RHS expressions is not the same as the preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 654, __PRETTY_FUNCTION__)) | |||
654 | "Number of RHS expressions is not the same as the preallocated buffer")((RHSExprs.size() == varlist_size() && "Number of RHS expressions is not the same as the preallocated buffer" ) ? static_cast<void> (0) : __assert_fail ("RHSExprs.size() == varlist_size() && \"Number of RHS expressions is not the same as the preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 654, __PRETTY_FUNCTION__)); | |||
655 | std::copy(RHSExprs.begin(), RHSExprs.end(), getLHSExprs().end()); | |||
656 | } | |||
657 | ||||
658 | void OMPInReductionClause::setReductionOps(ArrayRef<Expr *> ReductionOps) { | |||
659 | assert(ReductionOps.size() == varlist_size() && "Number of in reduction "((ReductionOps.size() == varlist_size() && "Number of in reduction " "expressions is not the same " "as the preallocated buffer") ? static_cast<void> (0) : __assert_fail ("ReductionOps.size() == varlist_size() && \"Number of in reduction \" \"expressions is not the same \" \"as the preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 661, __PRETTY_FUNCTION__)) | |||
660 | "expressions is not the same "((ReductionOps.size() == varlist_size() && "Number of in reduction " "expressions is not the same " "as the preallocated buffer") ? static_cast<void> (0) : __assert_fail ("ReductionOps.size() == varlist_size() && \"Number of in reduction \" \"expressions is not the same \" \"as the preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 661, __PRETTY_FUNCTION__)) | |||
661 | "as the preallocated buffer")((ReductionOps.size() == varlist_size() && "Number of in reduction " "expressions is not the same " "as the preallocated buffer") ? static_cast<void> (0) : __assert_fail ("ReductionOps.size() == varlist_size() && \"Number of in reduction \" \"expressions is not the same \" \"as the preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 661, __PRETTY_FUNCTION__)); | |||
662 | std::copy(ReductionOps.begin(), ReductionOps.end(), getRHSExprs().end()); | |||
663 | } | |||
664 | ||||
665 | void OMPInReductionClause::setTaskgroupDescriptors( | |||
666 | ArrayRef<Expr *> TaskgroupDescriptors) { | |||
667 | assert(TaskgroupDescriptors.size() == varlist_size() &&((TaskgroupDescriptors.size() == varlist_size() && "Number of in reduction descriptors is not the same as the " "preallocated buffer") ? static_cast<void> (0) : __assert_fail ("TaskgroupDescriptors.size() == varlist_size() && \"Number of in reduction descriptors is not the same as the \" \"preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 669, __PRETTY_FUNCTION__)) | |||
668 | "Number of in reduction descriptors is not the same as the "((TaskgroupDescriptors.size() == varlist_size() && "Number of in reduction descriptors is not the same as the " "preallocated buffer") ? static_cast<void> (0) : __assert_fail ("TaskgroupDescriptors.size() == varlist_size() && \"Number of in reduction descriptors is not the same as the \" \"preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 669, __PRETTY_FUNCTION__)) | |||
669 | "preallocated buffer")((TaskgroupDescriptors.size() == varlist_size() && "Number of in reduction descriptors is not the same as the " "preallocated buffer") ? static_cast<void> (0) : __assert_fail ("TaskgroupDescriptors.size() == varlist_size() && \"Number of in reduction descriptors is not the same as the \" \"preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 669, __PRETTY_FUNCTION__)); | |||
670 | std::copy(TaskgroupDescriptors.begin(), TaskgroupDescriptors.end(), | |||
671 | getReductionOps().end()); | |||
672 | } | |||
673 | ||||
674 | OMPInReductionClause *OMPInReductionClause::Create( | |||
675 | const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, | |||
676 | SourceLocation EndLoc, SourceLocation ColonLoc, ArrayRef<Expr *> VL, | |||
677 | NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, | |||
678 | ArrayRef<Expr *> Privates, ArrayRef<Expr *> LHSExprs, | |||
679 | ArrayRef<Expr *> RHSExprs, ArrayRef<Expr *> ReductionOps, | |||
680 | ArrayRef<Expr *> TaskgroupDescriptors, Stmt *PreInit, Expr *PostUpdate) { | |||
681 | void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(6 * VL.size())); | |||
682 | OMPInReductionClause *Clause = new (Mem) OMPInReductionClause( | |||
683 | StartLoc, LParenLoc, EndLoc, ColonLoc, VL.size(), QualifierLoc, NameInfo); | |||
684 | Clause->setVarRefs(VL); | |||
685 | Clause->setPrivates(Privates); | |||
686 | Clause->setLHSExprs(LHSExprs); | |||
687 | Clause->setRHSExprs(RHSExprs); | |||
688 | Clause->setReductionOps(ReductionOps); | |||
689 | Clause->setTaskgroupDescriptors(TaskgroupDescriptors); | |||
690 | Clause->setPreInitStmt(PreInit); | |||
691 | Clause->setPostUpdateExpr(PostUpdate); | |||
692 | return Clause; | |||
693 | } | |||
694 | ||||
695 | OMPInReductionClause *OMPInReductionClause::CreateEmpty(const ASTContext &C, | |||
696 | unsigned N) { | |||
697 | void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(6 * N)); | |||
698 | return new (Mem) OMPInReductionClause(N); | |||
699 | } | |||
700 | ||||
701 | OMPFlushClause *OMPFlushClause::Create(const ASTContext &C, | |||
702 | SourceLocation StartLoc, | |||
703 | SourceLocation LParenLoc, | |||
704 | SourceLocation EndLoc, | |||
705 | ArrayRef<Expr *> VL) { | |||
706 | void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(VL.size() + 1)); | |||
707 | OMPFlushClause *Clause = | |||
708 | new (Mem) OMPFlushClause(StartLoc, LParenLoc, EndLoc, VL.size()); | |||
709 | Clause->setVarRefs(VL); | |||
710 | return Clause; | |||
711 | } | |||
712 | ||||
713 | OMPFlushClause *OMPFlushClause::CreateEmpty(const ASTContext &C, unsigned N) { | |||
714 | void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(N)); | |||
715 | return new (Mem) OMPFlushClause(N); | |||
716 | } | |||
717 | ||||
718 | OMPDependClause * | |||
719 | OMPDependClause::Create(const ASTContext &C, SourceLocation StartLoc, | |||
720 | SourceLocation LParenLoc, SourceLocation EndLoc, | |||
721 | OpenMPDependClauseKind DepKind, SourceLocation DepLoc, | |||
722 | SourceLocation ColonLoc, ArrayRef<Expr *> VL, | |||
723 | unsigned NumLoops) { | |||
724 | void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(VL.size() + NumLoops)); | |||
725 | OMPDependClause *Clause = new (Mem) | |||
726 | OMPDependClause(StartLoc, LParenLoc, EndLoc, VL.size(), NumLoops); | |||
727 | Clause->setVarRefs(VL); | |||
728 | Clause->setDependencyKind(DepKind); | |||
729 | Clause->setDependencyLoc(DepLoc); | |||
730 | Clause->setColonLoc(ColonLoc); | |||
731 | for (unsigned I = 0 ; I < NumLoops; ++I) | |||
732 | Clause->setLoopData(I, nullptr); | |||
733 | return Clause; | |||
734 | } | |||
735 | ||||
736 | OMPDependClause *OMPDependClause::CreateEmpty(const ASTContext &C, unsigned N, | |||
737 | unsigned NumLoops) { | |||
738 | void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(N + NumLoops)); | |||
739 | return new (Mem) OMPDependClause(N, NumLoops); | |||
740 | } | |||
741 | ||||
742 | void OMPDependClause::setLoopData(unsigned NumLoop, Expr *Cnt) { | |||
743 | assert((getDependencyKind() == OMPC_DEPEND_sink ||(((getDependencyKind() == OMPC_DEPEND_sink || getDependencyKind () == OMPC_DEPEND_source) && NumLoop < NumLoops && "Expected sink or source depend + loop index must be less number of " "loops.") ? static_cast<void> (0) : __assert_fail ("(getDependencyKind() == OMPC_DEPEND_sink || getDependencyKind() == OMPC_DEPEND_source) && NumLoop < NumLoops && \"Expected sink or source depend + loop index must be less number of \" \"loops.\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 747, __PRETTY_FUNCTION__)) | |||
744 | getDependencyKind() == OMPC_DEPEND_source) &&(((getDependencyKind() == OMPC_DEPEND_sink || getDependencyKind () == OMPC_DEPEND_source) && NumLoop < NumLoops && "Expected sink or source depend + loop index must be less number of " "loops.") ? static_cast<void> (0) : __assert_fail ("(getDependencyKind() == OMPC_DEPEND_sink || getDependencyKind() == OMPC_DEPEND_source) && NumLoop < NumLoops && \"Expected sink or source depend + loop index must be less number of \" \"loops.\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 747, __PRETTY_FUNCTION__)) | |||
745 | NumLoop < NumLoops &&(((getDependencyKind() == OMPC_DEPEND_sink || getDependencyKind () == OMPC_DEPEND_source) && NumLoop < NumLoops && "Expected sink or source depend + loop index must be less number of " "loops.") ? static_cast<void> (0) : __assert_fail ("(getDependencyKind() == OMPC_DEPEND_sink || getDependencyKind() == OMPC_DEPEND_source) && NumLoop < NumLoops && \"Expected sink or source depend + loop index must be less number of \" \"loops.\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 747, __PRETTY_FUNCTION__)) | |||
746 | "Expected sink or source depend + loop index must be less number of "(((getDependencyKind() == OMPC_DEPEND_sink || getDependencyKind () == OMPC_DEPEND_source) && NumLoop < NumLoops && "Expected sink or source depend + loop index must be less number of " "loops.") ? static_cast<void> (0) : __assert_fail ("(getDependencyKind() == OMPC_DEPEND_sink || getDependencyKind() == OMPC_DEPEND_source) && NumLoop < NumLoops && \"Expected sink or source depend + loop index must be less number of \" \"loops.\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 747, __PRETTY_FUNCTION__)) | |||
747 | "loops.")(((getDependencyKind() == OMPC_DEPEND_sink || getDependencyKind () == OMPC_DEPEND_source) && NumLoop < NumLoops && "Expected sink or source depend + loop index must be less number of " "loops.") ? static_cast<void> (0) : __assert_fail ("(getDependencyKind() == OMPC_DEPEND_sink || getDependencyKind() == OMPC_DEPEND_source) && NumLoop < NumLoops && \"Expected sink or source depend + loop index must be less number of \" \"loops.\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 747, __PRETTY_FUNCTION__)); | |||
748 | auto It = std::next(getVarRefs().end(), NumLoop); | |||
749 | *It = Cnt; | |||
750 | } | |||
751 | ||||
752 | Expr *OMPDependClause::getLoopData(unsigned NumLoop) { | |||
753 | assert((getDependencyKind() == OMPC_DEPEND_sink ||(((getDependencyKind() == OMPC_DEPEND_sink || getDependencyKind () == OMPC_DEPEND_source) && NumLoop < NumLoops && "Expected sink or source depend + loop index must be less number of " "loops.") ? static_cast<void> (0) : __assert_fail ("(getDependencyKind() == OMPC_DEPEND_sink || getDependencyKind() == OMPC_DEPEND_source) && NumLoop < NumLoops && \"Expected sink or source depend + loop index must be less number of \" \"loops.\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 757, __PRETTY_FUNCTION__)) | |||
754 | getDependencyKind() == OMPC_DEPEND_source) &&(((getDependencyKind() == OMPC_DEPEND_sink || getDependencyKind () == OMPC_DEPEND_source) && NumLoop < NumLoops && "Expected sink or source depend + loop index must be less number of " "loops.") ? static_cast<void> (0) : __assert_fail ("(getDependencyKind() == OMPC_DEPEND_sink || getDependencyKind() == OMPC_DEPEND_source) && NumLoop < NumLoops && \"Expected sink or source depend + loop index must be less number of \" \"loops.\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 757, __PRETTY_FUNCTION__)) | |||
755 | NumLoop < NumLoops &&(((getDependencyKind() == OMPC_DEPEND_sink || getDependencyKind () == OMPC_DEPEND_source) && NumLoop < NumLoops && "Expected sink or source depend + loop index must be less number of " "loops.") ? static_cast<void> (0) : __assert_fail ("(getDependencyKind() == OMPC_DEPEND_sink || getDependencyKind() == OMPC_DEPEND_source) && NumLoop < NumLoops && \"Expected sink or source depend + loop index must be less number of \" \"loops.\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 757, __PRETTY_FUNCTION__)) | |||
756 | "Expected sink or source depend + loop index must be less number of "(((getDependencyKind() == OMPC_DEPEND_sink || getDependencyKind () == OMPC_DEPEND_source) && NumLoop < NumLoops && "Expected sink or source depend + loop index must be less number of " "loops.") ? static_cast<void> (0) : __assert_fail ("(getDependencyKind() == OMPC_DEPEND_sink || getDependencyKind() == OMPC_DEPEND_source) && NumLoop < NumLoops && \"Expected sink or source depend + loop index must be less number of \" \"loops.\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 757, __PRETTY_FUNCTION__)) | |||
757 | "loops.")(((getDependencyKind() == OMPC_DEPEND_sink || getDependencyKind () == OMPC_DEPEND_source) && NumLoop < NumLoops && "Expected sink or source depend + loop index must be less number of " "loops.") ? static_cast<void> (0) : __assert_fail ("(getDependencyKind() == OMPC_DEPEND_sink || getDependencyKind() == OMPC_DEPEND_source) && NumLoop < NumLoops && \"Expected sink or source depend + loop index must be less number of \" \"loops.\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 757, __PRETTY_FUNCTION__)); | |||
758 | auto It = std::next(getVarRefs().end(), NumLoop); | |||
759 | return *It; | |||
760 | } | |||
761 | ||||
762 | const Expr *OMPDependClause::getLoopData(unsigned NumLoop) const { | |||
763 | assert((getDependencyKind() == OMPC_DEPEND_sink ||(((getDependencyKind() == OMPC_DEPEND_sink || getDependencyKind () == OMPC_DEPEND_source) && NumLoop < NumLoops && "Expected sink or source depend + loop index must be less number of " "loops.") ? static_cast<void> (0) : __assert_fail ("(getDependencyKind() == OMPC_DEPEND_sink || getDependencyKind() == OMPC_DEPEND_source) && NumLoop < NumLoops && \"Expected sink or source depend + loop index must be less number of \" \"loops.\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 767, __PRETTY_FUNCTION__)) | |||
764 | getDependencyKind() == OMPC_DEPEND_source) &&(((getDependencyKind() == OMPC_DEPEND_sink || getDependencyKind () == OMPC_DEPEND_source) && NumLoop < NumLoops && "Expected sink or source depend + loop index must be less number of " "loops.") ? static_cast<void> (0) : __assert_fail ("(getDependencyKind() == OMPC_DEPEND_sink || getDependencyKind() == OMPC_DEPEND_source) && NumLoop < NumLoops && \"Expected sink or source depend + loop index must be less number of \" \"loops.\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 767, __PRETTY_FUNCTION__)) | |||
765 | NumLoop < NumLoops &&(((getDependencyKind() == OMPC_DEPEND_sink || getDependencyKind () == OMPC_DEPEND_source) && NumLoop < NumLoops && "Expected sink or source depend + loop index must be less number of " "loops.") ? static_cast<void> (0) : __assert_fail ("(getDependencyKind() == OMPC_DEPEND_sink || getDependencyKind() == OMPC_DEPEND_source) && NumLoop < NumLoops && \"Expected sink or source depend + loop index must be less number of \" \"loops.\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 767, __PRETTY_FUNCTION__)) | |||
766 | "Expected sink or source depend + loop index must be less number of "(((getDependencyKind() == OMPC_DEPEND_sink || getDependencyKind () == OMPC_DEPEND_source) && NumLoop < NumLoops && "Expected sink or source depend + loop index must be less number of " "loops.") ? static_cast<void> (0) : __assert_fail ("(getDependencyKind() == OMPC_DEPEND_sink || getDependencyKind() == OMPC_DEPEND_source) && NumLoop < NumLoops && \"Expected sink or source depend + loop index must be less number of \" \"loops.\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 767, __PRETTY_FUNCTION__)) | |||
767 | "loops.")(((getDependencyKind() == OMPC_DEPEND_sink || getDependencyKind () == OMPC_DEPEND_source) && NumLoop < NumLoops && "Expected sink or source depend + loop index must be less number of " "loops.") ? static_cast<void> (0) : __assert_fail ("(getDependencyKind() == OMPC_DEPEND_sink || getDependencyKind() == OMPC_DEPEND_source) && NumLoop < NumLoops && \"Expected sink or source depend + loop index must be less number of \" \"loops.\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 767, __PRETTY_FUNCTION__)); | |||
768 | auto It = std::next(getVarRefs().end(), NumLoop); | |||
769 | return *It; | |||
770 | } | |||
771 | ||||
772 | unsigned OMPClauseMappableExprCommon::getComponentsTotalNumber( | |||
773 | MappableExprComponentListsRef ComponentLists) { | |||
774 | unsigned TotalNum = 0u; | |||
775 | for (auto &C : ComponentLists) | |||
776 | TotalNum += C.size(); | |||
777 | return TotalNum; | |||
778 | } | |||
779 | ||||
780 | unsigned OMPClauseMappableExprCommon::getUniqueDeclarationsTotalNumber( | |||
781 | ArrayRef<const ValueDecl *> Declarations) { | |||
782 | unsigned TotalNum = 0u; | |||
783 | llvm::SmallPtrSet<const ValueDecl *, 8> Cache; | |||
784 | for (const ValueDecl *D : Declarations) { | |||
785 | const ValueDecl *VD = D ? cast<ValueDecl>(D->getCanonicalDecl()) : nullptr; | |||
786 | if (Cache.count(VD)) | |||
787 | continue; | |||
788 | ++TotalNum; | |||
789 | Cache.insert(VD); | |||
790 | } | |||
791 | return TotalNum; | |||
792 | } | |||
793 | ||||
794 | OMPMapClause * | |||
795 | OMPMapClause::Create(const ASTContext &C, SourceLocation StartLoc, | |||
796 | SourceLocation LParenLoc, SourceLocation EndLoc, | |||
797 | ArrayRef<Expr *> Vars, ArrayRef<ValueDecl *> Declarations, | |||
798 | MappableExprComponentListsRef ComponentLists, | |||
799 | ArrayRef<OpenMPMapModifierKind> MapModifiers, | |||
800 | ArrayRef<SourceLocation> MapModifiersLoc, | |||
801 | OpenMPMapClauseKind Type, bool TypeIsImplicit, | |||
802 | SourceLocation TypeLoc) { | |||
803 | unsigned NumVars = Vars.size(); | |||
804 | unsigned NumUniqueDeclarations = | |||
805 | getUniqueDeclarationsTotalNumber(Declarations); | |||
806 | unsigned NumComponentLists = ComponentLists.size(); | |||
807 | unsigned NumComponents = getComponentsTotalNumber(ComponentLists); | |||
808 | ||||
809 | // We need to allocate: | |||
810 | // NumVars x Expr* - we have an original list expression for each clause list | |||
811 | // entry. | |||
812 | // NumUniqueDeclarations x ValueDecl* - unique base declarations associated | |||
813 | // with each component list. | |||
814 | // (NumUniqueDeclarations + NumComponentLists) x unsigned - we specify the | |||
815 | // number of lists for each unique declaration and the size of each component | |||
816 | // list. | |||
817 | // NumComponents x MappableComponent - the total of all the components in all | |||
818 | // the lists. | |||
819 | void *Mem = C.Allocate( | |||
820 | totalSizeToAlloc<Expr *, ValueDecl *, unsigned, | |||
821 | OMPClauseMappableExprCommon::MappableComponent>( | |||
822 | NumVars, NumUniqueDeclarations, | |||
823 | NumUniqueDeclarations + NumComponentLists, NumComponents)); | |||
824 | OMPMapClause *Clause = new (Mem) OMPMapClause( | |||
825 | MapModifiers, MapModifiersLoc, Type, TypeIsImplicit, TypeLoc, StartLoc, | |||
826 | LParenLoc, EndLoc, NumVars, NumUniqueDeclarations, NumComponentLists, | |||
827 | NumComponents); | |||
828 | ||||
829 | Clause->setVarRefs(Vars); | |||
830 | Clause->setClauseInfo(Declarations, ComponentLists); | |||
831 | Clause->setMapType(Type); | |||
832 | Clause->setMapLoc(TypeLoc); | |||
833 | return Clause; | |||
834 | } | |||
835 | ||||
836 | OMPMapClause *OMPMapClause::CreateEmpty(const ASTContext &C, unsigned NumVars, | |||
837 | unsigned NumUniqueDeclarations, | |||
838 | unsigned NumComponentLists, | |||
839 | unsigned NumComponents) { | |||
840 | void *Mem = C.Allocate( | |||
841 | totalSizeToAlloc<Expr *, ValueDecl *, unsigned, | |||
842 | OMPClauseMappableExprCommon::MappableComponent>( | |||
843 | NumVars, NumUniqueDeclarations, | |||
844 | NumUniqueDeclarations + NumComponentLists, NumComponents)); | |||
845 | return new (Mem) OMPMapClause(NumVars, NumUniqueDeclarations, | |||
846 | NumComponentLists, NumComponents); | |||
847 | } | |||
848 | ||||
849 | OMPToClause *OMPToClause::Create(const ASTContext &C, SourceLocation StartLoc, | |||
850 | SourceLocation LParenLoc, | |||
851 | SourceLocation EndLoc, ArrayRef<Expr *> Vars, | |||
852 | ArrayRef<ValueDecl *> Declarations, | |||
853 | MappableExprComponentListsRef ComponentLists) { | |||
854 | unsigned NumVars = Vars.size(); | |||
855 | unsigned NumUniqueDeclarations = | |||
856 | getUniqueDeclarationsTotalNumber(Declarations); | |||
857 | unsigned NumComponentLists = ComponentLists.size(); | |||
858 | unsigned NumComponents = getComponentsTotalNumber(ComponentLists); | |||
859 | ||||
860 | // We need to allocate: | |||
861 | // NumVars x Expr* - we have an original list expression for each clause list | |||
862 | // entry. | |||
863 | // NumUniqueDeclarations x ValueDecl* - unique base declarations associated | |||
864 | // with each component list. | |||
865 | // (NumUniqueDeclarations + NumComponentLists) x unsigned - we specify the | |||
866 | // number of lists for each unique declaration and the size of each component | |||
867 | // list. | |||
868 | // NumComponents x MappableComponent - the total of all the components in all | |||
869 | // the lists. | |||
870 | void *Mem = C.Allocate( | |||
871 | totalSizeToAlloc<Expr *, ValueDecl *, unsigned, | |||
872 | OMPClauseMappableExprCommon::MappableComponent>( | |||
873 | NumVars, NumUniqueDeclarations, | |||
874 | NumUniqueDeclarations + NumComponentLists, NumComponents)); | |||
875 | ||||
876 | OMPToClause *Clause = new (Mem) | |||
877 | OMPToClause(StartLoc, LParenLoc, EndLoc, NumVars, NumUniqueDeclarations, | |||
878 | NumComponentLists, NumComponents); | |||
879 | ||||
880 | Clause->setVarRefs(Vars); | |||
881 | Clause->setClauseInfo(Declarations, ComponentLists); | |||
882 | return Clause; | |||
883 | } | |||
884 | ||||
885 | OMPToClause *OMPToClause::CreateEmpty(const ASTContext &C, unsigned NumVars, | |||
886 | unsigned NumUniqueDeclarations, | |||
887 | unsigned NumComponentLists, | |||
888 | unsigned NumComponents) { | |||
889 | void *Mem = C.Allocate( | |||
890 | totalSizeToAlloc<Expr *, ValueDecl *, unsigned, | |||
891 | OMPClauseMappableExprCommon::MappableComponent>( | |||
892 | NumVars, NumUniqueDeclarations, | |||
893 | NumUniqueDeclarations + NumComponentLists, NumComponents)); | |||
894 | return new (Mem) OMPToClause(NumVars, NumUniqueDeclarations, | |||
895 | NumComponentLists, NumComponents); | |||
896 | } | |||
897 | ||||
898 | OMPFromClause * | |||
899 | OMPFromClause::Create(const ASTContext &C, SourceLocation StartLoc, | |||
900 | SourceLocation LParenLoc, SourceLocation EndLoc, | |||
901 | ArrayRef<Expr *> Vars, ArrayRef<ValueDecl *> Declarations, | |||
902 | MappableExprComponentListsRef ComponentLists) { | |||
903 | unsigned NumVars = Vars.size(); | |||
904 | unsigned NumUniqueDeclarations = | |||
905 | getUniqueDeclarationsTotalNumber(Declarations); | |||
906 | unsigned NumComponentLists = ComponentLists.size(); | |||
907 | unsigned NumComponents = getComponentsTotalNumber(ComponentLists); | |||
908 | ||||
909 | // We need to allocate: | |||
910 | // NumVars x Expr* - we have an original list expression for each clause list | |||
911 | // entry. | |||
912 | // NumUniqueDeclarations x ValueDecl* - unique base declarations associated | |||
913 | // with each component list. | |||
914 | // (NumUniqueDeclarations + NumComponentLists) x unsigned - we specify the | |||
915 | // number of lists for each unique declaration and the size of each component | |||
916 | // list. | |||
917 | // NumComponents x MappableComponent - the total of all the components in all | |||
918 | // the lists. | |||
919 | void *Mem = C.Allocate( | |||
920 | totalSizeToAlloc<Expr *, ValueDecl *, unsigned, | |||
921 | OMPClauseMappableExprCommon::MappableComponent>( | |||
922 | NumVars, NumUniqueDeclarations, | |||
923 | NumUniqueDeclarations + NumComponentLists, NumComponents)); | |||
924 | ||||
925 | OMPFromClause *Clause = new (Mem) | |||
926 | OMPFromClause(StartLoc, LParenLoc, EndLoc, NumVars, NumUniqueDeclarations, | |||
927 | NumComponentLists, NumComponents); | |||
928 | ||||
929 | Clause->setVarRefs(Vars); | |||
930 | Clause->setClauseInfo(Declarations, ComponentLists); | |||
931 | return Clause; | |||
932 | } | |||
933 | ||||
934 | OMPFromClause *OMPFromClause::CreateEmpty(const ASTContext &C, unsigned NumVars, | |||
935 | unsigned NumUniqueDeclarations, | |||
936 | unsigned NumComponentLists, | |||
937 | unsigned NumComponents) { | |||
938 | void *Mem = C.Allocate( | |||
939 | totalSizeToAlloc<Expr *, ValueDecl *, unsigned, | |||
940 | OMPClauseMappableExprCommon::MappableComponent>( | |||
941 | NumVars, NumUniqueDeclarations, | |||
942 | NumUniqueDeclarations + NumComponentLists, NumComponents)); | |||
943 | return new (Mem) OMPFromClause(NumVars, NumUniqueDeclarations, | |||
944 | NumComponentLists, NumComponents); | |||
945 | } | |||
946 | ||||
947 | void OMPUseDevicePtrClause::setPrivateCopies(ArrayRef<Expr *> VL) { | |||
948 | assert(VL.size() == varlist_size() &&((VL.size() == varlist_size() && "Number of private copies is not the same as the preallocated buffer" ) ? static_cast<void> (0) : __assert_fail ("VL.size() == varlist_size() && \"Number of private copies is not the same as the preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 949, __PRETTY_FUNCTION__)) | |||
949 | "Number of private copies is not the same as the preallocated buffer")((VL.size() == varlist_size() && "Number of private copies is not the same as the preallocated buffer" ) ? static_cast<void> (0) : __assert_fail ("VL.size() == varlist_size() && \"Number of private copies is not the same as the preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 949, __PRETTY_FUNCTION__)); | |||
950 | std::copy(VL.begin(), VL.end(), varlist_end()); | |||
951 | } | |||
952 | ||||
953 | void OMPUseDevicePtrClause::setInits(ArrayRef<Expr *> VL) { | |||
954 | assert(VL.size() == varlist_size() &&((VL.size() == varlist_size() && "Number of inits is not the same as the preallocated buffer" ) ? static_cast<void> (0) : __assert_fail ("VL.size() == varlist_size() && \"Number of inits is not the same as the preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 955, __PRETTY_FUNCTION__)) | |||
955 | "Number of inits is not the same as the preallocated buffer")((VL.size() == varlist_size() && "Number of inits is not the same as the preallocated buffer" ) ? static_cast<void> (0) : __assert_fail ("VL.size() == varlist_size() && \"Number of inits is not the same as the preallocated buffer\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 955, __PRETTY_FUNCTION__)); | |||
956 | std::copy(VL.begin(), VL.end(), getPrivateCopies().end()); | |||
957 | } | |||
958 | ||||
959 | OMPUseDevicePtrClause *OMPUseDevicePtrClause::Create( | |||
960 | const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, | |||
961 | SourceLocation EndLoc, ArrayRef<Expr *> Vars, ArrayRef<Expr *> PrivateVars, | |||
962 | ArrayRef<Expr *> Inits, ArrayRef<ValueDecl *> Declarations, | |||
963 | MappableExprComponentListsRef ComponentLists) { | |||
964 | unsigned NumVars = Vars.size(); | |||
965 | unsigned NumUniqueDeclarations = | |||
966 | getUniqueDeclarationsTotalNumber(Declarations); | |||
967 | unsigned NumComponentLists = ComponentLists.size(); | |||
968 | unsigned NumComponents = getComponentsTotalNumber(ComponentLists); | |||
969 | ||||
970 | // We need to allocate: | |||
971 | // 3 x NumVars x Expr* - we have an original list expression for each clause | |||
972 | // list entry and an equal number of private copies and inits. | |||
973 | // NumUniqueDeclarations x ValueDecl* - unique base declarations associated | |||
974 | // with each component list. | |||
975 | // (NumUniqueDeclarations + NumComponentLists) x unsigned - we specify the | |||
976 | // number of lists for each unique declaration and the size of each component | |||
977 | // list. | |||
978 | // NumComponents x MappableComponent - the total of all the components in all | |||
979 | // the lists. | |||
980 | void *Mem = C.Allocate( | |||
981 | totalSizeToAlloc<Expr *, ValueDecl *, unsigned, | |||
982 | OMPClauseMappableExprCommon::MappableComponent>( | |||
983 | 3 * NumVars, NumUniqueDeclarations, | |||
984 | NumUniqueDeclarations + NumComponentLists, NumComponents)); | |||
985 | ||||
986 | OMPUseDevicePtrClause *Clause = new (Mem) OMPUseDevicePtrClause( | |||
987 | StartLoc, LParenLoc, EndLoc, NumVars, NumUniqueDeclarations, | |||
988 | NumComponentLists, NumComponents); | |||
989 | ||||
990 | Clause->setVarRefs(Vars); | |||
991 | Clause->setPrivateCopies(PrivateVars); | |||
992 | Clause->setInits(Inits); | |||
993 | Clause->setClauseInfo(Declarations, ComponentLists); | |||
994 | return Clause; | |||
995 | } | |||
996 | ||||
997 | OMPUseDevicePtrClause *OMPUseDevicePtrClause::CreateEmpty( | |||
998 | const ASTContext &C, unsigned NumVars, unsigned NumUniqueDeclarations, | |||
999 | unsigned NumComponentLists, unsigned NumComponents) { | |||
1000 | void *Mem = C.Allocate( | |||
1001 | totalSizeToAlloc<Expr *, ValueDecl *, unsigned, | |||
1002 | OMPClauseMappableExprCommon::MappableComponent>( | |||
1003 | 3 * NumVars, NumUniqueDeclarations, | |||
1004 | NumUniqueDeclarations + NumComponentLists, NumComponents)); | |||
1005 | return new (Mem) OMPUseDevicePtrClause(NumVars, NumUniqueDeclarations, | |||
1006 | NumComponentLists, NumComponents); | |||
1007 | } | |||
1008 | ||||
1009 | OMPIsDevicePtrClause * | |||
1010 | OMPIsDevicePtrClause::Create(const ASTContext &C, SourceLocation StartLoc, | |||
1011 | SourceLocation LParenLoc, SourceLocation EndLoc, | |||
1012 | ArrayRef<Expr *> Vars, | |||
1013 | ArrayRef<ValueDecl *> Declarations, | |||
1014 | MappableExprComponentListsRef ComponentLists) { | |||
1015 | unsigned NumVars = Vars.size(); | |||
1016 | unsigned NumUniqueDeclarations = | |||
1017 | getUniqueDeclarationsTotalNumber(Declarations); | |||
1018 | unsigned NumComponentLists = ComponentLists.size(); | |||
1019 | unsigned NumComponents = getComponentsTotalNumber(ComponentLists); | |||
1020 | ||||
1021 | // We need to allocate: | |||
1022 | // NumVars x Expr* - we have an original list expression for each clause list | |||
1023 | // entry. | |||
1024 | // NumUniqueDeclarations x ValueDecl* - unique base declarations associated | |||
1025 | // with each component list. | |||
1026 | // (NumUniqueDeclarations + NumComponentLists) x unsigned - we specify the | |||
1027 | // number of lists for each unique declaration and the size of each component | |||
1028 | // list. | |||
1029 | // NumComponents x MappableComponent - the total of all the components in all | |||
1030 | // the lists. | |||
1031 | void *Mem = C.Allocate( | |||
1032 | totalSizeToAlloc<Expr *, ValueDecl *, unsigned, | |||
1033 | OMPClauseMappableExprCommon::MappableComponent>( | |||
1034 | NumVars, NumUniqueDeclarations, | |||
1035 | NumUniqueDeclarations + NumComponentLists, NumComponents)); | |||
1036 | ||||
1037 | OMPIsDevicePtrClause *Clause = new (Mem) OMPIsDevicePtrClause( | |||
| ||||
1038 | StartLoc, LParenLoc, EndLoc, NumVars, NumUniqueDeclarations, | |||
1039 | NumComponentLists, NumComponents); | |||
1040 | ||||
1041 | Clause->setVarRefs(Vars); | |||
| ||||
1042 | Clause->setClauseInfo(Declarations, ComponentLists); | |||
1043 | return Clause; | |||
1044 | } | |||
1045 | ||||
1046 | OMPIsDevicePtrClause *OMPIsDevicePtrClause::CreateEmpty( | |||
1047 | const ASTContext &C, unsigned NumVars, unsigned NumUniqueDeclarations, | |||
1048 | unsigned NumComponentLists, unsigned NumComponents) { | |||
1049 | void *Mem = C.Allocate( | |||
1050 | totalSizeToAlloc<Expr *, ValueDecl *, unsigned, | |||
1051 | OMPClauseMappableExprCommon::MappableComponent>( | |||
1052 | NumVars, NumUniqueDeclarations, | |||
1053 | NumUniqueDeclarations + NumComponentLists, NumComponents)); | |||
1054 | return new (Mem) OMPIsDevicePtrClause(NumVars, NumUniqueDeclarations, | |||
1055 | NumComponentLists, NumComponents); | |||
1056 | } | |||
1057 | ||||
1058 | //===----------------------------------------------------------------------===// | |||
1059 | // OpenMP clauses printing methods | |||
1060 | //===----------------------------------------------------------------------===// | |||
1061 | ||||
1062 | void OMPClausePrinter::VisitOMPIfClause(OMPIfClause *Node) { | |||
1063 | OS << "if("; | |||
1064 | if (Node->getNameModifier() != OMPD_unknown) | |||
1065 | OS << getOpenMPDirectiveName(Node->getNameModifier()) << ": "; | |||
1066 | Node->getCondition()->printPretty(OS, nullptr, Policy, 0); | |||
1067 | OS << ")"; | |||
1068 | } | |||
1069 | ||||
1070 | void OMPClausePrinter::VisitOMPFinalClause(OMPFinalClause *Node) { | |||
1071 | OS << "final("; | |||
1072 | Node->getCondition()->printPretty(OS, nullptr, Policy, 0); | |||
1073 | OS << ")"; | |||
1074 | } | |||
1075 | ||||
1076 | void OMPClausePrinter::VisitOMPNumThreadsClause(OMPNumThreadsClause *Node) { | |||
1077 | OS << "num_threads("; | |||
1078 | Node->getNumThreads()->printPretty(OS, nullptr, Policy, 0); | |||
1079 | OS << ")"; | |||
1080 | } | |||
1081 | ||||
1082 | void OMPClausePrinter::VisitOMPSafelenClause(OMPSafelenClause *Node) { | |||
1083 | OS << "safelen("; | |||
1084 | Node->getSafelen()->printPretty(OS, nullptr, Policy, 0); | |||
1085 | OS << ")"; | |||
1086 | } | |||
1087 | ||||
1088 | void OMPClausePrinter::VisitOMPSimdlenClause(OMPSimdlenClause *Node) { | |||
1089 | OS << "simdlen("; | |||
1090 | Node->getSimdlen()->printPretty(OS, nullptr, Policy, 0); | |||
1091 | OS << ")"; | |||
1092 | } | |||
1093 | ||||
1094 | void OMPClausePrinter::VisitOMPCollapseClause(OMPCollapseClause *Node) { | |||
1095 | OS << "collapse("; | |||
1096 | Node->getNumForLoops()->printPretty(OS, nullptr, Policy, 0); | |||
1097 | OS << ")"; | |||
1098 | } | |||
1099 | ||||
1100 | void OMPClausePrinter::VisitOMPDefaultClause(OMPDefaultClause *Node) { | |||
1101 | OS << "default(" | |||
1102 | << getOpenMPSimpleClauseTypeName(OMPC_default, Node->getDefaultKind()) | |||
1103 | << ")"; | |||
1104 | } | |||
1105 | ||||
1106 | void OMPClausePrinter::VisitOMPProcBindClause(OMPProcBindClause *Node) { | |||
1107 | OS << "proc_bind(" | |||
1108 | << getOpenMPSimpleClauseTypeName(OMPC_proc_bind, Node->getProcBindKind()) | |||
1109 | << ")"; | |||
1110 | } | |||
1111 | ||||
1112 | void OMPClausePrinter::VisitOMPUnifiedAddressClause(OMPUnifiedAddressClause *) { | |||
1113 | OS << "unified_address"; | |||
1114 | } | |||
1115 | ||||
1116 | void OMPClausePrinter::VisitOMPUnifiedSharedMemoryClause( | |||
1117 | OMPUnifiedSharedMemoryClause *) { | |||
1118 | OS << "unified_shared_memory"; | |||
1119 | } | |||
1120 | ||||
1121 | void OMPClausePrinter::VisitOMPReverseOffloadClause(OMPReverseOffloadClause *) { | |||
1122 | OS << "reverse_offload"; | |||
1123 | } | |||
1124 | ||||
1125 | void OMPClausePrinter::VisitOMPDynamicAllocatorsClause( | |||
1126 | OMPDynamicAllocatorsClause *) { | |||
1127 | OS << "dynamic_allocators"; | |||
1128 | } | |||
1129 | ||||
1130 | void OMPClausePrinter::VisitOMPAtomicDefaultMemOrderClause( | |||
1131 | OMPAtomicDefaultMemOrderClause *Node) { | |||
1132 | OS << "atomic_default_mem_order(" | |||
1133 | << getOpenMPSimpleClauseTypeName(OMPC_atomic_default_mem_order, | |||
1134 | Node->getAtomicDefaultMemOrderKind()) | |||
1135 | << ")"; | |||
1136 | } | |||
1137 | ||||
1138 | void OMPClausePrinter::VisitOMPScheduleClause(OMPScheduleClause *Node) { | |||
1139 | OS << "schedule("; | |||
1140 | if (Node->getFirstScheduleModifier() != OMPC_SCHEDULE_MODIFIER_unknown) { | |||
1141 | OS << getOpenMPSimpleClauseTypeName(OMPC_schedule, | |||
1142 | Node->getFirstScheduleModifier()); | |||
1143 | if (Node->getSecondScheduleModifier() != OMPC_SCHEDULE_MODIFIER_unknown) { | |||
1144 | OS << ", "; | |||
1145 | OS << getOpenMPSimpleClauseTypeName(OMPC_schedule, | |||
1146 | Node->getSecondScheduleModifier()); | |||
1147 | } | |||
1148 | OS << ": "; | |||
1149 | } | |||
1150 | OS << getOpenMPSimpleClauseTypeName(OMPC_schedule, Node->getScheduleKind()); | |||
1151 | if (auto *E = Node->getChunkSize()) { | |||
1152 | OS << ", "; | |||
1153 | E->printPretty(OS, nullptr, Policy); | |||
1154 | } | |||
1155 | OS << ")"; | |||
1156 | } | |||
1157 | ||||
1158 | void OMPClausePrinter::VisitOMPOrderedClause(OMPOrderedClause *Node) { | |||
1159 | OS << "ordered"; | |||
1160 | if (auto *Num = Node->getNumForLoops()) { | |||
1161 | OS << "("; | |||
1162 | Num->printPretty(OS, nullptr, Policy, 0); | |||
1163 | OS << ")"; | |||
1164 | } | |||
1165 | } | |||
1166 | ||||
1167 | void OMPClausePrinter::VisitOMPNowaitClause(OMPNowaitClause *) { | |||
1168 | OS << "nowait"; | |||
1169 | } | |||
1170 | ||||
1171 | void OMPClausePrinter::VisitOMPUntiedClause(OMPUntiedClause *) { | |||
1172 | OS << "untied"; | |||
1173 | } | |||
1174 | ||||
1175 | void OMPClausePrinter::VisitOMPNogroupClause(OMPNogroupClause *) { | |||
1176 | OS << "nogroup"; | |||
1177 | } | |||
1178 | ||||
1179 | void OMPClausePrinter::VisitOMPMergeableClause(OMPMergeableClause *) { | |||
1180 | OS << "mergeable"; | |||
1181 | } | |||
1182 | ||||
1183 | void OMPClausePrinter::VisitOMPReadClause(OMPReadClause *) { OS << "read"; } | |||
1184 | ||||
1185 | void OMPClausePrinter::VisitOMPWriteClause(OMPWriteClause *) { OS << "write"; } | |||
1186 | ||||
1187 | void OMPClausePrinter::VisitOMPUpdateClause(OMPUpdateClause *) { | |||
1188 | OS << "update"; | |||
1189 | } | |||
1190 | ||||
1191 | void OMPClausePrinter::VisitOMPCaptureClause(OMPCaptureClause *) { | |||
1192 | OS << "capture"; | |||
1193 | } | |||
1194 | ||||
1195 | void OMPClausePrinter::VisitOMPSeqCstClause(OMPSeqCstClause *) { | |||
1196 | OS << "seq_cst"; | |||
1197 | } | |||
1198 | ||||
1199 | void OMPClausePrinter::VisitOMPThreadsClause(OMPThreadsClause *) { | |||
1200 | OS << "threads"; | |||
1201 | } | |||
1202 | ||||
1203 | void OMPClausePrinter::VisitOMPSIMDClause(OMPSIMDClause *) { OS << "simd"; } | |||
1204 | ||||
1205 | void OMPClausePrinter::VisitOMPDeviceClause(OMPDeviceClause *Node) { | |||
1206 | OS << "device("; | |||
1207 | Node->getDevice()->printPretty(OS, nullptr, Policy, 0); | |||
1208 | OS << ")"; | |||
1209 | } | |||
1210 | ||||
1211 | void OMPClausePrinter::VisitOMPNumTeamsClause(OMPNumTeamsClause *Node) { | |||
1212 | OS << "num_teams("; | |||
1213 | Node->getNumTeams()->printPretty(OS, nullptr, Policy, 0); | |||
1214 | OS << ")"; | |||
1215 | } | |||
1216 | ||||
1217 | void OMPClausePrinter::VisitOMPThreadLimitClause(OMPThreadLimitClause *Node) { | |||
1218 | OS << "thread_limit("; | |||
1219 | Node->getThreadLimit()->printPretty(OS, nullptr, Policy, 0); | |||
1220 | OS << ")"; | |||
1221 | } | |||
1222 | ||||
1223 | void OMPClausePrinter::VisitOMPPriorityClause(OMPPriorityClause *Node) { | |||
1224 | OS << "priority("; | |||
1225 | Node->getPriority()->printPretty(OS, nullptr, Policy, 0); | |||
1226 | OS << ")"; | |||
1227 | } | |||
1228 | ||||
1229 | void OMPClausePrinter::VisitOMPGrainsizeClause(OMPGrainsizeClause *Node) { | |||
1230 | OS << "grainsize("; | |||
1231 | Node->getGrainsize()->printPretty(OS, nullptr, Policy, 0); | |||
1232 | OS << ")"; | |||
1233 | } | |||
1234 | ||||
1235 | void OMPClausePrinter::VisitOMPNumTasksClause(OMPNumTasksClause *Node) { | |||
1236 | OS << "num_tasks("; | |||
1237 | Node->getNumTasks()->printPretty(OS, nullptr, Policy, 0); | |||
1238 | OS << ")"; | |||
1239 | } | |||
1240 | ||||
1241 | void OMPClausePrinter::VisitOMPHintClause(OMPHintClause *Node) { | |||
1242 | OS << "hint("; | |||
1243 | Node->getHint()->printPretty(OS, nullptr, Policy, 0); | |||
1244 | OS << ")"; | |||
1245 | } | |||
1246 | ||||
1247 | template<typename T> | |||
1248 | void OMPClausePrinter::VisitOMPClauseList(T *Node, char StartSym) { | |||
1249 | for (typename T::varlist_iterator I = Node->varlist_begin(), | |||
1250 | E = Node->varlist_end(); | |||
1251 | I != E; ++I) { | |||
1252 | assert(*I && "Expected non-null Stmt")((*I && "Expected non-null Stmt") ? static_cast<void > (0) : __assert_fail ("*I && \"Expected non-null Stmt\"" , "/build/llvm-toolchain-snapshot-8~svn350071/tools/clang/lib/AST/OpenMPClause.cpp" , 1252, __PRETTY_FUNCTION__)); | |||
1253 | OS << (I == Node->varlist_begin() ? StartSym : ','); | |||
1254 | if (auto *DRE = dyn_cast<DeclRefExpr>(*I)) { | |||
1255 | if (isa<OMPCapturedExprDecl>(DRE->getDecl())) | |||
1256 | DRE->printPretty(OS, nullptr, Policy, 0); | |||
1257 | else | |||
1258 | DRE->getDecl()->printQualifiedName(OS); | |||
1259 | } else | |||
1260 | (*I)->printPretty(OS, nullptr, Policy, 0); | |||
1261 | } | |||
1262 | } | |||
1263 | ||||
1264 | void OMPClausePrinter::VisitOMPPrivateClause(OMPPrivateClause *Node) { | |||
1265 | if (!Node->varlist_empty()) { | |||
1266 | OS << "private"; | |||
1267 | VisitOMPClauseList(Node, '('); | |||
1268 | OS << ")"; | |||
1269 | } | |||
1270 | } | |||
1271 | ||||
1272 | void OMPClausePrinter::VisitOMPFirstprivateClause(OMPFirstprivateClause *Node) { | |||
1273 | if (!Node->varlist_empty()) { | |||
1274 | OS << "firstprivate"; | |||
1275 | VisitOMPClauseList(Node, '('); | |||
1276 | OS << ")"; | |||
1277 | } | |||
1278 | } | |||
1279 | ||||
1280 | void OMPClausePrinter::VisitOMPLastprivateClause(OMPLastprivateClause *Node) { | |||
1281 | if (!Node->varlist_empty()) { | |||
1282 | OS << "lastprivate"; | |||
1283 | VisitOMPClauseList(Node, '('); | |||
1284 | OS << ")"; | |||
1285 | } | |||
1286 | } | |||
1287 | ||||
1288 | void OMPClausePrinter::VisitOMPSharedClause(OMPSharedClause *Node) { | |||
1289 | if (!Node->varlist_empty()) { | |||
1290 | OS << "shared"; | |||
1291 | VisitOMPClauseList(Node, '('); | |||
1292 | OS << ")"; | |||
1293 | } | |||
1294 | } | |||
1295 | ||||
1296 | void OMPClausePrinter::VisitOMPReductionClause(OMPReductionClause *Node) { | |||
1297 | if (!Node->varlist_empty()) { | |||
1298 | OS << "reduction("; | |||
1299 | NestedNameSpecifier *QualifierLoc = | |||
1300 | Node->getQualifierLoc().getNestedNameSpecifier(); | |||
1301 | OverloadedOperatorKind OOK = | |||
1302 | Node->getNameInfo().getName().getCXXOverloadedOperator(); | |||
1303 | if (QualifierLoc == nullptr && OOK != OO_None) { | |||
1304 | // Print reduction identifier in C format | |||
1305 | OS << getOperatorSpelling(OOK); | |||
1306 | } else { | |||
1307 | // Use C++ format | |||
1308 | if (QualifierLoc != nullptr) | |||
1309 | QualifierLoc->print(OS, Policy); | |||
1310 | OS << Node->getNameInfo(); | |||
1311 | } | |||
1312 | OS << ":"; | |||
1313 | VisitOMPClauseList(Node, ' '); | |||
1314 | OS << ")"; | |||
1315 | } | |||
1316 | } | |||
1317 | ||||
1318 | void OMPClausePrinter::VisitOMPTaskReductionClause( | |||
1319 | OMPTaskReductionClause *Node) { | |||
1320 | if (!Node->varlist_empty()) { | |||
1321 | OS << "task_reduction("; | |||
1322 | NestedNameSpecifier *QualifierLoc = | |||
1323 | Node->getQualifierLoc().getNestedNameSpecifier(); | |||
1324 | OverloadedOperatorKind OOK = | |||
1325 | Node->getNameInfo().getName().getCXXOverloadedOperator(); | |||
1326 | if (QualifierLoc == nullptr && OOK != OO_None) { | |||
1327 | // Print reduction identifier in C format | |||
1328 | OS << getOperatorSpelling(OOK); | |||
1329 | } else { | |||
1330 | // Use C++ format | |||
1331 | if (QualifierLoc != nullptr) | |||
1332 | QualifierLoc->print(OS, Policy); | |||
1333 | OS << Node->getNameInfo(); | |||
1334 | } | |||
1335 | OS << ":"; | |||
1336 | VisitOMPClauseList(Node, ' '); | |||
1337 | OS << ")"; | |||
1338 | } | |||
1339 | } | |||
1340 | ||||
1341 | void OMPClausePrinter::VisitOMPInReductionClause(OMPInReductionClause *Node) { | |||
1342 | if (!Node->varlist_empty()) { | |||
1343 | OS << "in_reduction("; | |||
1344 | NestedNameSpecifier *QualifierLoc = | |||
1345 | Node->getQualifierLoc().getNestedNameSpecifier(); | |||
1346 | OverloadedOperatorKind OOK = | |||
1347 | Node->getNameInfo().getName().getCXXOverloadedOperator(); | |||
1348 | if (QualifierLoc == nullptr && OOK != OO_None) { | |||
1349 | // Print reduction identifier in C format | |||
1350 | OS << getOperatorSpelling(OOK); | |||
1351 | } else { | |||
1352 | // Use C++ format | |||
1353 | if (QualifierLoc != nullptr) | |||
1354 | QualifierLoc->print(OS, Policy); | |||
1355 | OS << Node->getNameInfo(); | |||
1356 | } | |||
1357 | OS << ":"; | |||
1358 | VisitOMPClauseList(Node, ' '); | |||
1359 | OS << ")"; | |||
1360 | } | |||
1361 | } | |||
1362 | ||||
1363 | void OMPClausePrinter::VisitOMPLinearClause(OMPLinearClause *Node) { | |||
1364 | if (!Node->varlist_empty()) { | |||
1365 | OS << "linear"; | |||
1366 | if (Node->getModifierLoc().isValid()) { | |||
1367 | OS << '(' | |||
1368 | << getOpenMPSimpleClauseTypeName(OMPC_linear, Node->getModifier()); | |||
1369 | } | |||
1370 | VisitOMPClauseList(Node, '('); | |||
1371 | if (Node->getModifierLoc().isValid()) | |||
1372 | OS << ')'; | |||
1373 | if (Node->getStep() != nullptr) { | |||
1374 | OS << ": "; | |||
1375 | Node->getStep()->printPretty(OS, nullptr, Policy, 0); | |||
1376 | } | |||
1377 | OS << ")"; | |||
1378 | } | |||
1379 | } | |||
1380 | ||||
1381 | void OMPClausePrinter::VisitOMPAlignedClause(OMPAlignedClause *Node) { | |||
1382 | if (!Node->varlist_empty()) { | |||
1383 | OS << "aligned"; | |||
1384 | VisitOMPClauseList(Node, '('); | |||
1385 | if (Node->getAlignment() != nullptr) { | |||
1386 | OS << ": "; | |||
1387 | Node->getAlignment()->printPretty(OS, nullptr, Policy, 0); | |||
1388 | } | |||
1389 | OS << ")"; | |||
1390 | } | |||
1391 | } | |||
1392 | ||||
1393 | void OMPClausePrinter::VisitOMPCopyinClause(OMPCopyinClause *Node) { | |||
1394 | if (!Node->varlist_empty()) { | |||
1395 | OS << "copyin"; | |||
1396 | VisitOMPClauseList(Node, '('); | |||
1397 | OS << ")"; | |||
1398 | } | |||
1399 | } | |||
1400 | ||||
1401 | void OMPClausePrinter::VisitOMPCopyprivateClause(OMPCopyprivateClause *Node) { | |||
1402 | if (!Node->varlist_empty()) { | |||
1403 | OS << "copyprivate"; | |||
1404 | VisitOMPClauseList(Node, '('); | |||
1405 | OS << ")"; | |||
1406 | } | |||
1407 | } | |||
1408 | ||||
1409 | void OMPClausePrinter::VisitOMPFlushClause(OMPFlushClause *Node) { | |||
1410 | if (!Node->varlist_empty()) { | |||
1411 | VisitOMPClauseList(Node, '('); | |||
1412 | OS << ")"; | |||
1413 | } | |||
1414 | } | |||
1415 | ||||
1416 | void OMPClausePrinter::VisitOMPDependClause(OMPDependClause *Node) { | |||
1417 | OS << "depend("; | |||
1418 | OS << getOpenMPSimpleClauseTypeName(Node->getClauseKind(), | |||
1419 | Node->getDependencyKind()); | |||
1420 | if (!Node->varlist_empty()) { | |||
1421 | OS << " :"; | |||
1422 | VisitOMPClauseList(Node, ' '); | |||
1423 | } | |||
1424 | OS << ")"; | |||
1425 | } | |||
1426 | ||||
1427 | void OMPClausePrinter::VisitOMPMapClause(OMPMapClause *Node) { | |||
1428 | if (!Node->varlist_empty()) { | |||
1429 | OS << "map("; | |||
1430 | if (Node->getMapType() != OMPC_MAP_unknown) { | |||
1431 | for (unsigned I = 0; I < OMPMapClause::NumberOfModifiers; ++I) { | |||
1432 | if (Node->getMapTypeModifier(I) != OMPC_MAP_MODIFIER_unknown) { | |||
1433 | OS << getOpenMPSimpleClauseTypeName(OMPC_map, | |||
1434 | Node->getMapTypeModifier(I)); | |||
1435 | OS << ','; | |||
1436 | } | |||
1437 | } | |||
1438 | OS << getOpenMPSimpleClauseTypeName(OMPC_map, Node->getMapType()); | |||
1439 | OS << ':'; | |||
1440 | } | |||
1441 | VisitOMPClauseList(Node, ' '); | |||
1442 | OS << ")"; | |||
1443 | } | |||
1444 | } | |||
1445 | ||||
1446 | void OMPClausePrinter::VisitOMPToClause(OMPToClause *Node) { | |||
1447 | if (!Node->varlist_empty()) { | |||
1448 | OS << "to"; | |||
1449 | VisitOMPClauseList(Node, '('); | |||
1450 | OS << ")"; | |||
1451 | } | |||
1452 | } | |||
1453 | ||||
1454 | void OMPClausePrinter::VisitOMPFromClause(OMPFromClause *Node) { | |||
1455 | if (!Node->varlist_empty()) { | |||
1456 | OS << "from"; | |||
1457 | VisitOMPClauseList(Node, '('); | |||
1458 | OS << ")"; | |||
1459 | } | |||
1460 | } | |||
1461 | ||||
1462 | void OMPClausePrinter::VisitOMPDistScheduleClause(OMPDistScheduleClause *Node) { | |||
1463 | OS << "dist_schedule(" << getOpenMPSimpleClauseTypeName( | |||
1464 | OMPC_dist_schedule, Node->getDistScheduleKind()); | |||
1465 | if (auto *E = Node->getChunkSize()) { | |||
1466 | OS << ", "; | |||
1467 | E->printPretty(OS, nullptr, Policy); | |||
1468 | } | |||
1469 | OS << ")"; | |||
1470 | } | |||
1471 | ||||
1472 | void OMPClausePrinter::VisitOMPDefaultmapClause(OMPDefaultmapClause *Node) { | |||
1473 | OS << "defaultmap("; | |||
1474 | OS << getOpenMPSimpleClauseTypeName(OMPC_defaultmap, | |||
1475 | Node->getDefaultmapModifier()); | |||
1476 | OS << ": "; | |||
1477 | OS << getOpenMPSimpleClauseTypeName(OMPC_defaultmap, | |||
1478 | Node->getDefaultmapKind()); | |||
1479 | OS << ")"; | |||
1480 | } | |||
1481 | ||||
1482 | void OMPClausePrinter::VisitOMPUseDevicePtrClause(OMPUseDevicePtrClause *Node) { | |||
1483 | if (!Node->varlist_empty()) { | |||
1484 | OS << "use_device_ptr"; | |||
1485 | VisitOMPClauseList(Node, '('); | |||
1486 | OS << ")"; | |||
1487 | } | |||
1488 | } | |||
1489 | ||||
1490 | void OMPClausePrinter::VisitOMPIsDevicePtrClause(OMPIsDevicePtrClause *Node) { | |||
1491 | if (!Node->varlist_empty()) { | |||
1492 | OS << "is_device_ptr"; | |||
1493 | VisitOMPClauseList(Node, '('); | |||
1494 | OS << ")"; | |||
1495 | } | |||
1496 | } | |||
1497 |