From 5d787806feed6132c41383641796f9ab0fe08025 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sun, 2 Feb 2020 16:28:41 -0800 Subject: [PATCH 1/4] [clang-tidy] add ending namespace comments Found with llvm-namespace-comment Signed-off-by: Rosen Penev --- src/CommandLine.cxx | 2 +- src/command/StickerCommands.cxx | 2 +- src/encoder/plugins/OpusEncoderPlugin.cxx | 2 +- src/input/plugins/QobuzClient.cxx | 2 +- src/lib/dbus/Glue.cxx | 2 +- src/lib/upnp/ixmlwrap.cxx | 2 +- src/sticker/SongSticker.cxx | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/CommandLine.cxx b/src/CommandLine.cxx index 4249b1f2f..9e9244711 100644 --- a/src/CommandLine.cxx +++ b/src/CommandLine.cxx @@ -78,7 +78,7 @@ constexpr auto USER_CONFIG_FILE_LOCATION1 = Path::FromFS(PATH_LITERAL(".mpdconf" constexpr auto USER_CONFIG_FILE_LOCATION2 = Path::FromFS(PATH_LITERAL(".mpd/mpd.conf")); constexpr auto USER_CONFIG_FILE_LOCATION_XDG = Path::FromFS(PATH_LITERAL("mpd/mpd.conf")); #endif -} +} // namespace enum Option { OPTION_KILL, diff --git a/src/command/StickerCommands.cxx b/src/command/StickerCommands.cxx index 0f2b4a71e..54d35880a 100644 --- a/src/command/StickerCommands.cxx +++ b/src/command/StickerCommands.cxx @@ -36,7 +36,7 @@ struct sticker_song_find_data { Response &r; const char *name; }; -} +} // namespace static void sticker_song_find_print_cb(const LightSong &song, const char *value, diff --git a/src/encoder/plugins/OpusEncoderPlugin.cxx b/src/encoder/plugins/OpusEncoderPlugin.cxx index fcfdced7e..843fd7fb6 100644 --- a/src/encoder/plugins/OpusEncoderPlugin.cxx +++ b/src/encoder/plugins/OpusEncoderPlugin.cxx @@ -387,7 +387,7 @@ OpusEncoder::SendTag(const Tag &tag) GenerateHeaders(&tag); } -} +} // namespace const EncoderPlugin opus_encoder_plugin = { "opus", diff --git a/src/input/plugins/QobuzClient.cxx b/src/input/plugins/QobuzClient.cxx index aa61a9f0a..ff80b3648 100644 --- a/src/input/plugins/QobuzClient.cxx +++ b/src/input/plugins/QobuzClient.cxx @@ -44,7 +44,7 @@ public: } }; -} +} // namespace QobuzClient::QobuzClient(EventLoop &event_loop, const char *_base_url, diff --git a/src/lib/dbus/Glue.cxx b/src/lib/dbus/Glue.cxx index d1049de70..eaca4e45e 100644 --- a/src/lib/dbus/Glue.cxx +++ b/src/lib/dbus/Glue.cxx @@ -56,4 +56,4 @@ Glue::OnDBusClosed() noexcept // TODO: reconnect } -} +} // namespace ODBus diff --git a/src/lib/upnp/ixmlwrap.cxx b/src/lib/upnp/ixmlwrap.cxx index 4e44f35a6..f811b07a6 100644 --- a/src/lib/upnp/ixmlwrap.cxx +++ b/src/lib/upnp/ixmlwrap.cxx @@ -38,4 +38,4 @@ getFirstElementValue(IXML_Document *doc, const char *name) noexcept return ixmlNode_getNodeValue(dnode); } -} +} // namespace ixmlwrap diff --git a/src/sticker/SongSticker.cxx b/src/sticker/SongSticker.cxx index 545728290..43a5dadbe 100644 --- a/src/sticker/SongSticker.cxx +++ b/src/sticker/SongSticker.cxx @@ -82,7 +82,7 @@ struct sticker_song_find_data { void *user_data); void *user_data; }; -} +} // namespace static void sticker_song_find_cb(const char *uri, const char *value, void *user_data) From 6d3190fe5fa7501c5f09407ff9de1e622bb57ef2 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sun, 2 Feb 2020 16:52:46 -0800 Subject: [PATCH 2/4] [clang-tidy] use = default Found with modernize-use-equals-default Signed-off-by: Rosen Penev --- src/db/plugins/upnp/Directory.cxx | 6 ++---- src/db/plugins/upnp/Object.cxx | 6 ++---- src/lib/upnp/ContentDirectoryService.cxx | 6 ++---- src/lib/upnp/Device.cxx | 6 ++---- src/song/Filter.cxx | 6 ++---- 5 files changed, 10 insertions(+), 20 deletions(-) diff --git a/src/db/plugins/upnp/Directory.cxx b/src/db/plugins/upnp/Directory.cxx index de344cba3..7e2ce4347 100644 --- a/src/db/plugins/upnp/Directory.cxx +++ b/src/db/plugins/upnp/Directory.cxx @@ -30,10 +30,8 @@ #include -UPnPDirContent::~UPnPDirContent() -{ - /* this destructor exists here just so it won't get inlined */ -} +/* this destructor exists here just so it won't get inlined */ +UPnPDirContent::~UPnPDirContent() = default; gcc_pure static UPnPDirObject::ItemClass diff --git a/src/db/plugins/upnp/Object.cxx b/src/db/plugins/upnp/Object.cxx index 426d03f59..f693f5b39 100644 --- a/src/db/plugins/upnp/Object.cxx +++ b/src/db/plugins/upnp/Object.cxx @@ -19,7 +19,5 @@ #include "Object.hxx" -UPnPDirObject::~UPnPDirObject() noexcept -{ - /* this destructor exists here just so it won't get inlined */ -} +/* this destructor exists here just so it won't get inlined */ +UPnPDirObject::~UPnPDirObject() noexcept = default; diff --git a/src/lib/upnp/ContentDirectoryService.cxx b/src/lib/upnp/ContentDirectoryService.cxx index 539da0fa5..fa8eaace3 100644 --- a/src/lib/upnp/ContentDirectoryService.cxx +++ b/src/lib/upnp/ContentDirectoryService.cxx @@ -44,10 +44,8 @@ ContentDirectoryService::ContentDirectoryService(const UPnPDevice &device, } } -ContentDirectoryService::~ContentDirectoryService() noexcept -{ - /* this destructor exists here just so it won't get inlined */ -} +/* this destructor exists here just so it won't get inlined */ +ContentDirectoryService::~ContentDirectoryService() noexcept = default; std::forward_list ContentDirectoryService::getSearchCapabilities(UpnpClient_Handle hdl) const diff --git a/src/lib/upnp/Device.cxx b/src/lib/upnp/Device.cxx index 37a39686d..d382ffdf8 100644 --- a/src/lib/upnp/Device.cxx +++ b/src/lib/upnp/Device.cxx @@ -23,10 +23,8 @@ #include -UPnPDevice::~UPnPDevice() noexcept -{ - /* this destructor exists here just so it won't get inlined */ -} +/* this destructor exists here just so it won't get inlined */ +UPnPDevice::~UPnPDevice() noexcept = default; /** * An XML parser which constructs an UPnP device object from the diff --git a/src/song/Filter.cxx b/src/song/Filter.cxx index c3c566f85..6ec9d3e7f 100644 --- a/src/song/Filter.cxx +++ b/src/song/Filter.cxx @@ -90,10 +90,8 @@ SongFilter::SongFilter(TagType tag, const char *value, bool fold_case) StringFilter(value, fold_case, fold_case, false))); } -SongFilter::~SongFilter() -{ - /* this destructor exists here just so it won't get inlined */ -} +/* this destructor exists here just so it won't get inlined */ +SongFilter::~SongFilter() = default; std::string SongFilter::ToExpression() const noexcept From 87f7b0f0bb32c5be5f9876f2deeeb3c00bcf42c1 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sun, 16 Feb 2020 17:29:52 -0800 Subject: [PATCH 3/4] [clang-tidy] use emplace_back Found with hicpp-use-emplace Signed-off-by: Rosen Penev --- src/db/plugins/ProxyDatabasePlugin.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/db/plugins/ProxyDatabasePlugin.cxx b/src/db/plugins/ProxyDatabasePlugin.cxx index 74ce9e8d1..18c3c3dd4 100644 --- a/src/db/plugins/ProxyDatabasePlugin.cxx +++ b/src/db/plugins/ProxyDatabasePlugin.cxx @@ -770,7 +770,7 @@ ReceiveEntities(struct mpd_connection *connection) noexcept std::list entities; struct mpd_entity *entity; while ((entity = mpd_recv_entity(connection)) != nullptr) - entities.push_back(ProxyEntity(entity)); + entities.emplace_back(entity); mpd_response_finish(connection); return entities; From 351a4a80d2126762607e0419bfc6f8ae35397ffd Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sun, 16 Feb 2020 19:08:46 -0800 Subject: [PATCH 4/4] [clang-tidy] use using instead of typedef Found with modernize-use-using Signed-off-by: Rosen Penev --- src/db/Helpers.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/db/Helpers.cxx b/src/db/Helpers.cxx index adab44140..46d8a3683 100644 --- a/src/db/Helpers.cxx +++ b/src/db/Helpers.cxx @@ -34,7 +34,7 @@ struct StringLess { } }; -typedef std::set StringSet; +using StringSet = std::set; static void StatsVisitTag(DatabaseStats &stats, StringSet &artists, StringSet &albums,