source: Pass cm::string_view by value
diff --git a/Source/cmArgumentParser.cxx b/Source/cmArgumentParser.cxx
index 2ea2e6a..765e9cb 100644
--- a/Source/cmArgumentParser.cxx
+++ b/Source/cmArgumentParser.cxx
@@ -14,11 +14,9 @@
 auto KeywordActionMap::Emplace(cm::string_view name, KeywordAction action)
   -> std::pair<iterator, bool>
 {
-  auto const it =
-    std::lower_bound(this->begin(), this->end(), name,
-                     [](value_type const& elem, cm::string_view const& k) {
-                       return elem.first < k;
-                     });
+  auto const it = std::lower_bound(
+    this->begin(), this->end(), name,
+    [](value_type const& elem, cm::string_view k) { return elem.first < k; });
   return (it != this->end() && it->first == name)
     ? std::make_pair(it, false)
     : std::make_pair(this->emplace(it, name, std::move(action)), true);
@@ -26,11 +24,9 @@
 
 auto KeywordActionMap::Find(cm::string_view name) const -> const_iterator
 {
-  auto const it =
-    std::lower_bound(this->begin(), this->end(), name,
-                     [](value_type const& elem, cm::string_view const& k) {
-                       return elem.first < k;
-                     });
+  auto const it = std::lower_bound(
+    this->begin(), this->end(), name,
+    [](value_type const& elem, cm::string_view k) { return elem.first < k; });
   return (it != this->end() && it->first == name) ? it : this->end();
 }
 
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index 477453d..fdf0dbd 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -215,7 +215,7 @@
   cmGeneratorExpression::Split(exportDirs, entries);
   exportDirs.clear();
   char const* sep = "";
-  cm::string_view const& prefixWithSlash = this->GetImportPrefixWithSlash();
+  cm::string_view const prefixWithSlash = this->GetImportPrefixWithSlash();
   for (std::string const& e : entries) {
     exportDirs += sep;
     sep = ";";
diff --git a/Source/cmExportInstallFileGenerator.h b/Source/cmExportInstallFileGenerator.h
index 2df3264..85da195 100644
--- a/Source/cmExportInstallFileGenerator.h
+++ b/Source/cmExportInstallFileGenerator.h
@@ -75,7 +75,7 @@
 
   std::string GetInstallPrefix() const
   {
-    cm::string_view const& prefixWithSlash = this->GetImportPrefixWithSlash();
+    cm::string_view const prefixWithSlash = this->GetImportPrefixWithSlash();
     return std::string(prefixWithSlash.data(), prefixWithSlash.length() - 1);
   }
   virtual char GetConfigFileNameSeparator() const = 0;
diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx
index f35ee52..24a66c4 100644
--- a/Source/cmGeneratorExpression.cxx
+++ b/Source/cmGeneratorExpression.cxx
@@ -214,7 +214,7 @@
 }
 
 static void prefixItems(std::string const& content, std::string& result,
-                        cm::string_view const& prefix)
+                        cm::string_view prefix)
 {
   std::vector<std::string> entries;
   cmGeneratorExpression::Split(content, entries);
@@ -401,8 +401,7 @@
   return extractAllGeneratorExpressions(input, &collected);
 }
 
-cm::string_view::size_type cmGeneratorExpression::Find(
-  cm::string_view const& input)
+cm::string_view::size_type cmGeneratorExpression::Find(cm::string_view input)
 {
   cm::string_view::size_type const openpos = input.find("$<");
   if (openpos != cm::string_view::npos &&
diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h
index e5269b1..bda35f4 100644
--- a/Source/cmGeneratorExpression.h
+++ b/Source/cmGeneratorExpression.h
@@ -70,7 +70,7 @@
   static void Split(std::string const& input,
                     std::vector<std::string>& output);
 
-  static cm::string_view::size_type Find(cm::string_view const& input);
+  static cm::string_view::size_type Find(cm::string_view input);
 
   static bool IsValidTargetName(std::string const& input);
 
diff --git a/Source/cmInstallGetRuntimeDependenciesGenerator.cxx b/Source/cmInstallGetRuntimeDependenciesGenerator.cxx
index 9e1ecc1..0ba9f14 100644
--- a/Source/cmInstallGetRuntimeDependenciesGenerator.cxx
+++ b/Source/cmInstallGetRuntimeDependenciesGenerator.cxx
@@ -24,7 +24,7 @@
 
 namespace {
 template <typename T, typename F>
-void WriteMultiArgument(std::ostream& os, cm::string_view const& keyword,
+void WriteMultiArgument(std::ostream& os, cm::string_view keyword,
                         std::vector<T> const& list,
                         cmScriptGeneratorIndent indent, F transform)
 {
@@ -42,7 +42,7 @@
 }
 
 void WriteFilesArgument(
-  std::ostream& os, cm::string_view const& keyword,
+  std::ostream& os, cm::string_view keyword,
   std::vector<std::unique_ptr<cmInstallRuntimeDependencySet::Item>> const&
     items,
   std::string const& config, cmScriptGeneratorIndent indent)
@@ -53,8 +53,7 @@
       -> std::string { return cmStrCat('"', i->GetItemPath(config), '"'); });
 }
 
-void WriteGenexEvaluatorArgument(std::ostream& os,
-                                 cm::string_view const& keyword,
+void WriteGenexEvaluatorArgument(std::ostream& os, cm::string_view keyword,
                                  std::vector<std::string> const& genexes,
                                  std::string const& config,
                                  cmLocalGenerator* lg,
diff --git a/Source/cmJSONHelpers.h b/Source/cmJSONHelpers.h
index a5f71dd..ab96c64 100644
--- a/Source/cmJSONHelpers.h
+++ b/Source/cmJSONHelpers.h
@@ -96,7 +96,7 @@
     }
 
     template <typename U, typename M, typename F>
-    Object& Bind(cm::string_view const& name, M U::*member, F func,
+    Object& Bind(cm::string_view name, M U::*member, F func,
                  bool required = true)
     {
       return this->BindPrivate(
@@ -106,7 +106,7 @@
         required);
     }
     template <typename M, typename F>
-    Object& Bind(cm::string_view const& name, std::nullptr_t, F func,
+    Object& Bind(cm::string_view name, std::nullptr_t, F func,
                  bool required = true)
     {
       return this->BindPrivate(
@@ -119,7 +119,7 @@
         required);
     }
     template <typename F>
-    Object& Bind(cm::string_view const& name, F func, bool required = true)
+    Object& Bind(cm::string_view name, F func, bool required = true)
     {
       return this->BindPrivate(name, MemberFunction(func), required);
     }
@@ -197,7 +197,7 @@
     JsonErrors::ObjectErrorGenerator Error;
     bool AllowExtra;
 
-    Object& BindPrivate(cm::string_view const& name, MemberFunction&& func,
+    Object& BindPrivate(cm::string_view name, MemberFunction&& func,
                         bool required)
     {
       this->Members.emplace_back(name, std::move(func), required);
diff --git a/Source/cmPackageInfoReader.cxx b/Source/cmPackageInfoReader.cxx
index abf5e69..0def09d 100644
--- a/Source/cmPackageInfoReader.cxx
+++ b/Source/cmPackageInfoReader.cxx
@@ -719,7 +719,7 @@
   Json::Value const& components = this->Data["components"];
 
   for (auto ci = components.begin(), ce = components.end(); ci != ce; ++ci) {
-    cm::string_view const& name = IterKey(ci);
+    cm::string_view const name = IterKey(ci);
     std::string const& type =
       cmSystemTools::LowerCase((*ci)["type"].asString());
 
@@ -798,7 +798,7 @@
 
   for (auto ci = components.begin(), ce = components.end(); ci != ce; ++ci) {
     // Get component name and look up target.
-    cm::string_view const& name = IterKey(ci);
+    cm::string_view const name = IterKey(ci);
     auto const& ti = this->ComponentTargets.find(std::string{ name });
     if (ti == this->ComponentTargets.end()) {
       status.SetError(cmStrCat("component "_s, name, " was not found"_s));
diff --git a/Source/cmString.hxx b/Source/cmString.hxx
index 3c2b49b..c346230 100644
--- a/Source/cmString.hxx
+++ b/Source/cmString.hxx
@@ -87,7 +87,7 @@
 template <>
 struct IntoString<char> : std::true_type
 {
-  static std::string into_string(char const& c) { return std::string(1, c); }
+  static std::string into_string(char c) { return std::string(1, c); }
 };
 
 /**
@@ -142,19 +142,27 @@
 template <>
 struct AsStringView<char> : std::true_type
 {
-  static string_view view(char const& s) { return string_view(&s, 1); }
+  static string_view view(
+    char const& s) // clazy:exclude=function-args-by-value
+  {
+    return string_view(&s, 1);
+  }
 };
 
 template <>
 struct AsStringView<string_view> : std::true_type
 {
-  static string_view view(string_view const& s) { return s; }
+  static string_view view(string_view s) { return s; }
 };
 
 template <>
 struct AsStringView<static_string_view> : std::true_type
 {
-  static string_view view(static_string_view const& s) { return s; }
+  static string_view view(
+    static_string_view const& s) // clazy:exclude=function-args-by-value
+  {
+    return s;
+  }
 };
 
 template <>
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index cd7fa08..1f16f14 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -3296,8 +3296,8 @@
   return false;
 }
 
-static std::string::size_type cmSystemToolsFindRPath(
-  cm::string_view const& have, cm::string_view const& want)
+static std::string::size_type cmSystemToolsFindRPath(cm::string_view have,
+                                                     cm::string_view want)
 {
   std::string::size_type pos = 0;
   while (pos < have.size()) {