@@ -829,24 +829,42 @@ class OpenACCUpdateConstruct final
829
829
830
830
// This class represents the 'atomic' construct, which has an associated
831
831
// statement, but no clauses.
832
- class OpenACCAtomicConstruct final : public OpenACCAssociatedStmtConstruct {
832
+ class OpenACCAtomicConstruct final
833
+ : public OpenACCAssociatedStmtConstruct,
834
+ private llvm::TrailingObjects<OpenACCAtomicConstruct,
835
+ const OpenACCClause *> {
833
836
834
837
friend class ASTStmtReader ;
838
+ friend TrailingObjects;
835
839
OpenACCAtomicKind AtomicKind = OpenACCAtomicKind::None;
836
840
837
- OpenACCAtomicConstruct (EmptyShell )
841
+ OpenACCAtomicConstruct (unsigned NumClauses )
838
842
: OpenACCAssociatedStmtConstruct(
839
843
OpenACCAtomicConstructClass, OpenACCDirectiveKind::Atomic,
840
844
SourceLocation{}, SourceLocation{}, SourceLocation{},
841
- /* AssociatedStmt=*/ nullptr ) {}
845
+ /* AssociatedStmt=*/ nullptr ) {
846
+ std::uninitialized_value_construct (
847
+ getTrailingObjects<const OpenACCClause *>(),
848
+ getTrailingObjects<const OpenACCClause *>() + NumClauses);
849
+ setClauseList (MutableArrayRef (getTrailingObjects<const OpenACCClause *>(),
850
+ NumClauses));
851
+ }
842
852
843
853
OpenACCAtomicConstruct (SourceLocation Start, SourceLocation DirectiveLoc,
844
854
OpenACCAtomicKind AtKind, SourceLocation End,
855
+ ArrayRef<const OpenACCClause *> Clauses,
845
856
Stmt *AssociatedStmt)
846
857
: OpenACCAssociatedStmtConstruct(OpenACCAtomicConstructClass,
847
858
OpenACCDirectiveKind::Atomic, Start,
848
859
DirectiveLoc, End, AssociatedStmt),
849
- AtomicKind (AtKind) {}
860
+ AtomicKind (AtKind) {
861
+ // Initialize the trailing storage.
862
+ std::uninitialized_copy (Clauses.begin (), Clauses.end (),
863
+ getTrailingObjects<const OpenACCClause *>());
864
+
865
+ setClauseList (MutableArrayRef (getTrailingObjects<const OpenACCClause *>(),
866
+ Clauses.size ()));
867
+ }
850
868
851
869
void setAssociatedStmt (Stmt *S) {
852
870
OpenACCAssociatedStmtConstruct::setAssociatedStmt (S);
@@ -857,10 +875,12 @@ class OpenACCAtomicConstruct final : public OpenACCAssociatedStmtConstruct {
857
875
return T->getStmtClass () == OpenACCAtomicConstructClass;
858
876
}
859
877
860
- static OpenACCAtomicConstruct *CreateEmpty (const ASTContext &C);
878
+ static OpenACCAtomicConstruct *CreateEmpty (const ASTContext &C,
879
+ unsigned NumClauses);
861
880
static OpenACCAtomicConstruct *
862
881
Create (const ASTContext &C, SourceLocation Start, SourceLocation DirectiveLoc,
863
- OpenACCAtomicKind AtKind, SourceLocation End, Stmt *AssociatedStmt);
882
+ OpenACCAtomicKind AtKind, SourceLocation End,
883
+ ArrayRef<const OpenACCClause *> Clauses, Stmt *AssociatedStmt);
864
884
865
885
OpenACCAtomicKind getAtomicKind () const { return AtomicKind; }
866
886
const Stmt *getAssociatedStmt () const {
0 commit comments