From afd38f0c617d6f89b2b4532c6c44f116617e2b6f Mon Sep 17 00:00:00 2001 From: Felix Thomasmathibalan Date: Wed, 27 Sep 2023 17:46:17 +0100 Subject: Apply clang-format on repository Code is formatted as per a revised clang format configuration file(not part of this delivery). Version 14.0.6 is used. Exclusion List: - files with .cl extension - files that are not strictly C/C++ (e.g. Android.bp, Sconscript ...) And the following directories - compute_kernel_writer/validation/ - tests/ - include/ - src/core/NEON/kernels/convolution/ - src/core/NEON/kernels/arm_gemm/ - src/core/NEON/kernels/arm_conv/ - data/ There will be a follow up for formatting of .cl files and the files under tests/ and compute_kernel_writer/validation/. Signed-off-by: Felix Thomasmathibalan Change-Id: Ib7eb1fcf4e7537b9feaefcfc15098a804a3fde0a Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/10391 Benchmark: Arm Jenkins Tested-by: Arm Jenkins Reviewed-by: Gunes Bayir --- arm_compute/core/utils/logging/FilePrinter.h | 3 +-- arm_compute/core/utils/logging/Helpers.h | 3 ++- arm_compute/core/utils/logging/IPrinter.h | 3 +-- arm_compute/core/utils/logging/LogMsgDecorators.h | 5 ++--- arm_compute/core/utils/logging/Logger.h | 6 +++--- arm_compute/core/utils/logging/LoggerRegistry.h | 13 ++++++++----- arm_compute/core/utils/logging/Macros.h | 16 ++++++++-------- arm_compute/core/utils/logging/Types.h | 6 ++---- 8 files changed, 27 insertions(+), 28 deletions(-) (limited to 'arm_compute/core/utils/logging') diff --git a/arm_compute/core/utils/logging/FilePrinter.h b/arm_compute/core/utils/logging/FilePrinter.h index 0e5b84f084..a865aadddb 100644 --- a/arm_compute/core/utils/logging/FilePrinter.h +++ b/arm_compute/core/utils/logging/FilePrinter.h @@ -24,9 +24,8 @@ #ifndef ARM_COMPUTE_LOGGING_FILE_PRINTER_H #define ARM_COMPUTE_LOGGING_FILE_PRINTER_H -#include "arm_compute/core/utils/logging/IPrinter.h" - #include "arm_compute/core/utils/io/FileHandler.h" +#include "arm_compute/core/utils/logging/IPrinter.h" namespace arm_compute { diff --git a/arm_compute/core/utils/logging/Helpers.h b/arm_compute/core/utils/logging/Helpers.h index 5f8b948592..c3c2f0f0b8 100644 --- a/arm_compute/core/utils/logging/Helpers.h +++ b/arm_compute/core/utils/logging/Helpers.h @@ -25,6 +25,7 @@ #define ARM_COMPUTE_LOGGING_HELPERS_H #include "arm_compute/core/utils/logging/Types.h" + #include "support/ToolchainSupport.h" #include @@ -45,7 +46,7 @@ namespace logging * @return The formatted string */ template -inline std::string string_with_format(const std::string &fmt, Ts &&... args) +inline std::string string_with_format(const std::string &fmt, Ts &&...args) { size_t size = support::cpp11::snprintf(nullptr, 0, fmt.c_str(), args...) + 1; auto char_str = std::make_unique(size); diff --git a/arm_compute/core/utils/logging/IPrinter.h b/arm_compute/core/utils/logging/IPrinter.h index 42dca58ea1..7fde4d9302 100644 --- a/arm_compute/core/utils/logging/IPrinter.h +++ b/arm_compute/core/utils/logging/IPrinter.h @@ -35,8 +35,7 @@ class Printer { public: /** Default Constructor */ - Printer() noexcept - : _mtx() + Printer() noexcept : _mtx() { } /** Prevent instances of this class from being copied */ diff --git a/arm_compute/core/utils/logging/LogMsgDecorators.h b/arm_compute/core/utils/logging/LogMsgDecorators.h index 9c9e62740f..66a8180e21 100644 --- a/arm_compute/core/utils/logging/LogMsgDecorators.h +++ b/arm_compute/core/utils/logging/LogMsgDecorators.h @@ -63,8 +63,7 @@ public: * * @param str Sting to append */ - StringDecorator(const std::string &str) - : _str(str) + StringDecorator(const std::string &str) : _str(str) { _str = angle_wrap_value(str); } @@ -103,7 +102,7 @@ private: auto time = std::chrono::system_clock::to_time_t(now); // TODO: use put_time for gcc > 4.9 - char buf[100] = { 0 }; + char buf[100] = {0}; std::strftime(buf, sizeof(buf), "%d-%m-%Y %I:%M:%S", std::localtime(&time)); return buf; } diff --git a/arm_compute/core/utils/logging/Logger.h b/arm_compute/core/utils/logging/Logger.h index 4fc9bb7dbf..608db39138 100644 --- a/arm_compute/core/utils/logging/Logger.h +++ b/arm_compute/core/utils/logging/Logger.h @@ -88,7 +88,7 @@ public: * @param[in] args Message arguments */ template - void log(LogLevel log_level, const std::string &fmt, Ts &&... args); + void log(LogLevel log_level, const std::string &fmt, Ts &&...args); /** Sets log level of the logger * * @warning Not thread-safe @@ -159,11 +159,11 @@ private: }; template -inline void Logger::log(LogLevel log_level, const std::string &fmt, Ts &&... args) +inline void Logger::log(LogLevel log_level, const std::string &fmt, Ts &&...args) { // Return if message shouldn't be logged // i.e. if log level does not match the logger's - if(!is_loggable(log_level)) + if (!is_loggable(log_level)) { return; } diff --git a/arm_compute/core/utils/logging/LoggerRegistry.h b/arm_compute/core/utils/logging/LoggerRegistry.h index 7c9931a260..4e52a10935 100644 --- a/arm_compute/core/utils/logging/LoggerRegistry.h +++ b/arm_compute/core/utils/logging/LoggerRegistry.h @@ -27,6 +27,7 @@ #include "arm_compute/core/utils/logging/Logger.h" #include "arm_compute/core/utils/logging/Printers.h" #include "arm_compute/core/utils/logging/Types.h" + #include "support/Mutex.h" #include @@ -54,8 +55,9 @@ public: * @param[in] log_level Logger's log level. Defaults to INFO * @param[in] printers Printers to attach to the system loggers. Defaults with a @ref StdPrinter. */ - void create_logger(const std::string &name, LogLevel log_level = LogLevel::INFO, - const std::vector> &printers = { std::make_shared() }); + void create_logger(const std::string &name, + LogLevel log_level = LogLevel::INFO, + const std::vector> &printers = {std::make_shared()}); /** Remove a logger * * @param name Logger's name @@ -74,16 +76,17 @@ public: * @param[in] printers (Optional) Printers to attach to the system loggers. Defaults with a @ref StdPrinter. */ void create_reserved_loggers(LogLevel log_level = LogLevel::INFO, - const std::vector> &printers = { std::make_shared() }); + const std::vector> &printers = { + std::make_shared()}); private: /** Default constructor */ LoggerRegistry(); private: - arm_compute::Mutex _mtx; + arm_compute::Mutex _mtx; std::unordered_map> _loggers; - static std::set _reserved_loggers; + static std::set _reserved_loggers; }; } // namespace logging } // namespace arm_compute diff --git a/arm_compute/core/utils/logging/Macros.h b/arm_compute/core/utils/logging/Macros.h index 0ab17c4464..4d5aa5fe2c 100644 --- a/arm_compute/core/utils/logging/Macros.h +++ b/arm_compute/core/utils/logging/Macros.h @@ -48,48 +48,48 @@ inline std::string signature_name(const std::string &pretty_func) do \ { \ auto __logger = arm_compute::logging::LoggerRegistry::get().logger(logger_name); \ - if(__logger != nullptr) \ + if (__logger != nullptr) \ { \ __logger->log(log_level, msg); \ } \ - } while(false) + } while (false) #define ARM_COMPUTE_LOG_MSG_WITH_FUNCNAME(logger_name, log_level, msg) \ do \ { \ auto __logger = arm_compute::logging::LoggerRegistry::get().logger(logger_name); \ - if(__logger != nullptr) \ + if (__logger != nullptr) \ { \ std::ostringstream s; \ s << ARM_COMPUTE_SIGNATURE_NAME << " : " << msg; \ __logger->log(log_level, s.str()); \ } \ - } while(false) + } while (false) #define ARM_COMPUTE_LOG_MSG_WITH_FORMAT(logger_name, log_level, fmt, ...) \ do \ { \ auto __logger = arm_compute::logging::LoggerRegistry::get().logger(logger_name); \ - if(__logger != nullptr) \ + if (__logger != nullptr) \ { \ size_t size = ::snprintf(nullptr, 0, fmt, __VA_ARGS__) + 1; \ auto char_str = std::make_unique(size); \ ::snprintf(char_str.get(), size, fmt, __VA_ARGS__); \ __logger->log(log_level, std::string(char_str.get(), char_str.get() + size - 1)); \ } \ - } while(false) + } while (false) #define ARM_COMPUTE_LOG_STREAM(logger_name, log_level, stream) \ do \ { \ auto __logger = arm_compute::logging::LoggerRegistry::get().logger(logger_name); \ - if(__logger != nullptr) \ + if (__logger != nullptr) \ { \ std::ostringstream s; \ s << stream; \ __logger->log(log_level, s.str()); \ } \ - } while(false) + } while (false) #else /* ARM_COMPUTE_LOGGING_ENABLED */ diff --git a/arm_compute/core/utils/logging/Types.h b/arm_compute/core/utils/logging/Types.h index f0ddae6c84..64c567b984 100644 --- a/arm_compute/core/utils/logging/Types.h +++ b/arm_compute/core/utils/logging/Types.h @@ -44,8 +44,7 @@ enum class LogLevel struct LogMsg { /** Default constructor */ - LogMsg() - : raw_(), log_level_(LogLevel::OFF) + LogMsg() : raw_(), log_level_(LogLevel::OFF) { } /** Construct a log message @@ -53,8 +52,7 @@ struct LogMsg * @param[in] msg Message to log. * @param[in] log_level Logging level. Default: OFF */ - LogMsg(std::string msg, LogLevel log_level = LogLevel::OFF) - : raw_(msg), log_level_(log_level) + LogMsg(std::string msg, LogLevel log_level = LogLevel::OFF) : raw_(msg), log_level_(log_level) { } -- cgit v1.2.1