From: Daniel Arndt <arndtd@ornl.gov>
Date: Thu, 26 Sep 2019 18:07:49 +0000 (+0000)
Subject: Fix some clang-tidy 9 findings
X-Git-Tag: v9.2.0-rc1~1007^2
X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=257cefa90ee3e4f5f2570292bb3665a3ca993bc5;p=dealii.git

Fix some clang-tidy 9 findings
---

diff --git a/examples/step-63/step-63.cc b/examples/step-63/step-63.cc
index 35e08044dc..a3437c7553 100644
--- a/examples/step-63/step-63.cc
+++ b/examples/step-63/step-63.cc
@@ -488,7 +488,7 @@ namespace Step63
   class AdvectionProblem
   {
   public:
-    AdvectionProblem(Settings settings);
+    AdvectionProblem(const Settings &settings);
     void run();
 
   private:
@@ -548,7 +548,7 @@ namespace Step63
 
 
   template <int dim>
-  AdvectionProblem<dim>::AdvectionProblem(Settings settings)
+  AdvectionProblem<dim>::AdvectionProblem(const Settings &settings)
     : triangulation(Triangulation<dim>::limit_level_difference_at_vertices)
     , dof_handler(triangulation)
     , fe(settings.fe_degree)
diff --git a/include/deal.II/algorithms/general_data_storage.h b/include/deal.II/algorithms/general_data_storage.h
index 6e58609b5d..b9040e3e21 100644
--- a/include/deal.II/algorithms/general_data_storage.h
+++ b/include/deal.II/algorithms/general_data_storage.h
@@ -351,7 +351,7 @@ template <class Stream>
 void
 GeneralDataStorage::print_info(Stream &os)
 {
-  for (auto it : any_data)
+  for (const auto &it : any_data)
     {
       os << it.first << '\t' << '\t'
          << boost::core::demangle(it.second.type().name()) << std::endl;
diff --git a/include/deal.II/base/parameter_acceptor.h b/include/deal.II/base/parameter_acceptor.h
index 71546e0689..e0467454cb 100644
--- a/include/deal.II/base/parameter_acceptor.h
+++ b/include/deal.II/base/parameter_acceptor.h
@@ -603,7 +603,7 @@ public:
    * are passed to the SourceClass constructor.
    */
   template <typename... Args>
-  ParameterAcceptorProxy(const std::string section_name, Args... args);
+  ParameterAcceptorProxy(const std::string &section_name, Args... args);
 
   /**
    * Overloads the ParameterAcceptor::declare_parameters function, by calling
@@ -641,7 +641,7 @@ ParameterAcceptor::add_parameter(const std::string &          entry,
 template <class SourceClass>
 template <typename... Args>
 ParameterAcceptorProxy<SourceClass>::ParameterAcceptorProxy(
-  const std::string section_name,
+  const std::string &section_name,
   Args... args)
   : SourceClass(args...)
   , ParameterAcceptor(section_name)
diff --git a/include/deal.II/lac/la_parallel_vector.templates.h b/include/deal.II/lac/la_parallel_vector.templates.h
index 558436628d..04c43ee38c 100644
--- a/include/deal.II/lac/la_parallel_vector.templates.h
+++ b/include/deal.II/lac/la_parallel_vector.templates.h
@@ -152,13 +152,15 @@ namespace LinearAlgebra
         }
 
         static void
-        import(const ::dealii::LinearAlgebra::ReadWriteVector<Number> &V,
-               ::dealii::VectorOperation::values operation,
-               std::shared_ptr<const ::dealii::Utilities::MPI::Partitioner>
-                               communication_pattern,
-               const IndexSet &locally_owned_elem,
-               ::dealii::MemorySpace::
-                 MemorySpaceData<Number, ::dealii::MemorySpace::Host> &data)
+        import(
+          const ::dealii::LinearAlgebra::ReadWriteVector<Number> &V,
+          ::dealii::VectorOperation::values                       operation,
+          const std::shared_ptr<const ::dealii::Utilities::MPI::Partitioner>
+            &             communication_pattern,
+          const IndexSet &locally_owned_elem,
+          ::dealii::MemorySpace::MemorySpaceData<Number,
+                                                 ::dealii::MemorySpace::Host>
+            &data)
         {
           Assert(
             (operation == ::dealii::VectorOperation::add) ||
diff --git a/source/base/patterns.cc b/source/base/patterns.cc
index 9dba7f3a5f..37edd78b98 100644
--- a/source/base/patterns.cc
+++ b/source/base/patterns.cc
@@ -1278,17 +1278,14 @@ namespace Patterns
 
 
     // check the different possibilities
-    for (std::vector<std::string>::const_iterator test_string =
-           split_names.begin();
-         test_string != split_names.end();
-         ++test_string)
+    for (const auto &test_string : split_names)
       {
         bool string_found = false;
 
         tmp = sequence;
         while (tmp.find('|') != std::string::npos)
           {
-            if (*test_string == std::string(tmp, 0, tmp.find('|')))
+            if (test_string == std::string(tmp, 0, tmp.find('|')))
               {
                 // string found, quit
                 // loop. don't change
@@ -1302,7 +1299,7 @@ namespace Patterns
           }
         // check last choice, not finished by |
         if (!string_found)
-          if (*test_string == tmp)
+          if (test_string == tmp)
             string_found = true;
 
         if (!string_found)
diff --git a/source/dofs/dof_tools_constraints.cc b/source/dofs/dof_tools_constraints.cc
index 55de132df6..6420085e64 100644
--- a/source/dofs/dof_tools_constraints.cc
+++ b/source/dofs/dof_tools_constraints.cc
@@ -289,11 +289,8 @@ namespace DoFTools
 
         // finally copy the list into the mask
         std::fill(master_dof_mask.begin(), master_dof_mask.end(), false);
-        for (std::vector<types::global_dof_index>::const_iterator i =
-               master_dof_list.begin();
-             i != master_dof_list.end();
-             ++i)
-          master_dof_mask[*i] = true;
+        for (const auto dof : master_dof_list)
+          master_dof_mask[dof] = true;
       }
 
 
diff --git a/source/lac/dynamic_sparsity_pattern.cc b/source/lac/dynamic_sparsity_pattern.cc
index dc28f418bb..ecc7b62f0e 100644
--- a/source/lac/dynamic_sparsity_pattern.cc
+++ b/source/lac/dynamic_sparsity_pattern.cc
@@ -387,30 +387,23 @@ DynamicSparsityPattern::symmetrize()
 {
   Assert(rows == cols, ExcNotQuadratic());
 
-  // loop over all elements presently
-  // in the sparsity pattern and add
-  // the transpose element. note:
+  // loop over all elements presently in the sparsity pattern and add the
+  // transpose element. note:
   //
-  // 1. that the sparsity pattern
-  // changes which we work on, but
-  // not the present row
+  // 1. that the sparsity pattern changes which we work on, but not the present
+  // row
   //
-  // 2. that the @p{add} function can
-  // be called on elements that
-  // already exist without any harm
+  // 2. that the @p{add} function can be called on elements that already exist
+  // without any harm
   for (size_type row = 0; row < lines.size(); ++row)
     {
       const size_type rowindex =
         rowset.size() == 0 ? row : rowset.nth_index_in_set(row);
 
-      for (std::vector<size_type>::const_iterator j =
-             lines[row].entries.begin();
-           j != lines[row].entries.end();
-           ++j)
-        // add the transpose entry if
-        // this is not the diagonal
-        if (rowindex != *j)
-          add(*j, rowindex);
+      for (const size_type row_entry : lines[row].entries)
+        // add the transpose entry if this is not the diagonal
+        if (rowindex != row_entry)
+          add(row_entry, rowindex);
     }
 }