Skip to content

Commit deb6e54

Browse files
committed
fix review
1 parent bb42e54 commit deb6e54

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

clang-tools-extra/clang-tidy/cppcoreguidelines/AvoidConstOrRefDataMembersCheck.cpp

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,8 @@ static bool hasCopyConstructor(CXXRecordDecl const &Node) {
2020
// unresolved
2121
for (CXXBaseSpecifier const &BS : Node.bases()) {
2222
CXXRecordDecl const *BRD = BS.getType()->getAsCXXRecordDecl();
23-
if (BRD != nullptr)
24-
if (!hasCopyConstructor(*BRD))
25-
return false;
23+
if (BRD != nullptr && !hasCopyConstructor(*BRD))
24+
return false;
2625
}
2726
}
2827
if (Node.hasSimpleCopyConstructor())
@@ -39,9 +38,8 @@ static bool hasMoveConstructor(CXXRecordDecl const &Node) {
3938
// unresolved
4039
for (CXXBaseSpecifier const &BS : Node.bases()) {
4140
CXXRecordDecl const *BRD = BS.getType()->getAsCXXRecordDecl();
42-
if (BRD != nullptr)
43-
if (!hasMoveConstructor(*BRD))
44-
return false;
41+
if (BRD != nullptr && !hasMoveConstructor(*BRD))
42+
return false;
4543
}
4644
}
4745
if (Node.hasSimpleMoveConstructor())
@@ -58,9 +56,8 @@ static bool hasCopyAssignment(CXXRecordDecl const &Node) {
5856
// unresolved
5957
for (CXXBaseSpecifier const &BS : Node.bases()) {
6058
CXXRecordDecl const *BRD = BS.getType()->getAsCXXRecordDecl();
61-
if (BRD != nullptr)
62-
if (!hasCopyAssignment(*BRD))
63-
return false;
59+
if (BRD != nullptr && !hasCopyAssignment(*BRD))
60+
return false;
6461
}
6562
}
6663
if (Node.hasSimpleCopyAssignment())
@@ -77,9 +74,8 @@ static bool hasMoveAssignment(CXXRecordDecl const &Node) {
7774
// unresolved
7875
for (CXXBaseSpecifier const &BS : Node.bases()) {
7976
CXXRecordDecl const *BRD = BS.getType()->getAsCXXRecordDecl();
80-
if (BRD != nullptr)
81-
if (!hasMoveAssignment(*BRD))
82-
return false;
77+
if (BRD != nullptr && !hasMoveAssignment(*BRD))
78+
return false;
8379
}
8480
}
8581
if (Node.hasSimpleMoveAssignment())

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ Changes in existing checks
197197

198198
- Improved :doc:`cppcoreguidelines-avoid-const-or-ref-data-members
199199
<clang-tidy/checks/cppcoreguidelines/avoid-const-or-ref-data-members>` check to
200-
avoid false positive when detecting templated class with inheritance.
200+
avoid false positives when detecting a templated class with inheritance.
201201

202202
- Improved :doc:`cppcoreguidelines-init-variables
203203
<clang-tidy/checks/cppcoreguidelines/init-variables>` check by fixing the

0 commit comments

Comments
 (0)