@@ -370,6 +370,20 @@ class OSSPrivateClause final
370
370
SourceLocation(), SourceLocation(),
371
371
N) {}
372
372
373
+ // / Sets the list of references to private copies with initializers for
374
+ // / new private variables.
375
+ // / \param VL List of references.
376
+ void setPrivateCopies (ArrayRef<Expr *> VL);
377
+
378
+ // / Gets the list of references to private copies with initializers for
379
+ // / new private variables.
380
+ MutableArrayRef<Expr *> getPrivateCopies () {
381
+ return MutableArrayRef<Expr *>(varlist_end (), varlist_size ());
382
+ }
383
+ ArrayRef<const Expr *> getPrivateCopies () const {
384
+ return llvm::makeArrayRef (varlist_end (), varlist_size ());
385
+ }
386
+
373
387
public:
374
388
// / Creates clause with a list of variables \a VL.
375
389
// /
@@ -378,16 +392,33 @@ class OSSPrivateClause final
378
392
// / \param LParenLoc Location of '('.
379
393
// / \param EndLoc Ending location of the clause.
380
394
// / \param VL List of references to the variables.
395
+ // / \param PrivateVL List of references to private copies with initializers.
381
396
static OSSPrivateClause *Create (const ASTContext &C, SourceLocation StartLoc,
382
397
SourceLocation LParenLoc,
383
- SourceLocation EndLoc, ArrayRef<Expr *> VL);
398
+ SourceLocation EndLoc,
399
+ ArrayRef<Expr *> VL, ArrayRef<Expr *> PrivateVL);
384
400
385
401
// / Creates an empty clause with \a N variables.
386
402
// /
387
403
// / \param C AST context.
388
404
// / \param N The number of variables.
389
405
static OSSPrivateClause *CreateEmpty (const ASTContext &C, unsigned N);
390
406
407
+ using private_copies_iterator = MutableArrayRef<Expr *>::iterator;
408
+ using private_copies_const_iterator = ArrayRef<const Expr *>::iterator;
409
+ using private_copies_range = llvm::iterator_range<private_copies_iterator>;
410
+ using private_copies_const_range =
411
+ llvm::iterator_range<private_copies_const_iterator>;
412
+
413
+ private_copies_range private_copies () {
414
+ return private_copies_range (getPrivateCopies ().begin (),
415
+ getPrivateCopies ().end ());
416
+ }
417
+ private_copies_const_range private_copies () const {
418
+ return private_copies_const_range (getPrivateCopies ().begin (),
419
+ getPrivateCopies ().end ());
420
+ }
421
+
391
422
child_range children () {
392
423
return child_range (reinterpret_cast <Stmt **>(varlist_begin ()),
393
424
reinterpret_cast <Stmt **>(varlist_end ()));
@@ -431,6 +462,34 @@ class OSSFirstprivateClause final
431
462
SourceLocation(), SourceLocation(),
432
463
N) {}
433
464
465
+ // / Sets the list of references to private copies with initializers for
466
+ // / new private variables.
467
+ // / \param VL List of references.
468
+ void setPrivateCopies (ArrayRef<Expr *> VL);
469
+
470
+ // / Gets the list of references to private copies with initializers for
471
+ // / new private variables.
472
+ MutableArrayRef<Expr *> getPrivateCopies () {
473
+ return MutableArrayRef<Expr *>(varlist_end (), varlist_size ());
474
+ }
475
+ ArrayRef<const Expr *> getPrivateCopies () const {
476
+ return llvm::makeArrayRef (varlist_end (), varlist_size ());
477
+ }
478
+
479
+ // / Sets the list of references to initializer variables for new
480
+ // / private variables.
481
+ // / \param VL List of references.
482
+ void setInits (ArrayRef<Expr *> VL);
483
+
484
+ // / Gets the list of references to initializer variables for new
485
+ // / private variables.
486
+ MutableArrayRef<Expr *> getInits () {
487
+ return MutableArrayRef<Expr *>(getPrivateCopies ().end (), varlist_size ());
488
+ }
489
+ ArrayRef<const Expr *> getInits () const {
490
+ return llvm::makeArrayRef (getPrivateCopies ().end (), varlist_size ());
491
+ }
492
+
434
493
public:
435
494
// / Creates clause with a list of variables \a VL.
436
495
// /
@@ -439,16 +498,47 @@ class OSSFirstprivateClause final
439
498
// / \param LParenLoc Location of '('.
440
499
// / \param EndLoc Ending location of the clause.
441
500
// / \param VL List of references to the variables.
442
- static OSSFirstprivateClause *Create (const ASTContext &C, SourceLocation StartLoc,
443
- SourceLocation LParenLoc,
444
- SourceLocation EndLoc, ArrayRef<Expr *> VL);
501
+ // / \param PrivateVL List of references to private copies with initializers.
502
+ // / \param InitVL List of references to auto generated variables used for
503
+ // / initialization.
504
+ static OSSFirstprivateClause *
505
+ Create (const ASTContext &C, SourceLocation StartLoc,
506
+ SourceLocation LParenLoc, SourceLocation EndLoc,
507
+ ArrayRef<Expr *> VL, ArrayRef<Expr *> PrivateVL, ArrayRef<Expr *> InitVL);
445
508
446
509
// / Creates an empty clause with \a N variables.
447
510
// /
448
511
// / \param C AST context.
449
512
// / \param N The number of variables.
450
513
static OSSFirstprivateClause *CreateEmpty (const ASTContext &C, unsigned N);
451
514
515
+ using private_copies_iterator = MutableArrayRef<Expr *>::iterator;
516
+ using private_copies_const_iterator = ArrayRef<const Expr *>::iterator;
517
+ using private_copies_range = llvm::iterator_range<private_copies_iterator>;
518
+ using private_copies_const_range =
519
+ llvm::iterator_range<private_copies_const_iterator>;
520
+
521
+ private_copies_range private_copies () {
522
+ return private_copies_range (getPrivateCopies ().begin (),
523
+ getPrivateCopies ().end ());
524
+ }
525
+ private_copies_const_range private_copies () const {
526
+ return private_copies_const_range (getPrivateCopies ().begin (),
527
+ getPrivateCopies ().end ());
528
+ }
529
+
530
+ using inits_iterator = MutableArrayRef<Expr *>::iterator;
531
+ using inits_const_iterator = ArrayRef<const Expr *>::iterator;
532
+ using inits_range = llvm::iterator_range<inits_iterator>;
533
+ using inits_const_range = llvm::iterator_range<inits_const_iterator>;
534
+
535
+ inits_range inits () {
536
+ return inits_range (getInits ().begin (), getInits ().end ());
537
+ }
538
+ inits_const_range inits () const {
539
+ return inits_const_range (getInits ().begin (), getInits ().end ());
540
+ }
541
+
452
542
child_range children () {
453
543
return child_range (reinterpret_cast <Stmt **>(varlist_begin ()),
454
544
reinterpret_cast <Stmt **>(varlist_end ()));
0 commit comments