Skip to content
Snippets Groups Projects
Commit b19e1db9 authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

clang-tidy fix Param

parent 43cc8d0b
No related branches found
No related tags found
1 merge request!458Automatic modernization (clang-tidy --fix)
Showing
with 32 additions and 37 deletions
...@@ -95,6 +95,7 @@ Checks: ' ...@@ -95,6 +95,7 @@ Checks: '
-*narrowing-conversions, -*narrowing-conversions,
-cppcoreguidelines-owning-memory, -cppcoreguidelines-owning-memory,
-bugprone-unused-return-value, -bugprone-unused-return-value,
-bugprone-parent-virtual-call,
-SectionComment_Temporarily_disabled_checks__To_be_resolved_soon, -SectionComment_Temporarily_disabled_checks__To_be_resolved_soon,
...@@ -104,7 +105,6 @@ Checks: ' ...@@ -104,7 +105,6 @@ Checks: '
*-use-equals-default, *-use-equals-default,
*-use-nullptr, *-use-nullptr,
*-use-override, *-use-override,
-bugprone-parent-virtual-call,
clang-analyzer-core.CallAndMessage, clang-analyzer-core.CallAndMessage,
clang-analyzer-optin.cplusplus.VirtualCall, clang-analyzer-optin.cplusplus.VirtualCall,
cppcoreguidelines-explicit-virtual-functions, cppcoreguidelines-explicit-virtual-functions,
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include "Base/Vector/Vectors3D.h" #include "Base/Vector/Vectors3D.h"
struct Bin1D { struct Bin1D {
Bin1D() = default; Bin1D() = default;
Bin1D(double lower, double upper) : m_lower(lower), m_upper(upper) {} Bin1D(double lower, double upper) : m_lower(lower), m_upper(upper) {}
double m_lower{0}; //!< lower bound of the bin double m_lower{0}; //!< lower bound of the bin
double m_upper{0}; //!< upper bound of the bin double m_upper{0}; //!< upper bound of the bin
...@@ -33,7 +33,7 @@ bool BinContains(const Bin1D& bin, double value); ...@@ -33,7 +33,7 @@ bool BinContains(const Bin1D& bin, double value);
//! An one-dimensional range of R3's. //! An one-dimensional range of R3's.
struct Bin1DKVector { struct Bin1DKVector {
Bin1DKVector() = default; Bin1DKVector() = default;
Bin1DKVector(const R3 lower, const R3 upper) : m_q_lower(lower), m_q_upper(upper) {} Bin1DKVector(const R3 lower, const R3 upper) : m_q_lower(lower), m_q_upper(upper) {}
Bin1DKVector(double wavelength, const Bin1D& alpha_bin, const Bin1D& phi_bin); Bin1DKVector(double wavelength, const Bin1D& alpha_bin, const Bin1D& phi_bin);
...@@ -47,7 +47,7 @@ struct Bin1DKVector { ...@@ -47,7 +47,7 @@ struct Bin1DKVector {
class Bin1DCVector { class Bin1DCVector {
public: public:
Bin1DCVector() = default; Bin1DCVector() = default;
Bin1DCVector(C3 lower, C3 upper) : m_q_lower(lower), m_q_upper(upper) {} Bin1DCVector(C3 lower, C3 upper) : m_q_lower(lower), m_q_upper(upper) {}
Bin1DCVector(double wavelength, const Bin1D& alpha_bin, const Bin1D& phi_bin); Bin1DCVector(double wavelength, const Bin1D& alpha_bin, const Bin1D& phi_bin);
C3 center() const { return (m_q_lower + m_q_upper) / 2.0; } C3 center() const { return (m_q_lower + m_q_upper) / 2.0; }
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
class IAxis { class IAxis {
public: public:
explicit IAxis(std::string name) : m_name(std::move(name)) {} explicit IAxis(std::string name) : m_name(std::move(name)) {}
IAxis(const IAxis&) = delete; IAxis(const IAxis&) = delete;
virtual ~IAxis() = default; virtual ~IAxis() = default;
......
...@@ -78,8 +78,7 @@ size_t VariableBinAxis::findClosestIndex(double value) const ...@@ -78,8 +78,7 @@ size_t VariableBinAxis::findClosestIndex(double value) const
if (value >= upperBound()) if (value >= upperBound())
return m_nbins - 1; return m_nbins - 1;
auto top_limit = auto top_limit = std::lower_bound(m_bin_boundaries.begin(), m_bin_boundaries.end(), value);
std::lower_bound(m_bin_boundaries.begin(), m_bin_boundaries.end(), value);
if (*top_limit != value) if (*top_limit != value)
--top_limit; --top_limit;
size_t nbin = top_limit - m_bin_boundaries.begin(); size_t nbin = top_limit - m_bin_boundaries.begin();
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
class IElement { class IElement {
public: public:
explicit IElement(PolMatrices polpair) : m_polpair(std::move(polpair)) {} explicit IElement(PolMatrices polpair) : m_polpair(std::move(polpair)) {}
protected: protected:
const PolMatrices m_polpair; const PolMatrices m_polpair;
......
...@@ -23,7 +23,7 @@ PolMatrices::PolMatrices() ...@@ -23,7 +23,7 @@ PolMatrices::PolMatrices()
{ {
} }
PolMatrices::PolMatrices(Eigen::Matrix2cd polarization, Eigen::Matrix2cd analyzer) PolMatrices::PolMatrices(Eigen::Matrix2cd polarization, Eigen::Matrix2cd analyzer)
: m_polarizer_matrix(std::move(polarization)), m_analyzer_matrix(std::move(analyzer)) : m_polarizer_matrix(std::move(polarization)), m_analyzer_matrix(std::move(analyzer))
{ {
} }
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
class PolMatrices { class PolMatrices {
public: public:
PolMatrices(); PolMatrices();
PolMatrices(Eigen::Matrix2cd polarization, Eigen::Matrix2cd analyzer); PolMatrices(Eigen::Matrix2cd polarization, Eigen::Matrix2cd analyzer);
//! Sets the polarization density matrix (in spin basis along z-axis) //! Sets the polarization density matrix (in spin basis along z-axis)
void setPolarizerMatrix(const Eigen::Matrix2cd& polarization) void setPolarizerMatrix(const Eigen::Matrix2cd& polarization)
......
...@@ -65,8 +65,7 @@ void FourierTransform::fft(const double2d_t& source, double2d_t& result) ...@@ -65,8 +65,7 @@ void FourierTransform::fft(const double2d_t& source, double2d_t& result)
const size_t nh = ws.h_fftw; const size_t nh = ws.h_fftw;
// Resize the array for holding the FT output to correct dimensions // Resize the array for holding the FT output to correct dimensions
result.resize(nh, result.resize(nh, std::vector<double>(static_cast<size_t>(ws.w_fftw)));
std::vector<double>(static_cast<size_t>(ws.w_fftw)));
// Storing FT output // Storing FT output
for (size_t i = 0; i < nh; i++) { for (size_t i = 0; i < nh; i++) {
......
...@@ -35,10 +35,7 @@ class ProgressHandler { ...@@ -35,10 +35,7 @@ class ProgressHandler {
public: public:
using Callback_t = std::function<bool(size_t)>; using Callback_t = std::function<bool(size_t)>;
ProgressHandler() ProgressHandler() : m_inform(nullptr) {}
: m_inform(nullptr)
{
}
ProgressHandler(const ProgressHandler& other) ProgressHandler(const ProgressHandler& other)
: m_inform(other.m_inform) // not clear whether we want multiple copies of this : m_inform(other.m_inform) // not clear whether we want multiple copies of this
, m_expected_nticks(other.m_expected_nticks) , m_expected_nticks(other.m_expected_nticks)
......
...@@ -29,15 +29,15 @@ ...@@ -29,15 +29,15 @@
template <class T> class SafePointerVector { template <class T> class SafePointerVector {
public: public:
using iterator = typename std::vector<T *>::iterator; using iterator = typename std::vector<T*>::iterator;
using const_iterator = typename std::vector<T *>::const_iterator; using const_iterator = typename std::vector<T*>::const_iterator;
SafePointerVector() = default; SafePointerVector() = default;
SafePointerVector(const SafePointerVector& other); SafePointerVector(const SafePointerVector& other);
SafePointerVector(SafePointerVector&& other) noexcept ; SafePointerVector(SafePointerVector&& other) noexcept;
~SafePointerVector() { clear(); } ~SafePointerVector() { clear(); }
SafePointerVector& operator=(const SafePointerVector& right); SafePointerVector& operator=(const SafePointerVector& right);
SafePointerVector& operator=(SafePointerVector&& right) noexcept ; SafePointerVector& operator=(SafePointerVector&& right) noexcept;
size_t size() const { return m_pointers.size(); } size_t size() const { return m_pointers.size(); }
bool empty() const { return m_pointers.empty(); } bool empty() const { return m_pointers.empty(); }
void push_back(T* pointer) { m_pointers.push_back(pointer); } void push_back(T* pointer) { m_pointers.push_back(pointer); }
...@@ -63,8 +63,8 @@ template <class T> SafePointerVector<T>::SafePointerVector(const SafePointerVect ...@@ -63,8 +63,8 @@ template <class T> SafePointerVector<T>::SafePointerVector(const SafePointerVect
} }
template <class T> template <class T>
SafePointerVector<T>::SafePointerVector(SafePointerVector<T>&& other) SafePointerVector<T>::SafePointerVector(SafePointerVector<T>&& other) noexcept
noexcept : m_pointers(std::move(other.m_pointers)) : m_pointers(std::move(other.m_pointers))
{ {
} }
...@@ -80,8 +80,8 @@ SafePointerVector<T>& SafePointerVector<T>::operator=(const SafePointerVector<T> ...@@ -80,8 +80,8 @@ SafePointerVector<T>& SafePointerVector<T>::operator=(const SafePointerVector<T>
} }
template <class T> template <class T>
SafePointerVector<T>& SafePointerVector<T>::operator=(SafePointerVector<T>&& right) SafePointerVector<T>& SafePointerVector<T>::operator=(SafePointerVector<T>&& right) noexcept
noexcept { {
clear(); clear();
m_pointers = std::move(right.m_pointers); m_pointers = std::move(right.m_pointers);
right.m_pointers.clear(); right.m_pointers.clear();
......
...@@ -25,6 +25,6 @@ struct ThreadInfo { ...@@ -25,6 +25,6 @@ struct ThreadInfo {
unsigned current_batch{0}; unsigned current_batch{0};
}; };
inline ThreadInfo::ThreadInfo() = default; inline ThreadInfo::ThreadInfo() = default;
#endif // BORNAGAIN_BASE_UTIL_THREADINFO_H #endif // BORNAGAIN_BASE_UTIL_THREADINFO_H
...@@ -22,7 +22,7 @@ Transform3D::Transform3D() ...@@ -22,7 +22,7 @@ Transform3D::Transform3D()
m_inverse_matrix.setIdentity(); m_inverse_matrix.setIdentity();
} }
Transform3D::Transform3D(Eigen::Matrix3d matrix) : m_matrix(std::move(matrix)) Transform3D::Transform3D(Eigen::Matrix3d matrix) : m_matrix(std::move(matrix))
{ {
m_inverse_matrix = m_matrix.inverse(); m_inverse_matrix = m_matrix.inverse();
} }
......
...@@ -31,7 +31,7 @@ public: ...@@ -31,7 +31,7 @@ public:
#ifndef SWIG #ifndef SWIG
//! Constructor from matrix (no checks if this is an element of SO(3)!) //! Constructor from matrix (no checks if this is an element of SO(3)!)
explicit Transform3D(Eigen::Matrix3d matrix); explicit Transform3D(Eigen::Matrix3d matrix);
#endif #endif
//! Destructor //! Destructor
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
using namespace mumufit; using namespace mumufit;
MinimizerAdapter::MinimizerAdapter(MinimizerInfo minimizerInfo) MinimizerAdapter::MinimizerAdapter(MinimizerInfo minimizerInfo)
: m_minimizerInfo(std::move(minimizerInfo)) : m_minimizerInfo(std::move(minimizerInfo))
, m_adapter(new mumufit::ObjectiveFunctionAdapter) , m_adapter(new mumufit::ObjectiveFunctionAdapter)
, m_status(false) , m_status(false)
......
...@@ -76,7 +76,7 @@ public: ...@@ -76,7 +76,7 @@ public:
void setOptions(const std::string& optionString) override; void setOptions(const std::string& optionString) override;
protected: protected:
explicit MinimizerAdapter(MinimizerInfo minimizerInfo); explicit MinimizerAdapter(MinimizerInfo minimizerInfo);
mumufit::MinimizerResult minimize(mumufit::Parameters parameters); mumufit::MinimizerResult minimize(mumufit::Parameters parameters);
......
...@@ -28,7 +28,7 @@ const RootScalarFunction* ...@@ -28,7 +28,7 @@ const RootScalarFunction*
ObjectiveFunctionAdapter::rootObjectiveFunction(fcn_scalar_t fcn, const Parameters& parameters) ObjectiveFunctionAdapter::rootObjectiveFunction(fcn_scalar_t fcn, const Parameters& parameters)
{ {
std::unique_ptr<ScalarFunctionAdapter> tem_adapter(new ScalarFunctionAdapter(fcn, parameters)); std::unique_ptr<ScalarFunctionAdapter> tem_adapter(new ScalarFunctionAdapter(fcn, parameters));
const auto *result = tem_adapter->rootObjectiveFunction(); const auto* result = tem_adapter->rootObjectiveFunction();
m_adapter = std::move(tem_adapter); m_adapter = std::move(tem_adapter);
return result; return result;
} }
...@@ -38,7 +38,7 @@ ObjectiveFunctionAdapter::rootResidualFunction(fcn_residual_t fcn, const Paramet ...@@ -38,7 +38,7 @@ ObjectiveFunctionAdapter::rootResidualFunction(fcn_residual_t fcn, const Paramet
{ {
std::unique_ptr<ResidualFunctionAdapter> tem_adapter( std::unique_ptr<ResidualFunctionAdapter> tem_adapter(
new ResidualFunctionAdapter(fcn, parameters)); new ResidualFunctionAdapter(fcn, parameters));
const auto *result = tem_adapter->rootResidualFunction(); const auto* result = tem_adapter->rootResidualFunction();
m_adapter = std::move(tem_adapter); m_adapter = std::move(tem_adapter);
return result; return result;
} }
......
...@@ -44,8 +44,8 @@ const RootResidualFunction* ResidualFunctionAdapter::rootResidualFunction() ...@@ -44,8 +44,8 @@ const RootResidualFunction* ResidualFunctionAdapter::rootResidualFunction()
scalar_function_t objective_fun = [&](const std::vector<double>& pars) { return chi2(pars); }; scalar_function_t objective_fun = [&](const std::vector<double>& pars) { return chi2(pars); };
m_root_objective = std::make_unique<RootResidualFunction>( m_root_objective = std::make_unique<RootResidualFunction>(objective_fun, gradient_fun,
objective_fun, gradient_fun, m_parameters.size(), m_datasize); m_parameters.size(), m_datasize);
return m_root_objective.get(); return m_root_objective.get();
} }
......
...@@ -14,12 +14,12 @@ ...@@ -14,12 +14,12 @@
#include "Fit/Adapter/ScalarFunctionAdapter.h" #include "Fit/Adapter/ScalarFunctionAdapter.h"
#include <utility>
#include "Fit/Adapter/RootScalarFunction.h" #include "Fit/Adapter/RootScalarFunction.h"
#include <utility>
using namespace mumufit; using namespace mumufit;
ScalarFunctionAdapter::ScalarFunctionAdapter(fcn_scalar_t func, Parameters parameters) ScalarFunctionAdapter::ScalarFunctionAdapter(fcn_scalar_t func, Parameters parameters)
: m_fcn(std::move(func)), m_parameters(std::move(parameters)) : m_fcn(std::move(func)), m_parameters(std::move(parameters))
{ {
} }
......
...@@ -39,7 +39,7 @@ namespace mumufit { ...@@ -39,7 +39,7 @@ namespace mumufit {
class ScalarFunctionAdapter : public IFunctionAdapter { class ScalarFunctionAdapter : public IFunctionAdapter {
public: public:
ScalarFunctionAdapter(fcn_scalar_t func, Parameters parameters); ScalarFunctionAdapter(fcn_scalar_t func, Parameters parameters);
const RootScalarFunction* rootObjectiveFunction(); const RootScalarFunction* rootObjectiveFunction();
......
...@@ -112,7 +112,7 @@ std::string MinimizerFactory::catalogDetailsToString() ...@@ -112,7 +112,7 @@ std::string MinimizerFactory::catalogDetailsToString()
// list of minimizer options // list of minimizer options
std::unique_ptr<IMinimizer> minimizer(createMinimizer(minimizerName)); std::unique_ptr<IMinimizer> minimizer(createMinimizer(minimizerName));
if (auto *rootMinimizer = dynamic_cast<MinimizerAdapter*>(minimizer.get())) { if (auto* rootMinimizer = dynamic_cast<MinimizerAdapter*>(minimizer.get())) {
result << "\nOptions\n"; result << "\nOptions\n";
for (const auto& option : rootMinimizer->options()) { for (const auto& option : rootMinimizer->options()) {
std::ostringstream opt; std::ostringstream opt;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment