Skip to content

Commit 7a66e42

Browse files
authored
[flang][OpenMP] Remove unnecessary Fortran:: qualification, NFC (#92298)
The `Fortran::` namespace is redundant for all parts of the code in this PR, except for names of functions in their definitions.
1 parent 7ce8d2e commit 7a66e42

File tree

11 files changed

+790
-969
lines changed

11 files changed

+790
-969
lines changed

flang/lib/Lower/OpenMP/ClauseProcessor.cpp

Lines changed: 90 additions & 111 deletions
Large diffs are not rendered by default.

flang/lib/Lower/OpenMP/ClauseProcessor.h

Lines changed: 53 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -47,44 +47,43 @@ namespace omp {
4747
/// construct.
4848
class ClauseProcessor {
4949
public:
50-
ClauseProcessor(Fortran::lower::AbstractConverter &converter,
51-
Fortran::semantics::SemanticsContext &semaCtx,
50+
ClauseProcessor(lower::AbstractConverter &converter,
51+
semantics::SemanticsContext &semaCtx,
5252
const List<Clause> &clauses)
5353
: converter(converter), semaCtx(semaCtx), clauses(clauses) {}
5454

5555
// 'Unique' clauses: They can appear at most once in the clause list.
56-
bool processCollapse(
57-
mlir::Location currentLocation, Fortran::lower::pft::Evaluation &eval,
58-
mlir::omp::CollapseClauseOps &result,
59-
llvm::SmallVectorImpl<const Fortran::semantics::Symbol *> &iv) const;
56+
bool
57+
processCollapse(mlir::Location currentLocation, lower::pft::Evaluation &eval,
58+
mlir::omp::CollapseClauseOps &result,
59+
llvm::SmallVectorImpl<const semantics::Symbol *> &iv) const;
6060
bool processDefault() const;
61-
bool processDevice(Fortran::lower::StatementContext &stmtCtx,
61+
bool processDevice(lower::StatementContext &stmtCtx,
6262
mlir::omp::DeviceClauseOps &result) const;
6363
bool processDeviceType(mlir::omp::DeviceTypeClauseOps &result) const;
64-
bool processFinal(Fortran::lower::StatementContext &stmtCtx,
64+
bool processFinal(lower::StatementContext &stmtCtx,
6565
mlir::omp::FinalClauseOps &result) const;
66-
bool
67-
processHasDeviceAddr(mlir::omp::HasDeviceAddrClauseOps &result,
68-
llvm::SmallVectorImpl<mlir::Type> &isDeviceTypes,
69-
llvm::SmallVectorImpl<mlir::Location> &isDeviceLocs,
70-
llvm::SmallVectorImpl<const Fortran::semantics::Symbol *>
71-
&isDeviceSymbols) const;
66+
bool processHasDeviceAddr(
67+
mlir::omp::HasDeviceAddrClauseOps &result,
68+
llvm::SmallVectorImpl<mlir::Type> &isDeviceTypes,
69+
llvm::SmallVectorImpl<mlir::Location> &isDeviceLocs,
70+
llvm::SmallVectorImpl<const semantics::Symbol *> &isDeviceSymbols) const;
7271
bool processHint(mlir::omp::HintClauseOps &result) const;
7372
bool processMergeable(mlir::omp::MergeableClauseOps &result) const;
7473
bool processNowait(mlir::omp::NowaitClauseOps &result) const;
75-
bool processNumTeams(Fortran::lower::StatementContext &stmtCtx,
74+
bool processNumTeams(lower::StatementContext &stmtCtx,
7675
mlir::omp::NumTeamsClauseOps &result) const;
77-
bool processNumThreads(Fortran::lower::StatementContext &stmtCtx,
76+
bool processNumThreads(lower::StatementContext &stmtCtx,
7877
mlir::omp::NumThreadsClauseOps &result) const;
7978
bool processOrdered(mlir::omp::OrderedClauseOps &result) const;
80-
bool processPriority(Fortran::lower::StatementContext &stmtCtx,
79+
bool processPriority(lower::StatementContext &stmtCtx,
8180
mlir::omp::PriorityClauseOps &result) const;
8281
bool processProcBind(mlir::omp::ProcBindClauseOps &result) const;
8382
bool processSafelen(mlir::omp::SafelenClauseOps &result) const;
84-
bool processSchedule(Fortran::lower::StatementContext &stmtCtx,
83+
bool processSchedule(lower::StatementContext &stmtCtx,
8584
mlir::omp::ScheduleClauseOps &result) const;
8685
bool processSimdlen(mlir::omp::SimdlenClauseOps &result) const;
87-
bool processThreadLimit(Fortran::lower::StatementContext &stmtCtx,
86+
bool processThreadLimit(lower::StatementContext &stmtCtx,
8887
mlir::omp::ThreadLimitClauseOps &result) const;
8988
bool processUntied(mlir::omp::UntiedClauseOps &result) const;
9089

@@ -98,12 +97,11 @@ class ClauseProcessor {
9897
processEnter(llvm::SmallVectorImpl<DeclareTargetCapturePair> &result) const;
9998
bool processIf(omp::clause::If::DirectiveNameModifier directiveName,
10099
mlir::omp::IfClauseOps &result) const;
101-
bool
102-
processIsDevicePtr(mlir::omp::IsDevicePtrClauseOps &result,
103-
llvm::SmallVectorImpl<mlir::Type> &isDeviceTypes,
104-
llvm::SmallVectorImpl<mlir::Location> &isDeviceLocs,
105-
llvm::SmallVectorImpl<const Fortran::semantics::Symbol *>
106-
&isDeviceSymbols) const;
100+
bool processIsDevicePtr(
101+
mlir::omp::IsDevicePtrClauseOps &result,
102+
llvm::SmallVectorImpl<mlir::Type> &isDeviceTypes,
103+
llvm::SmallVectorImpl<mlir::Location> &isDeviceLocs,
104+
llvm::SmallVectorImpl<const semantics::Symbol *> &isDeviceSymbols) const;
107105
bool
108106
processLink(llvm::SmallVectorImpl<DeclareTargetCapturePair> &result) const;
109107

@@ -113,35 +111,32 @@ class ClauseProcessor {
113111
// They may be used later on to create the block_arguments for some of the
114112
// target directives that require it.
115113
bool processMap(
116-
mlir::Location currentLocation, Fortran::lower::StatementContext &stmtCtx,
114+
mlir::Location currentLocation, lower::StatementContext &stmtCtx,
117115
mlir::omp::MapClauseOps &result,
118-
llvm::SmallVectorImpl<const Fortran::semantics::Symbol *> *mapSyms =
119-
nullptr,
116+
llvm::SmallVectorImpl<const semantics::Symbol *> *mapSyms = nullptr,
120117
llvm::SmallVectorImpl<mlir::Location> *mapSymLocs = nullptr,
121118
llvm::SmallVectorImpl<mlir::Type> *mapSymTypes = nullptr) const;
122119
bool processReduction(
123120
mlir::Location currentLocation, mlir::omp::ReductionClauseOps &result,
124121
llvm::SmallVectorImpl<mlir::Type> *reductionTypes = nullptr,
125-
llvm::SmallVectorImpl<const Fortran::semantics::Symbol *> *reductionSyms =
122+
llvm::SmallVectorImpl<const semantics::Symbol *> *reductionSyms =
126123
nullptr) const;
127124
bool processSectionsReduction(mlir::Location currentLocation,
128125
mlir::omp::ReductionClauseOps &result) const;
129126
bool processTo(llvm::SmallVectorImpl<DeclareTargetCapturePair> &result) const;
130-
bool
131-
processUseDeviceAddr(mlir::omp::UseDeviceClauseOps &result,
132-
llvm::SmallVectorImpl<mlir::Type> &useDeviceTypes,
133-
llvm::SmallVectorImpl<mlir::Location> &useDeviceLocs,
134-
llvm::SmallVectorImpl<const Fortran::semantics::Symbol *>
135-
&useDeviceSyms) const;
136-
bool
137-
processUseDevicePtr(mlir::omp::UseDeviceClauseOps &result,
138-
llvm::SmallVectorImpl<mlir::Type> &useDeviceTypes,
139-
llvm::SmallVectorImpl<mlir::Location> &useDeviceLocs,
140-
llvm::SmallVectorImpl<const Fortran::semantics::Symbol *>
141-
&useDeviceSyms) const;
127+
bool processUseDeviceAddr(
128+
mlir::omp::UseDeviceClauseOps &result,
129+
llvm::SmallVectorImpl<mlir::Type> &useDeviceTypes,
130+
llvm::SmallVectorImpl<mlir::Location> &useDeviceLocs,
131+
llvm::SmallVectorImpl<const semantics::Symbol *> &useDeviceSyms) const;
132+
bool processUseDevicePtr(
133+
mlir::omp::UseDeviceClauseOps &result,
134+
llvm::SmallVectorImpl<mlir::Type> &useDeviceTypes,
135+
llvm::SmallVectorImpl<mlir::Location> &useDeviceLocs,
136+
llvm::SmallVectorImpl<const semantics::Symbol *> &useDeviceSyms) const;
142137

143138
template <typename T>
144-
bool processMotionClauses(Fortran::lower::StatementContext &stmtCtx,
139+
bool processMotionClauses(lower::StatementContext &stmtCtx,
145140
mlir::omp::MapClauseOps &result);
146141

147142
// Call this method for these clauses that should be supported but are not
@@ -162,36 +157,34 @@ class ClauseProcessor {
162157
/// `nullptr` if not present. If more than one instance is expected, use
163158
/// `findRepeatableClause` instead.
164159
template <typename T>
165-
const T *
166-
findUniqueClause(const Fortran::parser::CharBlock **source = nullptr) const;
160+
const T *findUniqueClause(const parser::CharBlock **source = nullptr) const;
167161

168162
/// Call `callbackFn` for each occurrence of the given clause. Return `true`
169163
/// if at least one instance was found.
170164
template <typename T>
171165
bool findRepeatableClause(
172-
std::function<void(const T &, const Fortran::parser::CharBlock &source)>
166+
std::function<void(const T &, const parser::CharBlock &source)>
173167
callbackFn) const;
174168

175169
/// Set the `result` to a new `mlir::UnitAttr` if the clause is present.
176170
template <typename T>
177171
bool markClauseOccurrence(mlir::UnitAttr &result) const;
178172

179-
Fortran::lower::AbstractConverter &converter;
180-
Fortran::semantics::SemanticsContext &semaCtx;
173+
lower::AbstractConverter &converter;
174+
semantics::SemanticsContext &semaCtx;
181175
List<Clause> clauses;
182176
};
183177

184178
template <typename T>
185-
bool ClauseProcessor::processMotionClauses(
186-
Fortran::lower::StatementContext &stmtCtx,
187-
mlir::omp::MapClauseOps &result) {
188-
std::map<const Fortran::semantics::Symbol *,
179+
bool ClauseProcessor::processMotionClauses(lower::StatementContext &stmtCtx,
180+
mlir::omp::MapClauseOps &result) {
181+
std::map<const semantics::Symbol *,
189182
llvm::SmallVector<OmpMapMemberIndicesData>>
190183
parentMemberIndices;
191-
llvm::SmallVector<const Fortran::semantics::Symbol *> mapSymbols;
184+
llvm::SmallVector<const semantics::Symbol *> mapSymbols;
192185

193186
bool clauseFound = findRepeatableClause<T>(
194-
[&](const T &clause, const Fortran::parser::CharBlock &source) {
187+
[&](const T &clause, const parser::CharBlock &source) {
195188
mlir::Location clauseLocation = converter.genLocation(source);
196189
fir::FirOpBuilder &firOpBuilder = converter.getFirOpBuilder();
197190

@@ -209,9 +202,9 @@ bool ClauseProcessor::processMotionClauses(
209202
llvm::SmallVector<mlir::Value> bounds;
210203
std::stringstream asFortran;
211204

212-
Fortran::lower::AddrAndBoundsInfo info =
213-
Fortran::lower::gatherDataOperandAddrAndBounds<
214-
mlir::omp::MapBoundsOp, mlir::omp::MapBoundsType>(
205+
lower::AddrAndBoundsInfo info =
206+
lower::gatherDataOperandAddrAndBounds<mlir::omp::MapBoundsOp,
207+
mlir::omp::MapBoundsType>(
215208
converter, firOpBuilder, semaCtx, stmtCtx, *object.id(),
216209
object.ref(), clauseLocation, asFortran, bounds,
217210
treatIndexAsSection);
@@ -277,8 +270,8 @@ ClauseProcessor::findClause(ClauseIterator begin, ClauseIterator end) {
277270
}
278271

279272
template <typename T>
280-
const T *ClauseProcessor::findUniqueClause(
281-
const Fortran::parser::CharBlock **source) const {
273+
const T *
274+
ClauseProcessor::findUniqueClause(const parser::CharBlock **source) const {
282275
ClauseIterator it = findClause<T>(clauses.begin(), clauses.end());
283276
if (it != clauses.end()) {
284277
if (source)
@@ -290,8 +283,8 @@ const T *ClauseProcessor::findUniqueClause(
290283

291284
template <typename T>
292285
bool ClauseProcessor::findRepeatableClause(
293-
std::function<void(const T &, const Fortran::parser::CharBlock &source)>
294-
callbackFn) const {
286+
std::function<void(const T &, const parser::CharBlock &source)> callbackFn)
287+
const {
295288
bool found = false;
296289
ClauseIterator nextIt, endIt = clauses.end();
297290
for (ClauseIterator it = clauses.begin(); it != endIt; it = nextIt) {

flang/lib/Lower/OpenMP/Clauses.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,8 @@ Object makeObject(const parser::OmpObject &object,
150150
return makeObject(std::get<parser::Designator>(object.u), semaCtx);
151151
}
152152

153-
std::optional<Object>
154-
getBaseObject(const Object &object,
155-
Fortran::semantics::SemanticsContext &semaCtx) {
153+
std::optional<Object> getBaseObject(const Object &object,
154+
semantics::SemanticsContext &semaCtx) {
156155
// If it's just the symbol, then there is no base.
157156
if (!object.id())
158157
return std::nullopt;
@@ -1211,7 +1210,7 @@ UsesAllocators make(const parser::OmpClause::UsesAllocators &inp,
12111210
// Write: empty
12121211
} // namespace clause
12131212

1214-
Clause makeClause(const Fortran::parser::OmpClause &cls,
1213+
Clause makeClause(const parser::OmpClause &cls,
12151214
semantics::SemanticsContext &semaCtx) {
12161215
return std::visit(
12171216
[&](auto &&s) {

flang/lib/Lower/OpenMP/Clauses.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,8 @@ std::optional<ResultTy> maybeApply(FuncTy &&func,
107107
return std::move(func(*arg));
108108
}
109109

110-
std::optional<Object>
111-
getBaseObject(const Object &object,
112-
Fortran::semantics::SemanticsContext &semaCtx);
110+
std::optional<Object> getBaseObject(const Object &object,
111+
semantics::SemanticsContext &semaCtx);
113112

114113
namespace clause {
115114
using DefinedOperator = tomp::type::DefinedOperatorT<IdTy, ExprTy>;
@@ -262,7 +261,7 @@ Clause makeClause(llvm::omp::Clause id, Specific &&specific,
262261
return Clause(typename Clause::BaseT{id, specific}, source);
263262
}
264263

265-
Clause makeClause(const Fortran::parser::OmpClause &cls,
264+
Clause makeClause(const parser::OmpClause &cls,
266265
semantics::SemanticsContext &semaCtx);
267266

268267
List<Clause> makeClauses(const parser::OmpClauseList &clauses,

0 commit comments

Comments
 (0)