[flang-commits] [llvm] [flang] [flang][OpenMP] Add semantic check for declare target (PR #71861)
via flang-commits
flang-commits at lists.llvm.org
Thu Nov 16 09:19:19 PST 2023
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 3d2527ebe3eb75381abd500b9851f7a2bf61d6b8 4b893d2dedd7ae9c00d9b6b07217bcd6aee785b7 -- flang/lib/Lower/OpenMP.cpp flang/lib/Parser/openmp-parsers.cpp flang/lib/Semantics/check-omp-structure.cpp flang/lib/Semantics/check-omp-structure.h flang/lib/Semantics/resolve-directives.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/flang/lib/Lower/OpenMP.cpp b/flang/lib/Lower/OpenMP.cpp
index 3b9c6a5804..6657f46ba6 100644
--- a/flang/lib/Lower/OpenMP.cpp
+++ b/flang/lib/Lower/OpenMP.cpp
@@ -589,7 +589,8 @@ public:
llvm::SmallVectorImpl<mlir::Attribute> &reductionDeclSymbols) const;
bool processSectionsReduction(mlir::Location currentLocation) const;
bool processTo(llvm::SmallVectorImpl<DeclareTargetCapturePair> &result) const;
- bool processEnter(llvm::SmallVectorImpl<DeclareTargetCapturePair> &result) const;
+ bool
+ processEnter(llvm::SmallVectorImpl<DeclareTargetCapturePair> &result) const;
bool
processUseDeviceAddr(llvm::SmallVectorImpl<mlir::Value> &operands,
llvm::SmallVectorImpl<mlir::Type> &useDeviceTypes,
@@ -1855,10 +1856,12 @@ bool ClauseProcessor::processTo(
bool ClauseProcessor::processEnter(
llvm::SmallVectorImpl<DeclareTargetCapturePair> &result) const {
return findRepeatableClause<ClauseTy::Enter>(
- [&](const ClauseTy::Enter *enterClause, const Fortran::parser::CharBlock &) {
+ [&](const ClauseTy::Enter *enterClause,
+ const Fortran::parser::CharBlock &) {
// Case: declare target to(func, var1, var2)...
gatherFuncAndVarSyms(enterClause->v,
- mlir::omp::DeclareTargetCaptureClause::enter, result);
+ mlir::omp::DeclareTargetCaptureClause::enter,
+ result);
});
}
diff --git a/flang/lib/Semantics/check-omp-structure.cpp b/flang/lib/Semantics/check-omp-structure.cpp
index 35a975333f..4dbbf1260f 100644
--- a/flang/lib/Semantics/check-omp-structure.cpp
+++ b/flang/lib/Semantics/check-omp-structure.cpp
@@ -3255,12 +3255,13 @@ const parser::OmpObjectList *OmpStructureChecker::GetOmpObjectList(
const parser::OmpClause &clause) {
// Clauses with OmpObjectList as its data member
- using MemberObjectListClauses = std::tuple<parser::OmpClause::Copyprivate,
- parser::OmpClause::Copyin, parser::OmpClause::Firstprivate,
- parser::OmpClause::From, parser::OmpClause::Lastprivate,
- parser::OmpClause::Link, parser::OmpClause::Private,
- parser::OmpClause::Shared, parser::OmpClause::To, parser::OmpClause::Enter,
- parser::OmpClause::UseDevicePtr, parser::OmpClause::UseDeviceAddr>;
+ using MemberObjectListClauses =
+ std::tuple<parser::OmpClause::Copyprivate, parser::OmpClause::Copyin,
+ parser::OmpClause::Firstprivate, parser::OmpClause::From,
+ parser::OmpClause::Lastprivate, parser::OmpClause::Link,
+ parser::OmpClause::Private, parser::OmpClause::Shared,
+ parser::OmpClause::To, parser::OmpClause::Enter,
+ parser::OmpClause::UseDevicePtr, parser::OmpClause::UseDeviceAddr>;
// Clauses with OmpObjectList in the tuple
using TupleObjectListClauses =
diff --git a/flang/lib/Semantics/resolve-directives.cpp b/flang/lib/Semantics/resolve-directives.cpp
index db3a9ce1d2..882ecad1f7 100644
--- a/flang/lib/Semantics/resolve-directives.cpp
+++ b/flang/lib/Semantics/resolve-directives.cpp
@@ -1744,8 +1744,8 @@ bool OmpAttributeVisitor::Pre(const parser::OpenMPDeclareTargetConstruct &x) {
} else if (const auto *linkClause{
std::get_if<parser::OmpClause::Link>(&clause.u)}) {
ResolveOmpObjectList(linkClause->v, Symbol::Flag::OmpDeclareTarget);
- }
- else if(const auto *enterClause{std::get_if<parser::OmpClause::Enter>(&clause.u)}) {
+ } else if (const auto *enterClause{
+ std::get_if<parser::OmpClause::Enter>(&clause.u)}) {
ResolveOmpObjectList(enterClause->v, Symbol::Flag::OmpDeclareTarget);
}
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/71861
More information about the flang-commits
mailing list