Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

Fixed C++ RTTI for Core base classes (#28555)

Ilya Lavrenova6ab17ecd8e2
diff --git a/src/common/low_precision_transformations/include/low_precision/cleanup_transformation.hpp b/src/common/low_precision_transformations/include/low_precision/cleanup_transformation.hpp
index 52de352c0bb..dd321c3a922 100644
--- a/src/common/low_precision_transformations/include/low_precision/cleanup_transformation.hpp
+++ b/src/common/low_precision_transformations/include/low_precision/cleanup_transformation.hpp
@@ -17,7 +17,6 @@ namespace low_precision {
class LP_TRANSFORMATIONS_API CleanupTransformation : public LayerTransformation {
public:
CleanupTransformation(const Params& params);
- virtual ~CleanupTransformation() = default;
bool canBeTransformed(const std::shared_ptr<Node>& layer) const override;
static bool canBeTransformedStatic(
diff --git a/src/common/low_precision_transformations/include/low_precision/fuse_elementwise_to_fake_quantize.hpp b/src/common/low_precision_transformations/include/low_precision/fuse_elementwise_to_fake_quantize.hpp
index 13b73a1112f..a9fed138b41 100644
--- a/src/common/low_precision_transformations/include/low_precision/fuse_elementwise_to_fake_quantize.hpp
+++ b/src/common/low_precision_transformations/include/low_precision/fuse_elementwise_to_fake_quantize.hpp
@@ -19,7 +19,6 @@ namespace low_precision {
class LP_TRANSFORMATIONS_API FuseElementwiseToFakeQuantizeTransformation : public CleanupTransformation {
public:
FuseElementwiseToFakeQuantizeTransformation(const Params& params);
- virtual ~FuseElementwiseToFakeQuantizeTransformation() = default;
bool canBeTransformed(const std::shared_ptr<Node>& layer) const override;
};
diff --git a/src/common/low_precision_transformations/include/low_precision/layer_transformation.hpp b/src/common/low_precision_transformations/include/low_precision/layer_transformation.hpp
index b3c7aaa16ea..8b046de904f 100644
--- a/src/common/low_precision_transformations/include/low_precision/layer_transformation.hpp
+++ b/src/common/low_precision_transformations/include/low_precision/layer_transformation.hpp
@@ -288,7 +288,6 @@ public:
};
LayerTransformation(const Params& params);
- virtual ~LayerTransformation() = default;
virtual bool transform(ov::pass::pattern::Matcher &m) = 0;
virtual bool canBeTransformed(const std::shared_ptr<Node>& layer) const;
diff --git a/src/common/low_precision_transformations/include/low_precision/rt_info/shared_value_attribute.hpp b/src/common/low_precision_transformations/include/low_precision/rt_info/shared_value_attribute.hpp
index 04eade09427..bf8f51b3077 100644
--- a/src/common/low_precision_transformations/include/low_precision/rt_info/shared_value_attribute.hpp
+++ b/src/common/low_precision_transformations/include/low_precision/rt_info/shared_value_attribute.hpp
@@ -15,8 +15,6 @@
template <class T>
class LP_TRANSFORMATIONS_API SharedAttribute : public ov::RuntimeAttribute {
public:
- virtual ~SharedAttribute() = default;
-
/**
* @ingroup ov_transformation_common_api
* @brief SharedValueAttribute type for shared value attributes.
diff --git a/src/core/include/openvino/core/any.hpp b/src/core/include/openvino/core/any.hpp
index 6f65efb5233..3e41ed51ee9 100644
--- a/src/core/include/openvino/core/any.hpp
+++ b/src/core/include/openvino/core/any.hpp
@@ -536,7 +536,7 @@ class OPENVINO_API Any {
template <class U, class T, class... Others>
U convert_impl() const;
- virtual ~Base() = default;
+ virtual ~Base();
};
template <class T, typename = void>
@@ -611,8 +611,6 @@ class OPENVINO_API Any {
template <typename... Args>
Impl(Args&&... args) : value(std::forward<Args>(args)...) {}
- virtual ~Impl(){};
-
const std::type_info& type_info() const override {
return typeid(T);
}
diff --git a/src/core/include/openvino/core/attribute_adapter.hpp b/src/core/include/openvino/core/attribute_adapter.hpp
index 706d3e9e363..8f00cc6cfd6 100644
--- a/src/core/include/openvino/core/attribute_adapter.hpp
+++ b/src/core/include/openvino/core/attribute_adapter.hpp
@@ -34,7 +34,7 @@ public:
/// \brief type info enables identification of the value accessor, as well as is_type and
/// as_type.
virtual const DiscreteTypeInfo& get_type_info() const = 0;
- virtual ~ValueAccessor() = default;
+ virtual ~ValueAccessor();
virtual void set_as_any(const ov::Any& x) {
OPENVINO_NOT_IMPLEMENTED;
}
diff --git a/src/core/include/openvino/core/attribute_visitor.hpp b/src/core/include/openvino/core/attribute_visitor.hpp
index f1790cba959..35fb5fb0ccd 100644
--- a/src/core/include/openvino/core/attribute_visitor.hpp
+++ b/src/core/include/openvino/core/attribute_visitor.hpp
@@ -56,7 +56,7 @@ class VisitorAdapter;
/// deserialization.
class OPENVINO_API AttributeVisitor {
public:
- virtual ~AttributeVisitor() = default;
+ virtual ~AttributeVisitor();
// Must implement these methods
/// \brief handles all specialized on_adapter methods implemented by the visitor.
///
diff --git a/src/core/include/openvino/core/model.hpp b/src/core/include/openvino/core/model.hpp
index 5733209f492..6ad235062ed 100644
--- a/src/core/include/openvino/core/model.hpp
+++ b/src/core/include/openvino/core/model.hpp
@@ -107,7 +107,7 @@ public:
/// based on traversing the graph from the results and the sinks.
Model(const ov::OutputVector& results, const ov::SinkVector& sinks, const std::string& name = "");
- virtual ~Model() = default;
+ virtual ~Model();
/// Return the number of outputs for this Model.
size_t get_output_size() const;
diff --git a/src/core/include/openvino/core/runtime_attribute.hpp b/src/core/include/openvino/core/runtime_attribute.hpp
index 82b860cc99d..86171a81562 100644
--- a/src/core/include/openvino/core/runtime_attribute.hpp
+++ b/src/core/include/openvino/core/runtime_attribute.hpp
@@ -28,7 +28,7 @@ public:
}
using Ptr = std::shared_ptr<RuntimeAttribute>;
using Base = std::tuple<::ov::RuntimeAttribute>;
- virtual ~RuntimeAttribute() = default;
+ virtual ~RuntimeAttribute();
virtual bool is_copyable() const;
virtual bool is_copyable(const std::shared_ptr<Node>& to) const;
virtual Any init(const std::shared_ptr<Node>& node) const;
diff --git a/src/core/include/openvino/op/util/multi_subgraph_base.hpp b/src/core/include/openvino/op/util/multi_subgraph_base.hpp
index 5f6053acfcd..71ba0ebe4f6 100644
--- a/src/core/include/openvino/op/util/multi_subgraph_base.hpp
+++ b/src/core/include/openvino/op/util/multi_subgraph_base.hpp
@@ -20,7 +20,7 @@ public:
OPENVINO_OP("MultiSubGraphOp", "util", ov::op::Sink);
/// \brief Abstract class describes a connection between a MultiSubGraphOp input and
/// the body.
- class InputDescription {
+ class OPENVINO_API InputDescription {
protected:
///
/// \brief Constructs a new instance.
@@ -34,7 +34,7 @@ public:
public:
using Ptr = std::shared_ptr<InputDescription>;
using type_info_t = DiscreteTypeInfo;
- virtual ~InputDescription() = default;
+ virtual ~InputDescription();
virtual std::shared_ptr<InputDescription> copy() const = 0;
virtual const type_info_t& get_type_info() const = 0;
@@ -45,7 +45,7 @@ public:
/// \brief Abstract class describes how a MultiSubGraphOp output is produced from
/// the body.
- class OutputDescription {
+ class OPENVINO_API OutputDescription {
protected:
///
/// \brief Constructs a new instance.
@@ -59,7 +59,7 @@ public:
public:
using Ptr = std::shared_ptr<OutputDescription>;
using type_info_t = DiscreteTypeInfo;
- virtual ~OutputDescription() = default;
+ virtual ~OutputDescription();
virtual std::shared_ptr<OutputDescription> copy() const = 0;
virtual const type_info_t& get_type_info() const = 0;
diff --git a/src/core/include/openvino/op/util/variable_extension.hpp b/src/core/include/openvino/op/util/variable_extension.hpp
index 924bd97c17f..e4f811afe52 100644
--- a/src/core/include/openvino/op/util/variable_extension.hpp
+++ b/src/core/include/openvino/op/util/variable_extension.hpp
@@ -39,7 +39,7 @@ public:
virtual std::string get_variable_id() const = 0;
protected:
- virtual ~VariableExtension(){};
+ virtual ~VariableExtension();
protected:
std::shared_ptr<Variable> m_variable;
diff --git a/src/core/include/openvino/pass/pass.hpp b/src/core/include/openvino/pass/pass.hpp
index fc019859128..6440114ab9a 100644
--- a/src/core/include/openvino/pass/pass.hpp
+++ b/src/core/include/openvino/pass/pass.hpp
@@ -44,7 +44,7 @@ class OPENVINO_API PassBase {
public:
PassBase();
- virtual ~PassBase() = default;
+ virtual ~PassBase();
/// Check if this pass has all the pass properties.
bool get_property(const PassPropertyMask& prop_mask) const;
diff --git a/src/core/include/openvino/pass/pattern/matcher.hpp b/src/core/include/openvino/pass/pattern/matcher.hpp
index f39b2847029..acf7c85841f 100644
--- a/src/core/include/openvino/pass/pattern/matcher.hpp
+++ b/src/core/include/openvino/pass/pattern/matcher.hpp
@@ -108,7 +108,8 @@ public:
Matcher(std::shared_ptr<Node> pattern_node, const std::string& name);
Matcher(std::shared_ptr<Node> pattern_node, const std::string& name, bool strict_mode);
- virtual ~Matcher() = default;
+ virtual ~Matcher();
+
/// \brief Matches a pattern to \p graph_node
///
/// \param graph_value is an input graph to be matched against
@@ -176,7 +177,7 @@ public:
size_t add_node(Output<Node> node);
- bool virtual match_value(const ov::Output<Node>& pattern_value, const ov::Output<Node>& graph_value);
+ virtual bool match_value(const ov::Output<Node>& pattern_value, const ov::Output<Node>& graph_value);
bool is_strict_mode() {
return m_strict_mode;
diff --git a/src/core/include/openvino/runtime/allocator.hpp b/src/core/include/openvino/runtime/allocator.hpp
index 4180d90b0ce..ae62fb7b290 100644
--- a/src/core/include/openvino/runtime/allocator.hpp
+++ b/src/core/include/openvino/runtime/allocator.hpp
@@ -37,7 +37,7 @@ class OPENVINO_API Allocator {
friend class ov::Tensor;
- struct Base : public std::enable_shared_from_this<Base> {
+ struct OPENVINO_API Base : public std::enable_shared_from_this<Base> {
virtual void* addressof() = 0;
const void* addressof() const {
return const_cast<Base*>(this)->addressof();
@@ -48,7 +48,7 @@ class OPENVINO_API Allocator {
virtual bool is_equal(const Base& other) const = 0;
protected:
- virtual ~Base() = default;
+ virtual ~Base();
};
template <typename A>
diff --git a/src/core/reference/include/openvino/reference/utils/philox_converter.hpp b/src/core/reference/include/openvino/reference/utils/philox_converter.hpp
index 45fbb7d160a..bf6baaff8af 100644
--- a/src/core/reference/include/openvino/reference/utils/philox_converter.hpp
+++ b/src/core/reference/include/openvino/reference/utils/philox_converter.hpp
@@ -19,7 +19,7 @@ class PhiloxConverter {
public:
PhiloxConverter() = delete;
- virtual ~PhiloxConverter(){};
+ virtual ~PhiloxConverter() = default;
/// \brief Returns the number of generated elements per execution
/// based on the requested data type.
diff --git a/src/core/reference/include/openvino/reference/utils/philox_generator.hpp b/src/core/reference/include/openvino/reference/utils/philox_generator.hpp
index f38a947b9de..81ea89acf0c 100644
--- a/src/core/reference/include/openvino/reference/utils/philox_generator.hpp
+++ b/src/core/reference/include/openvino/reference/utils/philox_generator.hpp
@@ -30,7 +30,7 @@ class PhiloxGenerator {
public:
PhiloxGenerator() = delete;
- virtual ~PhiloxGenerator(){};
+ virtual ~PhiloxGenerator() = default;
/// @brief Get a set of 4 random 32-bit unsigned integers based on the seed(s).
/// @return A vector with a random set of 4 32-bit unsigned integers.
diff --git a/src/core/src/any.cpp b/src/core/src/any.cpp
index 1637a139680..4dd9ce40af5 100644
--- a/src/core/src/any.cpp
+++ b/src/core/src/any.cpp
@@ -30,6 +30,8 @@ bool util::equal(std::type_index lhs, std::type_index rhs) {
return result;
}
+Any::Base::~Base() = default;
+
bool Any::Base::is(const std::type_info& other) const {
return util::equal(type_info(), other);
}
diff --git a/src/core/src/attribute_visitor.cpp b/src/core/src/attribute_visitor.cpp
index 63a59591e37..991e549fa83 100644
--- a/src/core/src/attribute_visitor.cpp
+++ b/src/core/src/attribute_visitor.cpp
@@ -10,6 +10,10 @@
using namespace std;
+ov::ValueAccessor<void>::~ValueAccessor() = default;
+
+ov::AttributeVisitor::~AttributeVisitor() = default;
+
void ov::AttributeVisitor::start_structure(const string& name) {
m_context.push_back(name);
}
diff --git a/src/core/src/model.cpp b/src/core/src/model.cpp
index c9a25676b9c..44ac9c9177d 100644
--- a/src/core/src/model.cpp
+++ b/src/core/src/model.cpp
@@ -221,6 +221,8 @@ ov::Model::Model(const ov::OutputVector& results, const ov::SinkVector& sinks, c
ov::Model::Model(const OutputVector& results, const string& name) : Model(results, ov::SinkVector{}, name) {}
+ov::Model::~Model() = default;
+
void ov::Model::prerequirements(bool detect_variables, bool detect_parameters) {
OV_ITT_SCOPED_TASK(ov::itt::domains::core, "Model::prerequirements");
diff --git a/src/core/src/op/util/multi_subgraph_base.cpp b/src/core/src/op/util/multi_subgraph_base.cpp
index 6b7f78afcff..5e5f84d8ff7 100644
--- a/src/core/src/op/util/multi_subgraph_base.cpp
+++ b/src/core/src/op/util/multi_subgraph_base.cpp
@@ -8,10 +8,14 @@ ov::op::util::MultiSubGraphOp::InputDescription::InputDescription(uint64_t input
: m_input_index(input_index),
m_body_parameter_index(body_parameter_index) {}
+ov::op::util::MultiSubGraphOp::InputDescription::~InputDescription() = default;
+
ov::op::util::MultiSubGraphOp::OutputDescription::OutputDescription(uint64_t body_value_index, uint64_t output_index)
: m_body_value_index(body_value_index),
m_output_index(output_index) {}
+ov::op::util::MultiSubGraphOp::OutputDescription::~OutputDescription() = default;
+
ov::op::util::MultiSubGraphOp::SliceInputDescription::SliceInputDescription(uint64_t input_index,
uint64_t body_parameter_index,
int64_t start,
diff --git a/src/core/src/op/util/variable_extension.cpp b/src/core/src/op/util/variable_extension.cpp
new file mode 100644
index 00000000000..b49055dbccd
--- /dev/null
+++ b/src/core/src/op/util/variable_extension.cpp
@@ -0,0 +1,9 @@
+// Copyright (C) 2018-2025 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#include "openvino/op/util/variable_extension.hpp"
+
+using namespace ov::op::util;
+
+VariableExtension::~VariableExtension() = default;
diff --git a/src/core/src/pass/pass.cpp b/src/core/src/pass/pass.cpp
index 73a3f7261e5..420b8d27298 100644
--- a/src/core/src/pass/pass.cpp
+++ b/src/core/src/pass/pass.cpp
@@ -16,6 +16,8 @@ using namespace std;
ov::pass::PassBase::PassBase() : m_property(), m_name(), m_pass_config(std::make_shared<PassConfig>()) {}
+ov::pass::PassBase::~PassBase() = default;
+
bool ov::pass::PassBase::get_property(const PassPropertyMask& prop) const {
return m_property.is_set(prop);
}
diff --git a/src/core/src/pattern/matcher.cpp b/src/core/src/pattern/matcher.cpp
index 54e153ebbaa..3681b933ceb 100644
--- a/src/core/src/pattern/matcher.cpp
+++ b/src/core/src/pattern/matcher.cpp
@@ -37,6 +37,8 @@ Matcher::Matcher(std::shared_ptr<Node> pattern_node, const std::string& name)
Matcher::Matcher(std::shared_ptr<Node> pattern_node, const std::string& name, bool strict_mode)
: Matcher(make_node_output(pattern_node), name, strict_mode) {}
+Matcher::~Matcher() = default;
+
MatcherState::~MatcherState() {
if (m_restore) {
if (!m_matcher->m_matched_list.empty()) {
diff --git a/src/core/src/runtime/allocator.cpp b/src/core/src/runtime/allocator.cpp
index 2a1d8a79ad3..729a61d9b0d 100644
--- a/src/core/src/runtime/allocator.cpp
+++ b/src/core/src/runtime/allocator.cpp
@@ -45,6 +45,8 @@ struct DefaultAllocator {
}
};
+Allocator::Base::~Base() = default;
+
Allocator::Allocator() : Allocator{DefaultAllocator{}} {}
Allocator::~Allocator() {
diff --git a/src/core/src/runtime_attribute.cpp b/src/core/src/runtime_attribute.cpp
index e936afd6b29..cf67b09cb2b 100644
--- a/src/core/src/runtime_attribute.cpp
+++ b/src/core/src/runtime_attribute.cpp
@@ -9,6 +9,8 @@
namespace ov {
+RuntimeAttribute::~RuntimeAttribute() = default;
+
std::string RuntimeAttribute::to_string() const {
return {};
}
diff --git a/src/frontends/common/include/openvino/frontend/decoder.hpp b/src/frontends/common/include/openvino/frontend/decoder.hpp
index 46afa8aee1c..ea13a714cb1 100644
--- a/src/frontends/common/include/openvino/frontend/decoder.hpp
+++ b/src/frontends/common/include/openvino/frontend/decoder.hpp
@@ -49,9 +49,9 @@ struct Union;
} // namespace type
/// Plays a role of node, block and module decoder
-class IDecoder {
+class FRONTEND_API IDecoder {
public:
- virtual ~IDecoder() = default;
+ virtual ~IDecoder();
};
class FRONTEND_API DecoderBase : public IDecoder {
@@ -82,9 +82,6 @@ public:
/// \brief Get node name
virtual const std::string& get_op_name() const = 0;
-
- /// \brief Destructor
- virtual ~DecoderBase();
};
} // namespace frontend
diff --git a/src/frontends/common/include/openvino/frontend/graph_iterator.hpp b/src/frontends/common/include/openvino/frontend/graph_iterator.hpp
index 054173f1f41..e199ece6d06 100644
--- a/src/frontends/common/include/openvino/frontend/graph_iterator.hpp
+++ b/src/frontends/common/include/openvino/frontend/graph_iterator.hpp
@@ -34,9 +34,6 @@ public:
/// \brief Return a pointer to a decoder of the current node
virtual std::shared_ptr<DecoderBase> get_decoder() const = 0;
- /// \brief Destructor
- virtual ~GraphIterator() = default;
-
/// \brief Checks if the main model graph contains a function of the requested name in the library
/// Returns GraphIterator to this function and nullptr, if it does not exist
virtual std::shared_ptr<GraphIterator> get_body_graph_iterator(const std::string& func_name) const = 0;
diff --git a/src/frontends/common/include/openvino/frontend/input_model.hpp b/src/frontends/common/include/openvino/frontend/input_model.hpp
index f679a28d41a..5ea01dba5ea 100644
--- a/src/frontends/common/include/openvino/frontend/input_model.hpp
+++ b/src/frontends/common/include/openvino/frontend/input_model.hpp
@@ -51,7 +51,7 @@ public:
InputModel& operator=(const InputModel&) = delete;
InputModel& operator=(InputModel&&) = delete;
- virtual ~InputModel() = default;
+ virtual ~InputModel();
///// Searching for places /////
diff --git a/src/frontends/common/include/openvino/frontend/node_context.hpp b/src/frontends/common/include/openvino/frontend/node_context.hpp
index 2fb607f3644..9d6bb787892 100644
--- a/src/frontends/common/include/openvino/frontend/node_context.hpp
+++ b/src/frontends/common/include/openvino/frontend/node_context.hpp
@@ -18,7 +18,7 @@ class FRONTEND_API NodeContext {
public:
// TODO: Why this ctor is explicit when get_op_type is virtual so m_op_type looks to be a custom implementation
explicit NodeContext(const std::string& op_type) : m_op_type(op_type) {}
- virtual ~NodeContext() = default;
+ virtual ~NodeContext();
/// \brief Returns a number of inputs
virtual size_t get_input_size() const {
diff --git a/src/frontends/common/include/openvino/frontend/place.hpp b/src/frontends/common/include/openvino/frontend/place.hpp
index ecaed4cd93b..be661149dc0 100644
--- a/src/frontends/common/include/openvino/frontend/place.hpp
+++ b/src/frontends/common/include/openvino/frontend/place.hpp
@@ -61,7 +61,7 @@ class FRONTEND_API Place {
public:
typedef std::shared_ptr<Place> Ptr;
- virtual ~Place() = 0;
+ virtual ~Place();
/// \brief All associated names (synonyms) that identify this place in the graph in a
/// framework specific way
diff --git a/src/frontends/common/src/decoder.cpp b/src/frontends/common/src/decoder.cpp
index b9f4b27da2c..f140b9e6430 100644
--- a/src/frontends/common/src/decoder.cpp
+++ b/src/frontends/common/src/decoder.cpp
@@ -6,4 +6,4 @@
using namespace ov::frontend;
-DecoderBase::~DecoderBase() = default;
\ No newline at end of file
+IDecoder::~IDecoder() = default;
diff --git a/src/frontends/common/src/input_model.cpp b/src/frontends/common/src/input_model.cpp
index f2c52f2eb69..11d474aaec4 100644
--- a/src/frontends/common/src/input_model.cpp
+++ b/src/frontends/common/src/input_model.cpp
@@ -12,6 +12,8 @@
using namespace ov;
using namespace ov::frontend;
+InputModel::~InputModel() = default;
+
std::vector<Place::Ptr> InputModel::get_inputs() const {
if (!m_actual) {
return {};
diff --git a/src/frontends/common/src/node_context.cpp b/src/frontends/common/src/node_context.cpp
new file mode 100644
index 00000000000..91c8c8c911c
--- /dev/null
+++ b/src/frontends/common/src/node_context.cpp
@@ -0,0 +1,9 @@
+// Copyright (C) 2018-2025 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#include "openvino/frontend/node_context.hpp"
+
+using namespace ov::frontend;
+
+NodeContext::~NodeContext() = default;
diff --git a/src/frontends/common/src/variable.cpp b/src/frontends/common/src/variable.cpp
index 9c82520d568..b0fb3028008 100644
--- a/src/frontends/common/src/variable.cpp
+++ b/src/frontends/common/src/variable.cpp
@@ -6,4 +6,4 @@
using namespace ov::frontend;
-Variable::~Variable(){};
+Variable::~Variable() = default;