Skip to content

Commit dd1985e

Browse files
yoneymeta-codesync[bot]
authored andcommitted
Make Ref's move-ctor/move-assignment noexcept
Summary: Without noexcept, STL may use the copy constructor instead (unless the copy constructor is not accessible, but a potentially throwing move constructor is, in which case the strong exception guarantee is waived). Reviewed By: praihan Differential Revision: D83781391 fbshipit-source-id: f09efa828fb8a1b986b1aebd83245d8555384e45
1 parent 875b02b commit dd1985e

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

cinderx/.clang-tidy

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,7 @@ InheritParentConfig: true
66

77
Checks: '
88
-facebook-hte-NullableReturn,
9+
-facebook-hte-GlibcRegexIsAwful,
10+
-facebook-hte-StdRegexIsAwful,
911
modernize-raw-string-literal,
1012
'

cinderx/Common/ref.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ class Ref : public RefBase<T> {
174174
ptr_ = nullptr;
175175
}
176176

177-
Ref(Ref&& other) {
177+
Ref(Ref&& other) noexcept {
178178
ptr_ = other.ptr_;
179179
other.ptr_ = nullptr;
180180
}
@@ -185,7 +185,7 @@ class Ref : public RefBase<T> {
185185
ptr_ = reinterpret_cast<T*>(other.release());
186186
}
187187

188-
Ref& operator=(Ref&& other) {
188+
Ref& operator=(Ref&& other) noexcept {
189189
if (this == &other) {
190190
return *this;
191191
}

0 commit comments

Comments
 (0)