Skip to content

Commit d22bfa4

Browse files
author
Tom James
committed
Remove braces
1 parent e915796 commit d22bfa4

File tree

1 file changed

+13
-24
lines changed

1 file changed

+13
-24
lines changed

clang-tools-extra/clang-tidy/bugprone/MethodHidingCheck.cpp

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -30,31 +30,23 @@ bool sameBasicType(ParmVarDecl const *Lhs, ParmVarDecl const *Rhs) {
3030
}
3131

3232
bool namesCollide(CXXMethodDecl const &Lhs, CXXMethodDecl const &Rhs) {
33-
if (Lhs.getNameAsString() != Rhs.getNameAsString()) {
33+
if (Lhs.getNameAsString() != Rhs.getNameAsString())
3434
return false;
35-
}
36-
if (Lhs.isConst() != Rhs.isConst()) {
35+
if (Lhs.isConst() != Rhs.isConst())
3736
return false;
38-
}
39-
if (Lhs.getNumParams() != Rhs.getNumParams()) {
37+
if (Lhs.getNumParams() != Rhs.getNumParams())
4038
return false;
41-
}
42-
for (unsigned int It = 0; It < Lhs.getNumParams(); ++It) {
43-
if (!sameBasicType(Lhs.getParamDecl(It), Rhs.getParamDecl(It))) {
39+
for (unsigned int It = 0; It < Lhs.getNumParams(); ++It)
40+
if (!sameBasicType(Lhs.getParamDecl(It), Rhs.getParamDecl(It)))
4441
return false;
45-
}
46-
}
4742
// Templates are not handled yet
48-
if (Lhs.isTemplated() || Rhs.isTemplated()) {
43+
if (Lhs.isTemplated() || Rhs.isTemplated())
4944
return false;
50-
}
51-
if (Lhs.isTemplateInstantiation() || Rhs.isTemplateInstantiation()) {
45+
if (Lhs.isTemplateInstantiation() || Rhs.isTemplateInstantiation())
5246
return false;
53-
}
5447
if (Lhs.isFunctionTemplateSpecialization() ||
55-
Rhs.isFunctionTemplateSpecialization()) {
48+
Rhs.isFunctionTemplateSpecialization())
5649
return false;
57-
}
5850
return true;
5951
}
6052

@@ -68,15 +60,13 @@ AST_MATCHER(CXXMethodDecl, nameCollidesWithMethodInBase) {
6860
Stack.pop();
6961

7062
if (CurrentBaseSpec->getAccessSpecifier() ==
71-
clang::AccessSpecifier::AS_private) {
63+
clang::AccessSpecifier::AS_private)
7264
continue;
73-
}
7465

7566
const auto *CurrentRecord =
7667
CurrentBaseSpec->getType()->getAsCXXRecordDecl();
77-
if (!CurrentRecord) {
68+
if (!CurrentRecord)
7869
continue;
79-
}
8070

8171
for (auto const &BaseMethod : CurrentRecord->methods()) {
8272
if (namesCollide(*BaseMethod, Node)) {
@@ -87,9 +77,9 @@ AST_MATCHER(CXXMethodDecl, nameCollidesWithMethodInBase) {
8777
}
8878
}
8979

90-
for (auto const &SubBase : CurrentRecord->bases()) {
80+
for (auto const &SubBase : CurrentRecord->bases())
9181
Stack.push(&SubBase);
92-
}
82+
9383
}
9484
}
9585
return false;
@@ -126,9 +116,8 @@ void MethodHidingCheck::check(const MatchFinder::MatchResult &Result) {
126116
Result.Nodes.getNodeAs<CXXRecordDecl>("derived_class");
127117
auto const *BaseMethod = Result.Nodes.getNodeAs<CXXMethodDecl>("base_method");
128118

129-
if (!ShadowingMethod || !DerivedClass || !BaseMethod) {
119+
if (!ShadowingMethod || !DerivedClass || !BaseMethod)
130120
llvm_unreachable("Required binding not found");
131-
}
132121

133122
diag(ShadowingMethod->getBeginLoc(),
134123
"'" + ShadowingMethod->getQualifiedNameAsString() +

0 commit comments

Comments
 (0)