@@ -829,24 +829,42 @@ class OpenACCUpdateConstruct final
829829
830830// This class represents the 'atomic' construct, which has an associated
831831// 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 *> {
833836
834837 friend class ASTStmtReader ;
838+ friend TrailingObjects;
835839 OpenACCAtomicKind AtomicKind = OpenACCAtomicKind::None;
836840
837- OpenACCAtomicConstruct (EmptyShell )
841+ OpenACCAtomicConstruct (unsigned NumClauses )
838842 : OpenACCAssociatedStmtConstruct(
839843 OpenACCAtomicConstructClass, OpenACCDirectiveKind::Atomic,
840844 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+ }
842852
843853 OpenACCAtomicConstruct (SourceLocation Start, SourceLocation DirectiveLoc,
844854 OpenACCAtomicKind AtKind, SourceLocation End,
855+ ArrayRef<const OpenACCClause *> Clauses,
845856 Stmt *AssociatedStmt)
846857 : OpenACCAssociatedStmtConstruct(OpenACCAtomicConstructClass,
847858 OpenACCDirectiveKind::Atomic, Start,
848859 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+ }
850868
851869 void setAssociatedStmt (Stmt *S) {
852870 OpenACCAssociatedStmtConstruct::setAssociatedStmt (S);
@@ -857,10 +875,12 @@ class OpenACCAtomicConstruct final : public OpenACCAssociatedStmtConstruct {
857875 return T->getStmtClass () == OpenACCAtomicConstructClass;
858876 }
859877
860- static OpenACCAtomicConstruct *CreateEmpty (const ASTContext &C);
878+ static OpenACCAtomicConstruct *CreateEmpty (const ASTContext &C,
879+ unsigned NumClauses);
861880 static OpenACCAtomicConstruct *
862881 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);
864884
865885 OpenACCAtomicKind getAtomicKind () const { return AtomicKind; }
866886 const Stmt *getAssociatedStmt () const {
0 commit comments