Skip to content

Commit

Permalink
[XPTI] Follow rule of three in XPTI headers (#16123)
Browse files Browse the repository at this point in the history
  • Loading branch information
ayylol authored Nov 22, 2024
1 parent 925f6d3 commit 53490a3
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion xpti/include/xpti/xpti_trace_framework.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,8 @@ class SpinLock {
struct finally {
std::function<void()> MFunc;

finally(const finally &) = delete;
finally &operator=(const finally &) = delete;
~finally() {
if (xptiTraceEnabled())
MFunc();
Expand Down Expand Up @@ -663,6 +665,11 @@ class stash_tuple {
(xptiStashTuple(key, value) == xpti::result_t::XPTI_RESULT_SUCCESS);
}

// Copy and copy assignment are deleted since we dont want to stash the same
// key-value pair multiple times
stash_tuple(const stash_tuple &) = delete;
stash_tuple &operator=(const stash_tuple &) = delete;

/// @brief Destroys the stash_tuple object and unstashes the key-value pair if
/// it was stashed successfully earlier.
///
Expand Down Expand Up @@ -734,6 +741,8 @@ class uid_object_t {
MUId.instance = 0;
};

~uid_object_t() = default;

/// @brief Copy constructor for creating a uid_object_t object as a copy of
/// another.
///
Expand Down Expand Up @@ -1613,6 +1622,10 @@ class tracepoint_t {
}
}
}

tracepoint_t(const tracepoint_t &) = delete;
tracepoint_t &operator=(const tracepoint_t &) = delete;

~tracepoint_t() {
// If tracing is not enabled, don't do anything
if (!xptiTraceEnabled())
Expand Down Expand Up @@ -1779,4 +1792,4 @@ class tracepoint_t {
///
/// @param self A pointer to the current function.
///
#define XPTI_USE_TRACE_SCOPE() xpti::framework::tracepoint_scope_t TP(true);
#define XPTI_USE_TRACE_SCOPE() xpti::framework::tracepoint_scope_t TP(true);

0 comments on commit 53490a3

Please sign in to comment.