OpenVINO™ is an open source toolkit for optimizing and deploying AI inference
C++ aicomputer-visiondeep-learningdeploy-aidiffusion-modelsgenerative-aigood-first-issueinferencellm-inferencenatural-language-processingnlpopenvinooptimize-aiperformance-boostrecommendation-systemspeech-recognitionstable-diffusiontransformersyolo
[CPU] Apply 'bugprone-lambda-function-name' clang-tidy remarks (#30080)
Arseniy Obolenskiy070366388db0
diff --git a/src/plugins/intel_cpu/src/.clang-tidy b/src/plugins/intel_cpu/src/.clang-tidyindex 023b2d07808..250a01e65f0 100644--- a/src/plugins/intel_cpu/src/.clang-tidy+++ b/src/plugins/intel_cpu/src/.clang-tidy@@ -26,7 +26,6 @@# -bugprone-exception-escape. There are a lot of legacy code which does not handle exceptions properly and just catches them all. Major refactoring is required to correct this.# -bugprone-implicit-widening-of-multiplication-result# -bugprone-incorrect-roundings. There are explicit ways to perform rounding (i.e. std::floor(), std::round(), etc). Requires careful updates case by case-# -bugprone-lambda-function-name. Used by generic debug caps macro# -bugprone-signed-char-misuse. The source code contains valid logic when pointer to the data is interpreted as int8_t (i.e. weights tensor)# -cppcoreguidelines-narrowing-conversions# -google-default-arguments,@@ -59,7 +58,6 @@ Checks: >-bugprone-exception-escape,-bugprone-implicit-widening-of-multiplication-result,-bugprone-incorrect-roundings,- -bugprone-lambda-function-name,-bugprone-narrowing-conversions,-bugprone-signed-char-misuse,-cppcoreguidelines-narrowing-conversions,diff --git a/src/plugins/intel_cpu/src/emitters/utils.hpp b/src/plugins/intel_cpu/src/emitters/utils.hppindex 82b704dad88..cd9264fd017 100644--- a/src/plugins/intel_cpu/src/emitters/utils.hpp+++ b/src/plugins/intel_cpu/src/emitters/utils.hpp@@ -9,19 +9,15 @@#include "openvino/core/except.hpp"#include "openvino/core/node.hpp"#include "openvino/core/type/element_type.hpp"+#include "utils/general_utils.h"namespace ov::intel_cpu {std::string jit_emitter_pretty_name(const std::string& pretty_func);-#ifdef __GNUC__-# define OV_CPU_JIT_EMITTER_NAME jit_emitter_pretty_name(__PRETTY_FUNCTION__)-#else /* __GNUC__ */-# define OV_CPU_JIT_EMITTER_NAME jit_emitter_pretty_name(__FUNCSIG__)-#endif /* __GNUC__ */--#define OV_CPU_JIT_EMITTER_THROW(...) OPENVINO_THROW(OV_CPU_JIT_EMITTER_NAME, ": ", __VA_ARGS__)-#define OV_CPU_JIT_EMITTER_ASSERT(cond, ...) OPENVINO_ASSERT((cond), OV_CPU_JIT_EMITTER_NAME, ": ", __VA_ARGS__)+#define OV_CPU_JIT_EMITTER_THROW(...) OPENVINO_THROW(jit_emitter_pretty_name(OV_CPU_FUNCTION_NAME), ": ", __VA_ARGS__)+#define OV_CPU_JIT_EMITTER_ASSERT(cond, ...) \+ OPENVINO_ASSERT((cond), jit_emitter_pretty_name(OV_CPU_FUNCTION_NAME), ": ", __VA_ARGS__)ov::element::Type get_arithmetic_binary_exec_precision(const std::shared_ptr<ov::Node>& n);diff --git a/src/plugins/intel_cpu/src/utils/debug_capabilities.h b/src/plugins/intel_cpu/src/utils/debug_capabilities.hindex 02ad35f5437..521bf70650e 100644--- a/src/plugins/intel_cpu/src/utils/debug_capabilities.h+++ b/src/plugins/intel_cpu/src/utils/debug_capabilities.h@@ -22,6 +22,7 @@# include "onednn/dnnl.h"# include "onednn/iml_type_mapper.h"# include "openvino/core/model.hpp"+# include "utils/general_utils.h"namespace ov {namespace intel_cpu {@@ -167,7 +168,7 @@ static inline std::ostream& _write_all_to_stream(std::ostream& os, const T& arg,# define DEBUG_LOG_EXT(name, ostream, prefix, ...) \do { \- static DebugLogEnabled DEBUG_ENABLE_NAME(__FILE__, __func__, __LINE__, name); \+ static DebugLogEnabled DEBUG_ENABLE_NAME(__FILE__, OV_CPU_FUNCTION_NAME, __LINE__, name); \if (DEBUG_ENABLE_NAME) { \::std::stringstream ss___; \ov::intel_cpu::_write_all_to_stream(ss___, prefix, DEBUG_ENABLE_NAME.get_tag(), " ", __VA_ARGS__); \diff --git a/src/plugins/intel_cpu/src/utils/general_utils.h b/src/plugins/intel_cpu/src/utils/general_utils.hindex abe38337093..a237f0ac45f 100644--- a/src/plugins/intel_cpu/src/utils/general_utils.h+++ b/src/plugins/intel_cpu/src/utils/general_utils.h@@ -13,6 +13,15 @@namespace ov {namespace intel_cpu {+#if defined(__clang__) || defined(__GNUC__)+# define OV_CPU_FUNCTION_NAME __PRETTY_FUNCTION__+#elif defined(_MSC_VER)+# define OV_CPU_FUNCTION_NAME __FUNCSIG__+#else+// Fallback+# define OV_CPU_FUNCTION_NAME __func__+#endif+template <typename T, typename U>inline T div_up(const T a, const U b) {assert(b);