Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
pybind11
Commits
b491b465
Commit
b491b465
authored
Sep 10, 2020
by
Henry Schreiner
Committed by
Henry Schreiner
Sep 15, 2020
Browse files
style: clang-tidy: modernize-use-equals-default
parent
b342c373
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
17 additions
and
15 deletions
+17
-15
.clang-tidy
.clang-tidy
+1
-0
include/pybind11/attr.h
include/pybind11/attr.h
+3
-2
include/pybind11/buffer_info.h
include/pybind11/buffer_info.h
+1
-1
include/pybind11/cast.h
include/pybind11/cast.h
+1
-1
include/pybind11/detail/common.h
include/pybind11/detail/common.h
+1
-1
include/pybind11/pybind11.h
include/pybind11/pybind11.h
+1
-1
tests/test_class.cpp
tests/test_class.cpp
+3
-3
tests/test_copy_move.cpp
tests/test_copy_move.cpp
+2
-2
tests/test_smart_ptr.cpp
tests/test_smart_ptr.cpp
+1
-1
tests/test_virtual_functions.cpp
tests/test_virtual_functions.cpp
+3
-3
No files found.
.clang-tidy
View file @
b491b465
...
@@ -6,6 +6,7 @@ llvm-namespace-comment,
...
@@ -6,6 +6,7 @@ llvm-namespace-comment,
modernize-use-override,
modernize-use-override,
readability-container-size-empty,
readability-container-size-empty,
modernize-use-using,
modernize-use-using,
modernize-use-equals-default,
'
'
HeaderFilterRegex: 'pybind11/.*h'
HeaderFilterRegex: 'pybind11/.*h'
include/pybind11/attr.h
View file @
b491b465
...
@@ -40,8 +40,9 @@ struct sibling { handle value; sibling(const handle &value) : value(value.ptr())
...
@@ -40,8 +40,9 @@ struct sibling { handle value; sibling(const handle &value) : value(value.ptr())
/// Annotation indicating that a class derives from another given type
/// Annotation indicating that a class derives from another given type
template
<
typename
T
>
struct
base
{
template
<
typename
T
>
struct
base
{
PYBIND11_DEPRECATED
(
"base<T>() was deprecated in favor of specifying 'T' as a template argument to class_"
)
PYBIND11_DEPRECATED
(
"base<T>() was deprecated in favor of specifying 'T' as a template argument to class_"
)
base
()
{
}
base
()
{
}
// NOLINT(modernize-use-equals-default): breaks MSVC 2015 when adding an attribute
};
};
/// Keep patient alive while nurse lives
/// Keep patient alive while nurse lives
...
@@ -61,7 +62,7 @@ struct metaclass {
...
@@ -61,7 +62,7 @@ struct metaclass {
handle
value
;
handle
value
;
PYBIND11_DEPRECATED
(
"py::metaclass() is no longer required. It's turned on by default now."
)
PYBIND11_DEPRECATED
(
"py::metaclass() is no longer required. It's turned on by default now."
)
metaclass
()
{
}
metaclass
()
{
}
// NOLINT(modernize-use-equals-default): breaks MSVC 2015 when adding an attribute
/// Override pybind11's default metaclass
/// Override pybind11's default metaclass
explicit
metaclass
(
handle
value
)
:
value
(
value
)
{
}
explicit
metaclass
(
handle
value
)
:
value
(
value
)
{
}
...
...
include/pybind11/buffer_info.h
View file @
b491b465
...
@@ -24,7 +24,7 @@ struct buffer_info {
...
@@ -24,7 +24,7 @@ struct buffer_info {
std
::
vector
<
ssize_t
>
strides
;
// Number of bytes between adjacent entries (for each per dimension)
std
::
vector
<
ssize_t
>
strides
;
// Number of bytes between adjacent entries (for each per dimension)
bool
readonly
=
false
;
// flag to indicate if the underlying storage may be written to
bool
readonly
=
false
;
// flag to indicate if the underlying storage may be written to
buffer_info
()
{
}
buffer_info
()
=
default
;
buffer_info
(
void
*
ptr
,
ssize_t
itemsize
,
const
std
::
string
&
format
,
ssize_t
ndim
,
buffer_info
(
void
*
ptr
,
ssize_t
itemsize
,
const
std
::
string
&
format
,
ssize_t
ndim
,
detail
::
any_container
<
ssize_t
>
shape_in
,
detail
::
any_container
<
ssize_t
>
strides_in
,
bool
readonly
=
false
)
detail
::
any_container
<
ssize_t
>
shape_in
,
detail
::
any_container
<
ssize_t
>
strides_in
,
bool
readonly
=
false
)
...
...
include/pybind11/cast.h
View file @
b491b465
...
@@ -220,7 +220,7 @@ struct value_and_holder {
...
@@ -220,7 +220,7 @@ struct value_and_holder {
{}
{}
// Default constructor (used to signal a value-and-holder not found by get_value_and_holder())
// Default constructor (used to signal a value-and-holder not found by get_value_and_holder())
value_and_holder
()
{}
value_and_holder
()
=
default
;
// Used for past-the-end iterator
// Used for past-the-end iterator
value_and_holder
(
size_t
index
)
:
index
{
index
}
{}
value_and_holder
(
size_t
index
)
:
index
{
index
}
{}
...
...
include/pybind11/detail/common.h
View file @
b491b465
...
@@ -761,7 +761,7 @@ struct nodelete { template <typename T> void operator()(T*) { } };
...
@@ -761,7 +761,7 @@ struct nodelete { template <typename T> void operator()(T*) { } };
PYBIND11_NAMESPACE_BEGIN
(
detail
)
PYBIND11_NAMESPACE_BEGIN
(
detail
)
template
<
typename
...
Args
>
template
<
typename
...
Args
>
struct
overload_cast_impl
{
struct
overload_cast_impl
{
constexpr
overload_cast_impl
()
{}
// MSVC 2015 needs this
constexpr
overload_cast_impl
()
{}
;
//
NOLINT(modernize-use-equals-default):
MSVC 2015 needs this
template
<
typename
Return
>
template
<
typename
Return
>
constexpr
auto
operator
()(
Return
(
*
pf
)(
Args
...))
const
noexcept
constexpr
auto
operator
()(
Return
(
*
pf
)(
Args
...))
const
noexcept
...
...
include/pybind11/pybind11.h
View file @
b491b465
...
@@ -55,7 +55,7 @@ PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
...
@@ -55,7 +55,7 @@ PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
/// Wraps an arbitrary C++ function/method/lambda function/.. into a callable Python object
/// Wraps an arbitrary C++ function/method/lambda function/.. into a callable Python object
class
cpp_function
:
public
function
{
class
cpp_function
:
public
function
{
public:
public:
cpp_function
()
{
}
cpp_function
()
=
default
;
cpp_function
(
std
::
nullptr_t
)
{
}
cpp_function
(
std
::
nullptr_t
)
{
}
/// Construct a cpp_function from a vanilla function pointer
/// Construct a cpp_function from a vanilla function pointer
...
...
tests/test_class.cpp
View file @
b491b465
...
@@ -103,7 +103,7 @@ TEST_SUBMODULE(class_, m) {
...
@@ -103,7 +103,7 @@ TEST_SUBMODULE(class_, m) {
BaseClass
()
=
default
;
BaseClass
()
=
default
;
BaseClass
(
const
BaseClass
&
)
=
default
;
BaseClass
(
const
BaseClass
&
)
=
default
;
BaseClass
(
BaseClass
&&
)
=
default
;
BaseClass
(
BaseClass
&&
)
=
default
;
virtual
~
BaseClass
()
{}
virtual
~
BaseClass
()
=
default
;
};
};
struct
DerivedClass1
:
BaseClass
{
};
struct
DerivedClass1
:
BaseClass
{
};
struct
DerivedClass2
:
BaseClass
{
};
struct
DerivedClass2
:
BaseClass
{
};
...
@@ -353,7 +353,7 @@ TEST_SUBMODULE(class_, m) {
...
@@ -353,7 +353,7 @@ TEST_SUBMODULE(class_, m) {
// test_reentrant_implicit_conversion_failure
// test_reentrant_implicit_conversion_failure
// #1035: issue with runaway reentrant implicit conversion
// #1035: issue with runaway reentrant implicit conversion
struct
BogusImplicitConversion
{
struct
BogusImplicitConversion
{
BogusImplicitConversion
(
const
BogusImplicitConversion
&
)
{
}
BogusImplicitConversion
(
const
BogusImplicitConversion
&
)
=
default
;
};
};
py
::
class_
<
BogusImplicitConversion
>
(
m
,
"BogusImplicitConversion"
)
py
::
class_
<
BogusImplicitConversion
>
(
m
,
"BogusImplicitConversion"
)
...
@@ -407,7 +407,7 @@ TEST_SUBMODULE(class_, m) {
...
@@ -407,7 +407,7 @@ TEST_SUBMODULE(class_, m) {
py
::
class_
<
IsNonFinalFinal
>
(
m
,
"IsNonFinalFinal"
,
py
::
is_final
());
py
::
class_
<
IsNonFinalFinal
>
(
m
,
"IsNonFinalFinal"
,
py
::
is_final
());
struct
PyPrintDestructor
{
struct
PyPrintDestructor
{
PyPrintDestructor
()
{}
PyPrintDestructor
()
=
default
;
~
PyPrintDestructor
()
{
~
PyPrintDestructor
()
{
py
::
print
(
"Print from destructor"
);
py
::
print
(
"Print from destructor"
);
}
}
...
...
tests/test_copy_move.cpp
View file @
b491b465
...
@@ -19,14 +19,14 @@ struct empty {
...
@@ -19,14 +19,14 @@ struct empty {
};
};
struct
lacking_copy_ctor
:
public
empty
<
lacking_copy_ctor
>
{
struct
lacking_copy_ctor
:
public
empty
<
lacking_copy_ctor
>
{
lacking_copy_ctor
()
{}
lacking_copy_ctor
()
=
default
;
lacking_copy_ctor
(
const
lacking_copy_ctor
&
other
)
=
delete
;
lacking_copy_ctor
(
const
lacking_copy_ctor
&
other
)
=
delete
;
};
};
template
<
>
lacking_copy_ctor
empty
<
lacking_copy_ctor
>::
instance_
=
{};
template
<
>
lacking_copy_ctor
empty
<
lacking_copy_ctor
>::
instance_
=
{};
struct
lacking_move_ctor
:
public
empty
<
lacking_move_ctor
>
{
struct
lacking_move_ctor
:
public
empty
<
lacking_move_ctor
>
{
lacking_move_ctor
()
{}
lacking_move_ctor
()
=
default
;
lacking_move_ctor
(
const
lacking_move_ctor
&
other
)
=
delete
;
lacking_move_ctor
(
const
lacking_move_ctor
&
other
)
=
delete
;
lacking_move_ctor
(
lacking_move_ctor
&&
other
)
=
delete
;
lacking_move_ctor
(
lacking_move_ctor
&&
other
)
=
delete
;
};
};
...
...
tests/test_smart_ptr.cpp
View file @
b491b465
...
@@ -339,7 +339,7 @@ TEST_SUBMODULE(smart_ptr, m) {
...
@@ -339,7 +339,7 @@ TEST_SUBMODULE(smart_ptr, m) {
// test_shared_ptr_gc
// test_shared_ptr_gc
// #187: issue involving std::shared_ptr<> return value policy & garbage collection
// #187: issue involving std::shared_ptr<> return value policy & garbage collection
struct
ElementBase
{
struct
ElementBase
{
virtual
~
ElementBase
()
{
}
/* Force creation of virtual table */
virtual
~
ElementBase
()
=
default
;
/* Force creation of virtual table */
ElementBase
()
=
default
;
ElementBase
()
=
default
;
ElementBase
(
const
ElementBase
&
)
=
delete
;
ElementBase
(
const
ElementBase
&
)
=
delete
;
};
};
...
...
tests/test_virtual_functions.cpp
View file @
b491b465
...
@@ -129,7 +129,7 @@ private:
...
@@ -129,7 +129,7 @@ private:
class
NCVirt
{
class
NCVirt
{
public:
public:
virtual
~
NCVirt
()
{
}
virtual
~
NCVirt
()
=
default
;
NCVirt
()
=
default
;
NCVirt
()
=
default
;
NCVirt
(
const
NCVirt
&
)
=
delete
;
NCVirt
(
const
NCVirt
&
)
=
delete
;
virtual
NonCopyable
get_noncopyable
(
int
a
,
int
b
)
{
return
NonCopyable
(
a
,
b
);
}
virtual
NonCopyable
get_noncopyable
(
int
a
,
int
b
)
{
return
NonCopyable
(
a
,
b
);
}
...
@@ -227,7 +227,7 @@ TEST_SUBMODULE(virtual_functions, m) {
...
@@ -227,7 +227,7 @@ TEST_SUBMODULE(virtual_functions, m) {
struct
A
{
struct
A
{
A
()
=
default
;
A
()
=
default
;
A
(
const
A
&
)
=
delete
;
A
(
const
A
&
)
=
delete
;
virtual
~
A
()
{}
virtual
~
A
()
=
default
;
virtual
void
f
()
{
py
::
print
(
"A.f()"
);
}
virtual
void
f
()
{
py
::
print
(
"A.f()"
);
}
};
};
...
@@ -255,7 +255,7 @@ TEST_SUBMODULE(virtual_functions, m) {
...
@@ -255,7 +255,7 @@ TEST_SUBMODULE(virtual_functions, m) {
struct
A2
{
struct
A2
{
A2
()
=
default
;
A2
()
=
default
;
A2
(
const
A2
&
)
=
delete
;
A2
(
const
A2
&
)
=
delete
;
virtual
~
A2
()
{}
virtual
~
A2
()
=
default
;
virtual
void
f
()
{
py
::
print
(
"A2.f()"
);
}
virtual
void
f
()
{
py
::
print
(
"A2.f()"
);
}
};
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment