diff options
author | NAKAMURA Takumi <geek4civic@gmail.com> | 2025-01-10 19:27:02 +0900 |
---|---|---|
committer | NAKAMURA Takumi <geek4civic@gmail.com> | 2025-01-10 19:27:02 +0900 |
commit | c4a2ca9b936391fb930ecbb3d5c5d34e371e45fb (patch) | |
tree | f7bbf2b44d3dc178bcbaefdc56254e2220237737 /clang/lib/Sema/TreeTransform.h | |
parent | 5633a2072696b20c554ff5568c5a1d25aa7e8db3 (diff) | |
parent | 0350c1eba1c1a6b73a8d9c271a7f3c8b33202579 (diff) | |
download | llvm-users/chapuni/cov/merge/forfile-base.zip llvm-users/chapuni/cov/merge/forfile-base.tar.gz llvm-users/chapuni/cov/merge/forfile-base.tar.bz2 |
Merge branch 'users/chapuni/cov/merge/region_segment' into users/chapuni/cov/merge/forfile-baseusers/chapuni/cov/merge/forfile-base
Diffstat (limited to 'clang/lib/Sema/TreeTransform.h')
-rw-r--r-- | clang/lib/Sema/TreeTransform.h | 80 |
1 files changed, 66 insertions, 14 deletions
diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h index c40ff8b..d00ad5a 100644 --- a/clang/lib/Sema/TreeTransform.h +++ b/clang/lib/Sema/TreeTransform.h @@ -713,7 +713,7 @@ public: /// variables vector are acceptable. /// /// LastParamTransformed, if non-null, will be set to the index of the last - /// parameter on which transformation was started. In the event of an error, + /// parameter on which transfromation was started. In the event of an error, /// this will contain the parameter which failed to instantiate. /// /// Return true on error. @@ -4178,6 +4178,15 @@ public: SourceLocation{}, {}, SourceLocation{}, EndLoc, Clauses, {}); } + StmtResult RebuildOpenACCUpdateConstruct(SourceLocation BeginLoc, + SourceLocation DirLoc, + SourceLocation EndLoc, + ArrayRef<OpenACCClause *> Clauses) { + return getSema().OpenACC().ActOnEndStmtDirective( + OpenACCDirectiveKind::Update, BeginLoc, DirLoc, SourceLocation{}, + SourceLocation{}, {}, SourceLocation{}, EndLoc, Clauses, {}); + } + StmtResult RebuildOpenACCWaitConstruct( SourceLocation BeginLoc, SourceLocation DirLoc, SourceLocation LParenLoc, Expr *DevNumExpr, SourceLocation QueuesLoc, ArrayRef<Expr *> QueueIdExprs, @@ -11638,22 +11647,48 @@ template <typename Derived> void OpenACCClauseTransform<Derived>::VisitSelfClause( const OpenACCSelfClause &C) { - if (C.hasConditionExpr()) { - Expr *Cond = const_cast<Expr *>(C.getConditionExpr()); - Sema::ConditionResult Res = - Self.TransformCondition(Cond->getExprLoc(), /*Var=*/nullptr, Cond, - Sema::ConditionKind::Boolean); + // If this is an 'update' 'self' clause, this is actually a var list instead. + if (ParsedClause.getDirectiveKind() == OpenACCDirectiveKind::Update) { + llvm::SmallVector<Expr *> InstantiatedVarList; + for (Expr *CurVar : C.getVarList()) { + ExprResult Res = Self.TransformExpr(CurVar); - if (Res.isInvalid() || !Res.get().second) - return; + if (!Res.isUsable()) + continue; - ParsedClause.setConditionDetails(Res.get().second); - } + Res = Self.getSema().OpenACC().ActOnVar(ParsedClause.getClauseKind(), + Res.get()); - NewClause = OpenACCSelfClause::Create( - Self.getSema().getASTContext(), ParsedClause.getBeginLoc(), - ParsedClause.getLParenLoc(), ParsedClause.getConditionExpr(), - ParsedClause.getEndLoc()); + if (Res.isUsable()) + InstantiatedVarList.push_back(Res.get()); + } + + ParsedClause.setVarListDetails(InstantiatedVarList, + /*IsReadOnly=*/false, /*IsZero=*/false); + + NewClause = OpenACCSelfClause::Create( + Self.getSema().getASTContext(), ParsedClause.getBeginLoc(), + ParsedClause.getLParenLoc(), ParsedClause.getVarList(), + ParsedClause.getEndLoc()); + } else { + + if (C.hasConditionExpr()) { + Expr *Cond = const_cast<Expr *>(C.getConditionExpr()); + Sema::ConditionResult Res = + Self.TransformCondition(Cond->getExprLoc(), /*Var=*/nullptr, Cond, + Sema::ConditionKind::Boolean); + + if (Res.isInvalid() || !Res.get().second) + return; + + ParsedClause.setConditionDetails(Res.get().second); + } + + NewClause = OpenACCSelfClause::Create( + Self.getSema().getASTContext(), ParsedClause.getBeginLoc(), + ParsedClause.getLParenLoc(), ParsedClause.getConditionExpr(), + ParsedClause.getEndLoc()); + } } template <typename Derived> @@ -12472,6 +12507,23 @@ TreeTransform<Derived>::TransformOpenACCSetConstruct(OpenACCSetConstruct *C) { } template <typename Derived> +StmtResult TreeTransform<Derived>::TransformOpenACCUpdateConstruct( + OpenACCUpdateConstruct *C) { + getSema().OpenACC().ActOnConstruct(C->getDirectiveKind(), C->getBeginLoc()); + + llvm::SmallVector<OpenACCClause *> TransformedClauses = + getDerived().TransformOpenACCClauseList(C->getDirectiveKind(), + C->clauses()); + if (getSema().OpenACC().ActOnStartStmtDirective( + C->getDirectiveKind(), C->getBeginLoc(), TransformedClauses)) + return StmtError(); + + return getDerived().RebuildOpenACCUpdateConstruct( + C->getBeginLoc(), C->getDirectiveLoc(), C->getEndLoc(), + TransformedClauses); +} + +template <typename Derived> StmtResult TreeTransform<Derived>::TransformOpenACCWaitConstruct(OpenACCWaitConstruct *C) { getSema().OpenACC().ActOnConstruct(C->getDirectiveKind(), C->getBeginLoc()); |