@@ -114,7 +114,6 @@ class OpenACCAssociatedStmtConstruct : public OpenACCConstructStmt {
114114 }
115115};
116116
117- class OpenACCLoopConstruct ;
118117// / This class represents a compute construct, representing a 'Kind' of
119118// / `parallel', 'serial', or 'kernel'. These constructs are associated with a
120119// / 'structured block', defined as:
@@ -183,8 +182,7 @@ class OpenACCComputeConstruct final
183182 static OpenACCComputeConstruct *
184183 Create (const ASTContext &C, OpenACCDirectiveKind K, SourceLocation BeginLoc,
185184 SourceLocation DirectiveLoc, SourceLocation EndLoc,
186- ArrayRef<const OpenACCClause *> Clauses, Stmt *StructuredBlock,
187- ArrayRef<OpenACCLoopConstruct *> AssociatedLoopConstructs);
185+ ArrayRef<const OpenACCClause *> Clauses, Stmt *StructuredBlock);
188186
189187 Stmt *getStructuredBlock () { return getAssociatedStmt (); }
190188 const Stmt *getStructuredBlock () const {
@@ -198,12 +196,10 @@ class OpenACCLoopConstruct final
198196 : public OpenACCAssociatedStmtConstruct,
199197 public llvm::TrailingObjects<OpenACCLoopConstruct,
200198 const OpenACCClause *> {
201- // The compute construct this loop is associated with, or nullptr if this is
202- // an orphaned loop construct, or if it hasn't been set yet. Because we
203- // construct the directives at the end of their statement, the 'parent'
204- // construct is not yet available at the time of construction, so this needs
205- // to be set 'later'.
206- const OpenACCComputeConstruct *ParentComputeConstruct = nullptr ;
199+ // The compute/combined construct kind this loop is associated with, or
200+ // invalid if this is an orphaned loop construct.
201+ OpenACCDirectiveKind ParentComputeConstructKind =
202+ OpenACCDirectiveKind::Invalid;
207203
208204 friend class ASTStmtWriter ;
209205 friend class ASTStmtReader ;
@@ -212,15 +208,9 @@ class OpenACCLoopConstruct final
212208
213209 OpenACCLoopConstruct (unsigned NumClauses);
214210
215- OpenACCLoopConstruct (SourceLocation Start , SourceLocation DirLoc ,
216- SourceLocation End,
211+ OpenACCLoopConstruct (OpenACCDirectiveKind ParentKind , SourceLocation Start ,
212+ SourceLocation DirLoc, SourceLocation End,
217213 ArrayRef<const OpenACCClause *> Clauses, Stmt *Loop);
218- void setLoop (Stmt *Loop);
219-
220- void setParentComputeConstruct (OpenACCComputeConstruct *CC) {
221- assert (!ParentComputeConstruct && " Parent already set?" );
222- ParentComputeConstruct = CC;
223- }
224214
225215public:
226216 static bool classof (const Stmt *T) {
@@ -231,9 +221,9 @@ class OpenACCLoopConstruct final
231221 unsigned NumClauses);
232222
233223 static OpenACCLoopConstruct *
234- Create (const ASTContext &C, SourceLocation BeginLoc, SourceLocation DirLoc ,
235- SourceLocation EndLoc, ArrayRef< const OpenACCClause *> Clauses ,
236- Stmt *Loop);
224+ Create (const ASTContext &C, OpenACCDirectiveKind ParentKind ,
225+ SourceLocation BeginLoc, SourceLocation DirLoc, SourceLocation EndLoc ,
226+ ArrayRef< const OpenACCClause *> Clauses, Stmt *Loop);
237227
238228 Stmt *getLoop () { return getAssociatedStmt (); }
239229 const Stmt *getLoop () const {
@@ -246,10 +236,11 @@ class OpenACCLoopConstruct final
246236 // / loop construct is the nearest compute construct that lexically contains
247237 // / the loop construct.
248238 bool isOrphanedLoopConstruct () const {
249- return ParentComputeConstruct == nullptr ;
239+ return ParentComputeConstructKind == OpenACCDirectiveKind::Invalid ;
250240 }
251- const OpenACCComputeConstruct *getParentComputeConstruct () const {
252- return ParentComputeConstruct;
241+
242+ OpenACCDirectiveKind getParentComputeConstructKind () const {
243+ return ParentComputeConstructKind;
253244 }
254245};
255246} // namespace clang
0 commit comments