summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2019-03-20 21:20:04 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2019-03-20 21:20:04 +0000
commitaad33c74a0cf3aeae8625bda785e912d64172fb3 (patch)
tree5d2d34d4f050dd545258c2eb5c3b2410f3531cc2
parentEnable clang tidy performance and fixes (diff)
downloadicetray-aad33c74a0cf3aeae8625bda785e912d64172fb3.tar.bz2
icetray-aad33c74a0cf3aeae8625bda785e912d64172fb3.tar.xz
icetray-aad33c74a0cf3aeae8625bda785e912d64172fb3.zip
Enable clang tidy modernize and fixes
-rw-r--r--Jamroot.jam2
-rw-r--r--icetray/dryice/dryice.cpp4
-rw-r--r--icetray/dryice/mockPool.cpp4
-rw-r--r--icetray/dryice/mockPool.h2
-rw-r--r--icetray/icetray/abstractDatabaseClient.cpp4
-rw-r--r--icetray/icetray/abstractDatabaseClient.h2
-rw-r--r--icetray/icetray/logger.cpp8
-rw-r--r--icetray/icetray/logger.h2
-rw-r--r--icetray/icetray/options.cpp4
-rw-r--r--icetray/icetray/options.h2
-rw-r--r--icetray/icetray/staticSqlSource.cpp8
-rw-r--r--icetray/icetray/staticSqlSource.h4
-rw-r--r--icetray/unittests/testIceBoxInterface.cpp4
-rw-r--r--icetray/unittests/testIceTrayLogger.cpp2
-rw-r--r--icetray/unittests/testOptions.cpp5
15 files changed, 28 insertions, 29 deletions
diff --git a/Jamroot.jam b/Jamroot.jam
index 6201edb..31d72ec 100644
--- a/Jamroot.jam
+++ b/Jamroot.jam
@@ -19,7 +19,7 @@ project
<toolset>tidy:<checkxx>bugprone-*
<toolset>tidy:<checkxx>clang-*
<toolset>tidy:<checkxx>misc-*
-#<toolset>tidy:<checkxx>modernize-*
+ <toolset>tidy:<checkxx>modernize-*
<toolset>tidy:<checkxx>hicpp-*
<toolset>tidy:<checkxx>performance-*
;
diff --git a/icetray/dryice/dryice.cpp b/icetray/dryice/dryice.cpp
index 4021b9b..90ec225 100644
--- a/icetray/dryice/dryice.cpp
+++ b/icetray/dryice/dryice.cpp
@@ -29,11 +29,11 @@ namespace IceTray {
currentDryIce = nullptr;
if (s) {
s->stop();
- s = NULL;
+ s = nullptr;
}
if (ic) {
ic->destroy();
- ic = NULL;
+ ic = nullptr;
}
}
diff --git a/icetray/dryice/mockPool.cpp b/icetray/dryice/mockPool.cpp
index 11ccb75..2a477aa 100644
--- a/icetray/dryice/mockPool.cpp
+++ b/icetray/dryice/mockPool.cpp
@@ -10,9 +10,9 @@ namespace IceTray {
{
}
- MockPool::MockPool(const std::string & name, int size, int keep) :
+ MockPool::MockPool(std::string name, int size, int keep) :
DB::BasicConnectionPool(size, keep),
- name(name)
+ name(std::move(name))
{
}
diff --git a/icetray/dryice/mockPool.h b/icetray/dryice/mockPool.h
index 1a7820e..f77d449 100644
--- a/icetray/dryice/mockPool.h
+++ b/icetray/dryice/mockPool.h
@@ -9,7 +9,7 @@ namespace IceTray {
class DLL_PUBLIC MockPool : public DB::BasicConnectionPool {
public:
MockPool(const std::string & name, const std::string &, const Ice::PropertiesPtr & p);
- MockPool(const std::string & name, int size, int keep);
+ MockPool(std::string name, int size, int keep);
DB::ConnectionPtr createResource() const override;
diff --git a/icetray/icetray/abstractDatabaseClient.cpp b/icetray/icetray/abstractDatabaseClient.cpp
index 3e16ba7..1c4f566 100644
--- a/icetray/icetray/abstractDatabaseClient.cpp
+++ b/icetray/icetray/abstractDatabaseClient.cpp
@@ -3,8 +3,8 @@
#include "IceUtil/Optional.h"
namespace IceTray {
- AbstractDatabaseClient::AbstractDatabaseClient(const DB::ConnectionPoolPtr & d) :
- db(d)
+ AbstractDatabaseClient::AbstractDatabaseClient(DB::ConnectionPoolPtr d) :
+ db(std::move(d))
{
}
}
diff --git a/icetray/icetray/abstractDatabaseClient.h b/icetray/icetray/abstractDatabaseClient.h
index 81eb4bc..311805c 100644
--- a/icetray/icetray/abstractDatabaseClient.h
+++ b/icetray/icetray/abstractDatabaseClient.h
@@ -11,7 +11,7 @@
namespace IceTray {
class DLL_PUBLIC AbstractDatabaseClient {
protected:
- AbstractDatabaseClient(const DB::ConnectionPoolPtr & d);
+ AbstractDatabaseClient(DB::ConnectionPoolPtr d);
template<typename Domain, typename ... Params>
inline
diff --git a/icetray/icetray/logger.cpp b/icetray/icetray/logger.cpp
index f50eb0f..9f699e3 100644
--- a/icetray/icetray/logger.cpp
+++ b/icetray/icetray/logger.cpp
@@ -14,8 +14,8 @@ template class ::AdHoc::GlobalStatic<::IceTray::Logging::LogManager>;
namespace IceTray {
namespace Logging {
- LoggerBase::LoggerBase(const Domain & domain) :
- domain(domain)
+ LoggerBase::LoggerBase(Domain domain) :
+ domain(std::move(domain))
{
}
@@ -102,7 +102,7 @@ namespace IceTray {
LogManager::getLogger(const std::type_info & type)
{
std::unique_ptr<char, void(*)(void*)> res {
- abi::__cxa_demangle(type.name(), NULL, NULL, NULL), std::free
+ abi::__cxa_demangle(type.name(), nullptr, nullptr, nullptr), std::free
};
// NOLINTNEXTLINE(clang-analyzer-cplusplus.NewDeleteLeaks)
return getLogger(res.get());
@@ -112,7 +112,7 @@ namespace IceTray {
LogManager::getLogger(const std::string & domain)
{
auto domainTokens = AbstractLogWriter::splitDomain(domain);
- auto logger = LoggerPtr(new Logger(domainTokens));
+ auto logger = std::make_shared<Logger>(domainTokens);
logger->logs = getLogsForDomain(domainTokens);
loggers.insert(logger.get());
return logger;
diff --git a/icetray/icetray/logger.h b/icetray/icetray/logger.h
index 1571cad..5e7ef1f 100644
--- a/icetray/icetray/logger.h
+++ b/icetray/icetray/logger.h
@@ -22,7 +22,7 @@ namespace IceTray {
class DLL_PUBLIC LoggerBase {
public:
- LoggerBase(const Domain & domain);
+ LoggerBase(Domain domain);
virtual ~LoggerBase() = 0;
const Domain & getDomain() const;
diff --git a/icetray/icetray/options.cpp b/icetray/icetray/options.cpp
index 65c7836..8423707 100644
--- a/icetray/icetray/options.cpp
+++ b/icetray/icetray/options.cpp
@@ -7,8 +7,8 @@ INSTANTIATEPLUGINOF(IceTray::Options);
namespace po = boost::program_options;
namespace IceTray {
- Options::Options(const std::string & name) :
- optionsName(name)
+ Options::Options(std::string name) :
+ optionsName(std::move(name))
{
}
diff --git a/icetray/icetray/options.h b/icetray/icetray/options.h
index f78cc22..0813735 100644
--- a/icetray/icetray/options.h
+++ b/icetray/icetray/options.h
@@ -10,7 +10,7 @@ namespace IceTray {
typedef std::shared_ptr<boost::program_options::options_description> OptionsDescPtr;
class DLL_PUBLIC Options : public AdHoc::AbstractPluginImplementation {
public:
- Options(const std::string & name);
+ Options(std::string name);
private:
friend class OptionsCollation;
diff --git a/icetray/icetray/staticSqlSource.cpp b/icetray/icetray/staticSqlSource.cpp
index 9be8148..b658ff9 100644
--- a/icetray/icetray/staticSqlSource.cpp
+++ b/icetray/icetray/staticSqlSource.cpp
@@ -2,14 +2,14 @@
#include <command.h>
namespace IceTray {
- StaticSqlSource::StaticSqlSource(const std::string & s) :
- sql(s),
+ StaticSqlSource::StaticSqlSource(std::string s) :
+ sql(std::move(s)),
opts(new DB::CommandOptions(std::hash<std::string>()(sql)))
{
}
- StaticSqlSource::StaticSqlSource(const std::string & s, const std::string & optsName, const DB::CommandOptionsMap & map) :
- sql(s),
+ StaticSqlSource::StaticSqlSource(std::string s, const std::string & optsName, const DB::CommandOptionsMap & map) :
+ sql(std::move(s)),
opts(DB::CommandOptionsFactory::createNew(optsName, std::hash<std::string>()(sql), map))
{
diff --git a/icetray/icetray/staticSqlSource.h b/icetray/icetray/staticSqlSource.h
index 3dc32a0..489ea2f 100644
--- a/icetray/icetray/staticSqlSource.h
+++ b/icetray/icetray/staticSqlSource.h
@@ -6,8 +6,8 @@
namespace IceTray {
class DLL_PUBLIC StaticSqlSource : public SqlSource {
public:
- StaticSqlSource(const std::string & sql);
- StaticSqlSource(const std::string & sql, const std::string & optsName, const DB::CommandOptionsMap &);
+ StaticSqlSource(std::string sql);
+ StaticSqlSource(std::string sql, const std::string & optsName, const DB::CommandOptionsMap &);
const std::string & getSql() const override;
DB::CommandOptionsCPtr getCommandOptions() const override;
diff --git a/icetray/unittests/testIceBoxInterface.cpp b/icetray/unittests/testIceBoxInterface.cpp
index 96aedf3..ef9e2bc 100644
--- a/icetray/unittests/testIceBoxInterface.cpp
+++ b/icetray/unittests/testIceBoxInterface.cpp
@@ -6,9 +6,9 @@
BOOST_AUTO_TEST_CASE( IceBoxInterface )
{
- typedef IceTray::Service *(* SetupFunction)(Ice::CommunicatorPtr);
+ using SetupFunction = IceTray::Service *(*)(Ice::CommunicatorPtr);
- void * i = dlsym(NULL, "createIceTrayService");
+ void * i = dlsym(nullptr, "createIceTrayService");
BOOST_REQUIRE(i);
auto sf = (SetupFunction)i;
BOOST_REQUIRE(sf);
diff --git a/icetray/unittests/testIceTrayLogger.cpp b/icetray/unittests/testIceTrayLogger.cpp
index 3eabf0d..0998143 100644
--- a/icetray/unittests/testIceTrayLogger.cpp
+++ b/icetray/unittests/testIceTrayLogger.cpp
@@ -331,7 +331,7 @@ BOOST_AUTO_TEST_SUITE_END();
BOOST_AUTO_TEST_CASE( console )
{
IceTray::Logging::LogWriterPtr lwp =
- IceTray::Logging::LogWriterFactory::createNew("ConsoleLogWriter", NULL);
+ IceTray::Logging::LogWriterFactory::createNew("ConsoleLogWriter", nullptr);
lwp->message(LogLevel::DEBUG, testDomain, "some message", {});
}
diff --git a/icetray/unittests/testOptions.cpp b/icetray/unittests/testOptions.cpp
index b47e8a4..f11aef0 100644
--- a/icetray/unittests/testOptions.cpp
+++ b/icetray/unittests/testOptions.cpp
@@ -15,8 +15,7 @@ ICETRAY_OPTIONS(TestOptions,
class TestOptionsInline : public IceTray::Options {
public:
TestOptionsInline() :
- IceTray::Options("Test options inline"),
- testInt(0)
+ IceTray::Options("Test options inline")
{
}
@@ -24,7 +23,7 @@ class TestOptionsInline : public IceTray::Options {
("testIntInline", boost::program_options::value(&testInt), "testInt")
);
- int testInt;
+ int testInt { 0 };
};
FACTORY(TestOptionsInline, IceTray::OptionsFactory);