[flang-commits] [flang] [flang] Change argument to const reference (PR #95048)

via flang-commits flang-commits at lists.llvm.org
Mon Jun 10 14:25:40 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-flang-semantics

Author: Peter Klausler (klausler)

<details>
<summary>Changes</summary>

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.

---
Full diff: https://github.com/llvm/llvm-project/pull/95048.diff


1 Files Affected:

- (modified) flang/lib/Semantics/scope.cpp (+1-1) 


``````````diff
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) {

``````````

</details>


https://github.com/llvm/llvm-project/pull/95048


More information about the flang-commits mailing list