-
Notifications
You must be signed in to change notification settings - Fork 798
[XPTI] Follow rule of three in XPTI headers #16123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
5218d27
XPTI rule of three
ayylol 8f21bd0
Remove finally default constructor
ayylol ad6e35d
Delete copy constructor/assignment for tracepoint_t
ayylol 2c77d17
clang format
ayylol df0172d
delete finally copy ctor/assignment op
ayylol 9aa2d7e
Merge branch 'sycl' into xpti-rule-of-three
ayylol File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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(); | ||
|
|
@@ -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. | ||
| /// | ||
|
|
@@ -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. | ||
| /// | ||
|
|
@@ -1613,6 +1622,10 @@ class tracepoint_t { | |
| } | ||
| } | ||
| } | ||
|
|
||
| tracepoint_t(const tracepoint_t &) = delete; | ||
| tracepoint_t &operator=(const tracepoint_t &) = delete; | ||
|
Comment on lines
+1626
to
+1627
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if a |
||
|
|
||
| ~tracepoint_t() { | ||
| // If tracing is not enabled, don't do anything | ||
| if (!xptiTraceEnabled()) | ||
|
|
@@ -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); | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only has one data member to deal with (
xpti::uid128_t MUId), so default destructor should be fine