Skip to content

Commit 4d17743

Browse files
authored
[flang][OpenMP] Rename makeList overloads to make{Objects,Clauses}, NFC (#86725)
Reserve `makeList` to create a list given an explicit converter function.
1 parent fca4831 commit 4d17743

File tree

5 files changed

+34
-34
lines changed

5 files changed

+34
-34
lines changed

flang/lib/Lower/OpenMP/ClauseProcessor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class ClauseProcessor {
5151
Fortran::semantics::SemanticsContext &semaCtx,
5252
const Fortran::parser::OmpClauseList &clauses)
5353
: converter(converter), semaCtx(semaCtx),
54-
clauses(makeList(clauses, semaCtx)) {}
54+
clauses(makeClauses(clauses, semaCtx)) {}
5555

5656
// 'Unique' clauses: They can appear at most once in the clause list.
5757
bool processCollapse(

flang/lib/Lower/OpenMP/Clauses.cpp

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ Aligned make(const parser::OmpClause::Aligned &inp,
347347

348348
return Aligned{{
349349
/*Alignment=*/maybeApply(makeExprFn(semaCtx), t1),
350-
/*List=*/makeList(t0, semaCtx),
350+
/*List=*/makeObjects(t0, semaCtx),
351351
}};
352352
}
353353

@@ -362,7 +362,7 @@ Allocate make(const parser::OmpClause::Allocate &inp,
362362
return Allocate{{/*AllocatorSimpleModifier=*/std::nullopt,
363363
/*AllocatorComplexModifier=*/std::nullopt,
364364
/*AlignModifier=*/std::nullopt,
365-
/*List=*/makeList(t1, semaCtx)}};
365+
/*List=*/makeObjects(t1, semaCtx)}};
366366
}
367367

368368
using Tuple = decltype(Allocate::t);
@@ -374,7 +374,7 @@ Allocate make(const parser::OmpClause::Allocate &inp,
374374
return {/*AllocatorSimpleModifier=*/makeExpr(v.v, semaCtx),
375375
/*AllocatorComplexModifier=*/std::nullopt,
376376
/*AlignModifier=*/std::nullopt,
377-
/*List=*/makeList(t1, semaCtx)};
377+
/*List=*/makeObjects(t1, semaCtx)};
378378
},
379379
// complex-modifier + align-modifier
380380
[&](const wrapped::AllocateModifier::ComplexModifier &v) -> Tuple {
@@ -384,14 +384,14 @@ Allocate make(const parser::OmpClause::Allocate &inp,
384384
/*AllocatorSimpleModifier=*/std::nullopt,
385385
/*AllocatorComplexModifier=*/Allocator{makeExpr(s0.v, semaCtx)},
386386
/*AlignModifier=*/Align{makeExpr(s1.v, semaCtx)},
387-
/*List=*/makeList(t1, semaCtx)};
387+
/*List=*/makeObjects(t1, semaCtx)};
388388
},
389389
// align-modifier
390390
[&](const wrapped::AllocateModifier::Align &v) -> Tuple {
391391
return {/*AllocatorSimpleModifier=*/std::nullopt,
392392
/*AllocatorComplexModifier=*/std::nullopt,
393393
/*AlignModifier=*/Align{makeExpr(v.v, semaCtx)},
394-
/*List=*/makeList(t1, semaCtx)};
394+
/*List=*/makeObjects(t1, semaCtx)};
395395
},
396396
},
397397
t0->u)};
@@ -450,13 +450,13 @@ Collapse make(const parser::OmpClause::Collapse &inp,
450450
Copyin make(const parser::OmpClause::Copyin &inp,
451451
semantics::SemanticsContext &semaCtx) {
452452
// inp.v -> parser::OmpObjectList
453-
return Copyin{/*List=*/makeList(inp.v, semaCtx)};
453+
return Copyin{/*List=*/makeObjects(inp.v, semaCtx)};
454454
}
455455

456456
Copyprivate make(const parser::OmpClause::Copyprivate &inp,
457457
semantics::SemanticsContext &semaCtx) {
458458
// inp.v -> parser::OmpObjectList
459-
return Copyprivate{/*List=*/makeList(inp.v, semaCtx)};
459+
return Copyprivate{/*List=*/makeObjects(inp.v, semaCtx)};
460460
}
461461

462462
Default make(const parser::OmpClause::Default &inp,
@@ -641,7 +641,7 @@ Doacross make(const parser::OmpClause::Doacross &inp,
641641
Enter make(const parser::OmpClause::Enter &inp,
642642
semantics::SemanticsContext &semaCtx) {
643643
// inp.v -> parser::OmpObjectList
644-
return Enter{makeList(/*List=*/inp.v, semaCtx)};
644+
return Enter{makeObjects(/*List=*/inp.v, semaCtx)};
645645
}
646646

647647
Exclusive make(const parser::OmpClause::Exclusive &inp,
@@ -671,7 +671,7 @@ Final make(const parser::OmpClause::Final &inp,
671671
Firstprivate make(const parser::OmpClause::Firstprivate &inp,
672672
semantics::SemanticsContext &semaCtx) {
673673
// inp.v -> parser::OmpObjectList
674-
return Firstprivate{/*List=*/makeList(inp.v, semaCtx)};
674+
return Firstprivate{/*List=*/makeObjects(inp.v, semaCtx)};
675675
}
676676

677677
// Flush: empty
@@ -681,7 +681,7 @@ From make(const parser::OmpClause::From &inp,
681681
// inp.v -> parser::OmpObjectList
682682
return From{{/*Expectation=*/std::nullopt, /*Mapper=*/std::nullopt,
683683
/*Iterator=*/std::nullopt,
684-
/*LocatorList=*/makeList(inp.v, semaCtx)}};
684+
/*LocatorList=*/makeObjects(inp.v, semaCtx)}};
685685
}
686686

687687
// Full: empty
@@ -696,7 +696,7 @@ Grainsize make(const parser::OmpClause::Grainsize &inp,
696696
HasDeviceAddr make(const parser::OmpClause::HasDeviceAddr &inp,
697697
semantics::SemanticsContext &semaCtx) {
698698
// inp.v -> parser::OmpObjectList
699-
return HasDeviceAddr{/*List=*/makeList(inp.v, semaCtx)};
699+
return HasDeviceAddr{/*List=*/makeObjects(inp.v, semaCtx)};
700700
}
701701

702702
Hint make(const parser::OmpClause::Hint &inp,
@@ -762,20 +762,20 @@ InReduction make(const parser::OmpClause::InReduction &inp,
762762
auto &t1 = std::get<parser::OmpObjectList>(inp.v.t);
763763
return InReduction{
764764
{/*ReductionIdentifiers=*/{makeReductionOperator(t0, semaCtx)},
765-
/*List=*/makeList(t1, semaCtx)}};
765+
/*List=*/makeObjects(t1, semaCtx)}};
766766
}
767767

768768
IsDevicePtr make(const parser::OmpClause::IsDevicePtr &inp,
769769
semantics::SemanticsContext &semaCtx) {
770770
// inp.v -> parser::OmpObjectList
771-
return IsDevicePtr{/*List=*/makeList(inp.v, semaCtx)};
771+
return IsDevicePtr{/*List=*/makeObjects(inp.v, semaCtx)};
772772
}
773773

774774
Lastprivate make(const parser::OmpClause::Lastprivate &inp,
775775
semantics::SemanticsContext &semaCtx) {
776776
// inp.v -> parser::OmpObjectList
777777
return Lastprivate{{/*LastprivateModifier=*/std::nullopt,
778-
/*List=*/makeList(inp.v, semaCtx)}};
778+
/*List=*/makeObjects(inp.v, semaCtx)}};
779779
}
780780

781781
Linear make(const parser::OmpClause::Linear &inp,
@@ -817,7 +817,7 @@ Linear make(const parser::OmpClause::Linear &inp,
817817
Link make(const parser::OmpClause::Link &inp,
818818
semantics::SemanticsContext &semaCtx) {
819819
// inp.v -> parser::OmpObjectList
820-
return Link{/*List=*/makeList(inp.v, semaCtx)};
820+
return Link{/*List=*/makeObjects(inp.v, semaCtx)};
821821
}
822822

823823
Map make(const parser::OmpClause::Map &inp,
@@ -844,7 +844,7 @@ Map make(const parser::OmpClause::Map &inp,
844844
if (!t0) {
845845
return Map{{/*MapType=*/std::nullopt, /*MapTypeModifiers=*/std::nullopt,
846846
/*Mapper=*/std::nullopt, /*Iterator=*/std::nullopt,
847-
/*LocatorList=*/makeList(t1, semaCtx)}};
847+
/*LocatorList=*/makeObjects(t1, semaCtx)}};
848848
}
849849

850850
auto &s0 = std::get<std::optional<parser::OmpMapType::Always>>(t0->t);
@@ -857,7 +857,7 @@ Map make(const parser::OmpClause::Map &inp,
857857
return Map{{/*MapType=*/convert1(s1),
858858
/*MapTypeModifiers=*/maybeList,
859859
/*Mapper=*/std::nullopt, /*Iterator=*/std::nullopt,
860-
/*LocatorList=*/makeList(t1, semaCtx)}};
860+
/*LocatorList=*/makeObjects(t1, semaCtx)}};
861861
}
862862

863863
// Match: incomplete
@@ -980,7 +980,7 @@ Priority make(const parser::OmpClause::Priority &inp,
980980
Private make(const parser::OmpClause::Private &inp,
981981
semantics::SemanticsContext &semaCtx) {
982982
// inp.v -> parser::OmpObjectList
983-
return Private{/*List=*/makeList(inp.v, semaCtx)};
983+
return Private{/*List=*/makeObjects(inp.v, semaCtx)};
984984
}
985985

986986
ProcBind make(const parser::OmpClause::ProcBind &inp,
@@ -1010,7 +1010,7 @@ Reduction make(const parser::OmpClause::Reduction &inp,
10101010
return Reduction{
10111011
{/*ReductionIdentifiers=*/{makeReductionOperator(t0, semaCtx)},
10121012
/*ReductionModifier=*/std::nullopt,
1013-
/*List=*/makeList(t1, semaCtx)}};
1013+
/*List=*/makeObjects(t1, semaCtx)}};
10141014
}
10151015

10161016
// Relaxed: empty
@@ -1104,7 +1104,7 @@ Severity make(const parser::OmpClause::Severity &inp,
11041104
Shared make(const parser::OmpClause::Shared &inp,
11051105
semantics::SemanticsContext &semaCtx) {
11061106
// inp.v -> parser::OmpObjectList
1107-
return Shared{/*List=*/makeList(inp.v, semaCtx)};
1107+
return Shared{/*List=*/makeObjects(inp.v, semaCtx)};
11081108
}
11091109

11101110
// Simd: empty
@@ -1128,7 +1128,7 @@ TaskReduction make(const parser::OmpClause::TaskReduction &inp,
11281128
auto &t1 = std::get<parser::OmpObjectList>(inp.v.t);
11291129
return TaskReduction{
11301130
{/*ReductionIdentifiers=*/{makeReductionOperator(t0, semaCtx)},
1131-
/*List=*/makeList(t1, semaCtx)}};
1131+
/*List=*/makeObjects(t1, semaCtx)}};
11321132
}
11331133

11341134
ThreadLimit make(const parser::OmpClause::ThreadLimit &inp,
@@ -1145,7 +1145,7 @@ To make(const parser::OmpClause::To &inp,
11451145
// inp.v -> parser::OmpObjectList
11461146
return To{{/*Expectation=*/std::nullopt, /*Mapper=*/std::nullopt,
11471147
/*Iterator=*/std::nullopt,
1148-
/*LocatorList=*/makeList(inp.v, semaCtx)}};
1148+
/*LocatorList=*/makeObjects(inp.v, semaCtx)}};
11491149
}
11501150

11511151
// UnifiedAddress: empty
@@ -1175,13 +1175,13 @@ Use make(const parser::OmpClause::Use &inp,
11751175
UseDeviceAddr make(const parser::OmpClause::UseDeviceAddr &inp,
11761176
semantics::SemanticsContext &semaCtx) {
11771177
// inp.v -> parser::OmpObjectList
1178-
return UseDeviceAddr{/*List=*/makeList(inp.v, semaCtx)};
1178+
return UseDeviceAddr{/*List=*/makeObjects(inp.v, semaCtx)};
11791179
}
11801180

11811181
UseDevicePtr make(const parser::OmpClause::UseDevicePtr &inp,
11821182
semantics::SemanticsContext &semaCtx) {
11831183
// inp.v -> parser::OmpObjectList
1184-
return UseDevicePtr{/*List=*/makeList(inp.v, semaCtx)};
1184+
return UseDevicePtr{/*List=*/makeObjects(inp.v, semaCtx)};
11851185
}
11861186

11871187
UsesAllocators make(const parser::OmpClause::UsesAllocators &inp,
@@ -1205,8 +1205,8 @@ Clause makeClause(const Fortran::parser::OmpClause &cls,
12051205
cls.u);
12061206
}
12071207

1208-
List<Clause> makeList(const parser::OmpClauseList &clauses,
1209-
semantics::SemanticsContext &semaCtx) {
1208+
List<Clause> makeClauses(const parser::OmpClauseList &clauses,
1209+
semantics::SemanticsContext &semaCtx) {
12101210
return makeList(clauses.v, [&](const parser::OmpClause &s) {
12111211
return makeClause(s, semaCtx);
12121212
});

flang/lib/Lower/OpenMP/Clauses.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ List<ResultTy> makeList(ContainerTy &&container, FunctionTy &&func) {
8888
return v;
8989
}
9090

91-
inline ObjectList makeList(const parser::OmpObjectList &objects,
92-
semantics::SemanticsContext &semaCtx) {
91+
inline ObjectList makeObjects(const parser::OmpObjectList &objects,
92+
semantics::SemanticsContext &semaCtx) {
9393
return makeList(objects.v, makeObjectFn(semaCtx));
9494
}
9595

@@ -256,8 +256,8 @@ Clause makeClause(llvm::omp::Clause id, Specific &&specific,
256256
Clause makeClause(const Fortran::parser::OmpClause &cls,
257257
semantics::SemanticsContext &semaCtx);
258258

259-
List<Clause> makeList(const parser::OmpClauseList &clauses,
260-
semantics::SemanticsContext &semaCtx);
259+
List<Clause> makeClauses(const parser::OmpClauseList &clauses,
260+
semantics::SemanticsContext &semaCtx);
261261
} // namespace Fortran::lower::omp
262262

263263
#endif // FORTRAN_LOWER_OPENMP_CLAUSES_H

flang/lib/Lower/OpenMP/DataSharingProcessor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class DataSharingProcessor {
8989
Fortran::lower::SymMap *symTable = nullptr)
9090
: hasLastPrivateOp(false), converter(converter),
9191
firOpBuilder(converter.getFirOpBuilder()),
92-
clauses(omp::makeList(opClauseList, semaCtx)), eval(eval),
92+
clauses(omp::makeClauses(opClauseList, semaCtx)), eval(eval),
9393
useDelayedPrivatization(useDelayedPrivatization), symTable(symTable) {}
9494

9595
// Privatisation is split into two steps.

flang/lib/Lower/OpenMP/OpenMP.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1254,7 +1254,7 @@ static mlir::omp::DeclareTargetDeviceType getDeclareTargetInfo(
12541254

12551255
if (const auto *objectList{
12561256
Fortran::parser::Unwrap<Fortran::parser::OmpObjectList>(spec.u)}) {
1257-
ObjectList objects{makeList(*objectList, semaCtx)};
1257+
ObjectList objects{makeObjects(*objectList, semaCtx)};
12581258
// Case: declare target(func, var1, var2)
12591259
gatherFuncAndVarSyms(objects, mlir::omp::DeclareTargetCaptureClause::to,
12601260
symbolAndClause);
@@ -2352,7 +2352,7 @@ void Fortran::lower::genOpenMPReduction(
23522352
const Fortran::parser::OmpClauseList &clauseList) {
23532353
fir::FirOpBuilder &firOpBuilder = converter.getFirOpBuilder();
23542354

2355-
List<Clause> clauses{makeList(clauseList, semaCtx)};
2355+
List<Clause> clauses{makeClauses(clauseList, semaCtx)};
23562356

23572357
for (const Clause &clause : clauses) {
23582358
if (const auto &reductionClause =

0 commit comments

Comments
 (0)