From d2f2080bc060e65ce88800bef506c956d0aa4af2 Mon Sep 17 00:00:00 2001 From: Jackson Date: Fri, 23 Apr 2021 11:33:40 -0400 Subject: [PATCH] clang-format compliance for modified files, more const-qualified memfns --- include/spdlog/async_logger-inl.h | 2 +- include/spdlog/details/registry-inl.h | 2 +- include/spdlog/details/registry.h | 2 +- include/spdlog/logger.h | 4 ++-- include/spdlog/pattern_formatter-inl.h | 6 +++--- include/spdlog/pattern_formatter.h | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/spdlog/async_logger-inl.h b/include/spdlog/async_logger-inl.h index 9a651b71..81cdfcd3 100644 --- a/include/spdlog/async_logger-inl.h +++ b/include/spdlog/async_logger-inl.h @@ -84,7 +84,7 @@ SPDLOG_INLINE void spdlog::async_logger::backend_flush_() } } -SPDLOG_INLINE std::shared_ptr spdlog::async_logger::clone(std::string new_name) const& +SPDLOG_INLINE std::shared_ptr spdlog::async_logger::clone(std::string new_name) const & { auto cloned = std::make_shared(*this); cloned->name_ = std::move(new_name); diff --git a/include/spdlog/details/registry-inl.h b/include/spdlog/details/registry-inl.h index e677f44c..f75dddbf 100644 --- a/include/spdlog/details/registry-inl.h +++ b/include/spdlog/details/registry-inl.h @@ -294,7 +294,7 @@ SPDLOG_INLINE registry ®istry::instance() return s_instance; } -SPDLOG_INLINE void registry::throw_if_exists_(const std::string &logger_name) +SPDLOG_INLINE void registry::throw_if_exists_(const std::string &logger_name) const { if (loggers_.find(logger_name) != loggers_.end()) { diff --git a/include/spdlog/details/registry.h b/include/spdlog/details/registry.h index 67660d53..01862deb 100644 --- a/include/spdlog/details/registry.h +++ b/include/spdlog/details/registry.h @@ -89,7 +89,7 @@ private: registry(); ~registry(); - void throw_if_exists_(const std::string &logger_name); + void throw_if_exists_(const std::string &logger_name) const; void register_logger_(std::shared_ptr new_logger) &; bool set_level_from_cfg_(logger *logger); diff --git a/include/spdlog/logger.h b/include/spdlog/logger.h index ae608104..09fe4710 100644 --- a/include/spdlog/logger.h +++ b/include/spdlog/logger.h @@ -287,7 +287,7 @@ public: level::level_enum level() const; std::string name() &&; - const std::string &name() const&; + const std::string &name() const &; std::string &name() &; // set formatting for the sinks in this logger. @@ -316,7 +316,7 @@ public: void set_error_handler(err_handler) &; // create new logger with same sinks and configuration. - virtual std::shared_ptr clone(std::string logger_name) const&; + virtual std::shared_ptr clone(std::string logger_name) const &; protected: std::string name_; diff --git a/include/spdlog/pattern_formatter-inl.h b/include/spdlog/pattern_formatter-inl.h index c324299d..f51ca8fd 100644 --- a/include/spdlog/pattern_formatter-inl.h +++ b/include/spdlog/pattern_formatter-inl.h @@ -819,7 +819,7 @@ public: #ifdef _MSC_VER #pragma warning(push) #pragma warning(disable : 4127) // consider using 'if constexpr' instead -#endif // _MSC_VER +#endif // _MSC_VER static const char *basename(const char *filename) { // if the size is 2 (1 character + null terminator) we can use the more efficient strrchr @@ -831,8 +831,8 @@ public: } else { - const std::reverse_iterator begin(filename + std::strlen(filename)); - const std::reverse_iterator end(filename); + const std::reverse_iterator begin(filename + std::strlen(filename)); + const std::reverse_iterator end(filename); const auto it = std::find_first_of(begin, end, std::begin(os::folder_seps), std::end(os::folder_seps) - 1); return it != end ? it.base() : filename; diff --git a/include/spdlog/pattern_formatter.h b/include/spdlog/pattern_formatter.h index 4a483393..201454a1 100644 --- a/include/spdlog/pattern_formatter.h +++ b/include/spdlog/pattern_formatter.h @@ -92,7 +92,7 @@ public: void format(const details::log_msg &msg, memory_buf_t &dest) override; template - pattern_formatter &add_flag(char flag, Args&&...args) & + pattern_formatter &add_flag(char flag, Args &&...args) & { custom_handlers_[flag] = details::make_unique(std::forward(args)...); return *this;