Skip to content

Commit 53490a3

Browse files
authored
[XPTI] Follow rule of three in XPTI headers (#16123)
1 parent 925f6d3 commit 53490a3

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

xpti/include/xpti/xpti_trace_framework.hpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,8 @@ class SpinLock {
353353
struct finally {
354354
std::function<void()> MFunc;
355355

356+
finally(const finally &) = delete;
357+
finally &operator=(const finally &) = delete;
356358
~finally() {
357359
if (xptiTraceEnabled())
358360
MFunc();
@@ -663,6 +665,11 @@ class stash_tuple {
663665
(xptiStashTuple(key, value) == xpti::result_t::XPTI_RESULT_SUCCESS);
664666
}
665667

668+
// Copy and copy assignment are deleted since we dont want to stash the same
669+
// key-value pair multiple times
670+
stash_tuple(const stash_tuple &) = delete;
671+
stash_tuple &operator=(const stash_tuple &) = delete;
672+
666673
/// @brief Destroys the stash_tuple object and unstashes the key-value pair if
667674
/// it was stashed successfully earlier.
668675
///
@@ -734,6 +741,8 @@ class uid_object_t {
734741
MUId.instance = 0;
735742
};
736743

744+
~uid_object_t() = default;
745+
737746
/// @brief Copy constructor for creating a uid_object_t object as a copy of
738747
/// another.
739748
///
@@ -1613,6 +1622,10 @@ class tracepoint_t {
16131622
}
16141623
}
16151624
}
1625+
1626+
tracepoint_t(const tracepoint_t &) = delete;
1627+
tracepoint_t &operator=(const tracepoint_t &) = delete;
1628+
16161629
~tracepoint_t() {
16171630
// If tracing is not enabled, don't do anything
16181631
if (!xptiTraceEnabled())
@@ -1779,4 +1792,4 @@ class tracepoint_t {
17791792
///
17801793
/// @param self A pointer to the current function.
17811794
///
1782-
#define XPTI_USE_TRACE_SCOPE() xpti::framework::tracepoint_scope_t TP(true);
1795+
#define XPTI_USE_TRACE_SCOPE() xpti::framework::tracepoint_scope_t TP(true);

0 commit comments

Comments
 (0)