Skip to content

Commit 939bb4e

Browse files
committed
[NFC] Add const to newly added helper functions from PR #135226
1 parent 2e8b539 commit 939bb4e

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

flang/lib/Lower/OpenMP/OpenMP.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -981,14 +981,14 @@ static void genLoopVars(
981981
}
982982

983983
static clause::Defaultmap::ImplicitBehavior
984-
getDefaultmapIfPresent(DefaultMapsTy &defaultMaps, mlir::Type varType) {
984+
getDefaultmapIfPresent(const DefaultMapsTy &defaultMaps, mlir::Type varType) {
985985
using DefMap = clause::Defaultmap;
986986

987987
if (defaultMaps.empty())
988988
return DefMap::ImplicitBehavior::Default;
989989

990990
if (llvm::is_contained(defaultMaps, DefMap::VariableCategory::All))
991-
return defaultMaps[DefMap::VariableCategory::All];
991+
return defaultMaps.at(DefMap::VariableCategory::All);
992992

993993
// NOTE: Unsure if complex and/or vector falls into a scalar type
994994
// or aggregate, but the current default implicit behaviour is to
@@ -997,19 +997,19 @@ getDefaultmapIfPresent(DefaultMapsTy &defaultMaps, mlir::Type varType) {
997997
if ((fir::isa_trivial(varType) || fir::isa_char(varType) ||
998998
fir::isa_builtin_cptr_type(varType)) &&
999999
llvm::is_contained(defaultMaps, DefMap::VariableCategory::Scalar))
1000-
return defaultMaps[DefMap::VariableCategory::Scalar];
1000+
return defaultMaps.at(DefMap::VariableCategory::Scalar);
10011001

10021002
if (fir::isPointerType(varType) &&
10031003
llvm::is_contained(defaultMaps, DefMap::VariableCategory::Pointer))
1004-
return defaultMaps[DefMap::VariableCategory::Pointer];
1004+
return defaultMaps.at(DefMap::VariableCategory::Pointer);
10051005

10061006
if (fir::isAllocatableType(varType) &&
10071007
llvm::is_contained(defaultMaps, DefMap::VariableCategory::Allocatable))
1008-
return defaultMaps[DefMap::VariableCategory::Allocatable];
1008+
return defaultMaps.at(DefMap::VariableCategory::Allocatable);
10091009

10101010
if (fir::isa_aggregate(varType) &&
10111011
llvm::is_contained(defaultMaps, DefMap::VariableCategory::Aggregate))
1012-
return defaultMaps[DefMap::VariableCategory::Aggregate];
1012+
return defaultMaps.at(DefMap::VariableCategory::Aggregate);
10131013

10141014
return DefMap::ImplicitBehavior::Default;
10151015
}
@@ -1018,7 +1018,7 @@ static std::pair<llvm::omp::OpenMPOffloadMappingFlags,
10181018
mlir::omp::VariableCaptureKind>
10191019
getImplicitMapTypeAndKind(fir::FirOpBuilder &firOpBuilder,
10201020
lower::AbstractConverter &converter,
1021-
DefaultMapsTy &defaultMaps, mlir::Type varType,
1021+
const DefaultMapsTy &defaultMaps, mlir::Type varType,
10221022
mlir::Location loc, const semantics::Symbol &sym) {
10231023
using DefMap = clause::Defaultmap;
10241024
// Check if a value of type `type` can be passed to the kernel by value.

0 commit comments

Comments
 (0)