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

via flang-commits flang-commits at lists.llvm.org
Tue Jun 11 17:15:30 PDT 2024


Author: Peter Klausler
Date: 2024-06-11T17:15:27-07:00
New Revision: 9d9a85e1af84501d365241f8e045aef7f2f7ee60

URL: https://github.com/llvm/llvm-project/commit/9d9a85e1af84501d365241f8e045aef7f2f7ee60
DIFF: https://github.com/llvm/llvm-project/commit/9d9a85e1af84501d365241f8e045aef7f2f7ee60.diff

LOG: [flang] Change argument to const reference (#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.

Added: 
    

Modified: 
    flang/lib/Semantics/scope.cpp

Removed: 
    


################################################################################
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