[flang-commits] [flang] 939bb4e - [NFC] Add const to newly added helper functions from PR #135226
via flang-commits
flang-commits at lists.llvm.org
Mon May 12 08:50:33 PDT 2025
Author: agozillon
Date: 2025-05-12T10:49:49-05:00
New Revision: 939bb4e028499a3eda783567cda7d5331ba0c242
URL: https://github.com/llvm/llvm-project/commit/939bb4e028499a3eda783567cda7d5331ba0c242
DIFF: https://github.com/llvm/llvm-project/commit/939bb4e028499a3eda783567cda7d5331ba0c242.diff
LOG: [NFC] Add const to newly added helper functions from PR #135226
Added:
Modified:
flang/lib/Lower/OpenMP/OpenMP.cpp
Removed:
################################################################################
diff --git a/flang/lib/Lower/OpenMP/OpenMP.cpp b/flang/lib/Lower/OpenMP/OpenMP.cpp
index 43f2f35b2ba61..446aa2deb3d05 100644
--- a/flang/lib/Lower/OpenMP/OpenMP.cpp
+++ b/flang/lib/Lower/OpenMP/OpenMP.cpp
@@ -981,14 +981,14 @@ static void genLoopVars(
}
static clause::Defaultmap::ImplicitBehavior
-getDefaultmapIfPresent(DefaultMapsTy &defaultMaps, mlir::Type varType) {
+getDefaultmapIfPresent(const DefaultMapsTy &defaultMaps, mlir::Type varType) {
using DefMap = clause::Defaultmap;
if (defaultMaps.empty())
return DefMap::ImplicitBehavior::Default;
if (llvm::is_contained(defaultMaps, DefMap::VariableCategory::All))
- return defaultMaps[DefMap::VariableCategory::All];
+ return defaultMaps.at(DefMap::VariableCategory::All);
// NOTE: Unsure if complex and/or vector falls into a scalar type
// or aggregate, but the current default implicit behaviour is to
@@ -997,19 +997,19 @@ getDefaultmapIfPresent(DefaultMapsTy &defaultMaps, mlir::Type varType) {
if ((fir::isa_trivial(varType) || fir::isa_char(varType) ||
fir::isa_builtin_cptr_type(varType)) &&
llvm::is_contained(defaultMaps, DefMap::VariableCategory::Scalar))
- return defaultMaps[DefMap::VariableCategory::Scalar];
+ return defaultMaps.at(DefMap::VariableCategory::Scalar);
if (fir::isPointerType(varType) &&
llvm::is_contained(defaultMaps, DefMap::VariableCategory::Pointer))
- return defaultMaps[DefMap::VariableCategory::Pointer];
+ return defaultMaps.at(DefMap::VariableCategory::Pointer);
if (fir::isAllocatableType(varType) &&
llvm::is_contained(defaultMaps, DefMap::VariableCategory::Allocatable))
- return defaultMaps[DefMap::VariableCategory::Allocatable];
+ return defaultMaps.at(DefMap::VariableCategory::Allocatable);
if (fir::isa_aggregate(varType) &&
llvm::is_contained(defaultMaps, DefMap::VariableCategory::Aggregate))
- return defaultMaps[DefMap::VariableCategory::Aggregate];
+ return defaultMaps.at(DefMap::VariableCategory::Aggregate);
return DefMap::ImplicitBehavior::Default;
}
@@ -1018,7 +1018,7 @@ static std::pair<llvm::omp::OpenMPOffloadMappingFlags,
mlir::omp::VariableCaptureKind>
getImplicitMapTypeAndKind(fir::FirOpBuilder &firOpBuilder,
lower::AbstractConverter &converter,
- DefaultMapsTy &defaultMaps, mlir::Type varType,
+ const DefaultMapsTy &defaultMaps, mlir::Type varType,
mlir::Location loc, const semantics::Symbol &sym) {
using DefMap = clause::Defaultmap;
// Check if a value of type `type` can be passed to the kernel by value.
More information about the flang-commits
mailing list