[flang-commits] [flang] [flang] Change argument to const reference (PR #95048)
Peter Klausler via flang-commits
flang-commits at lists.llvm.org
Mon Jun 10 14:25:10 PDT 2024
https://github.com/klausler created https://github.com/llvm/llvm-project/pull/95048
cppcheck recommends that a std::map being passed by value be changed to a const reference.
Fixes https://github.com/llvm/llvm-project/issues/94932.
>From df27dba5f5ccef34136a57b211c7efc6ba6d6843 Mon Sep 17 00:00:00 2001
From: Peter Klausler <pklausler at nvidia.com>
Date: Mon, 10 Jun 2024 14:23:01 -0700
Subject: [PATCH] [flang] Change argument to const reference
cppcheck recommends that a std::map being passed by value be
changed to a const reference.
Fixes https://github.com/llvm/llvm-project/issues/94932.
---
flang/lib/Semantics/scope.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/flang/lib/Semantics/scope.cpp b/flang/lib/Semantics/scope.cpp
index a860040f7378c..89128e4a5049b 100644
--- a/flang/lib/Semantics/scope.cpp
+++ b/flang/lib/Semantics/scope.cpp
@@ -56,7 +56,7 @@ Scope &Scope::MakeScope(Kind kind, Symbol *symbol) {
template <typename T>
static std::vector<common::Reference<T>> GetSortedSymbols(
- std::map<SourceName, MutableSymbolRef> symbols) {
+ const std::map<SourceName, MutableSymbolRef> &symbols) {
std::vector<common::Reference<T>> result;
result.reserve(symbols.size());
for (auto &pair : symbols) {
More information about the flang-commits
mailing list