Skip to content

Commit fab960f

Browse files
committed
Micro fixes
1 parent 03b3c93 commit fab960f

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

clang-tools-extra/clang-tidy/readability/RedundantCastingCheck.cpp

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ using namespace clang::ast_matchers;
1616

1717
namespace clang::tidy::readability {
1818

19-
static bool areTypesEquals(QualType S, QualType D) {
19+
static bool areTypesEqual(QualType S, QualType D) {
2020
if (S == D)
2121
return true;
2222

@@ -29,7 +29,7 @@ static bool areTypesEquals(QualType S, QualType D) {
2929
QualType PtrD = D->getPointeeType();
3030

3131
if (!PtrS.isNull() && !PtrD.isNull())
32-
return areTypesEquals(PtrS, PtrD);
32+
return areTypesEqual(PtrS, PtrD);
3333

3434
const DeducedType *DT = S->getContainedDeducedType();
3535
if (DT && DT->isDeduced())
@@ -38,15 +38,15 @@ static bool areTypesEquals(QualType S, QualType D) {
3838
return false;
3939
}
4040

41-
static bool areTypesEquals(QualType TypeS, QualType TypeD,
42-
bool IgnoreTypeAliases) {
41+
static bool areTypesEqual(QualType TypeS, QualType TypeD,
42+
bool IgnoreTypeAliases) {
4343
const QualType CTypeS = TypeS.getCanonicalType();
4444
const QualType CTypeD = TypeD.getCanonicalType();
4545
if (CTypeS != CTypeD)
4646
return false;
4747

48-
return IgnoreTypeAliases || areTypesEquals(TypeS.getLocalUnqualifiedType(),
49-
TypeD.getLocalUnqualifiedType());
48+
return IgnoreTypeAliases || areTypesEqual(TypeS.getLocalUnqualifiedType(),
49+
TypeD.getLocalUnqualifiedType());
5050
}
5151

5252
static bool areBinaryOperatorOperandsTypesEqual(const Expr *E,
@@ -64,13 +64,13 @@ static bool areBinaryOperatorOperandsTypesEqual(const Expr *E,
6464
const QualType NonReferenceType = Type.getNonReferenceType();
6565
const QualType LHSType = B->getLHS()->IgnoreImplicit()->getType();
6666
if (!LHSType.isNull() &&
67-
!areTypesEquals(LHSType.getNonReferenceType(), NonReferenceType,
68-
IgnoreTypeAliases))
67+
!areTypesEqual(LHSType.getNonReferenceType(), NonReferenceType,
68+
IgnoreTypeAliases))
6969
return true;
7070
const QualType RHSType = B->getRHS()->IgnoreImplicit()->getType();
7171
if (!RHSType.isNull() &&
72-
!areTypesEquals(RHSType.getNonReferenceType(), NonReferenceType,
73-
IgnoreTypeAliases))
72+
!areTypesEqual(RHSType.getNonReferenceType(), NonReferenceType,
73+
IgnoreTypeAliases))
7474
return true;
7575
}
7676
return false;
@@ -142,7 +142,7 @@ void RedundantCastingCheck::check(const MatchFinder::MatchResult &Result) {
142142
Result.Nodes.getNodeAs<QualType>("srcType")->getNonReferenceType();
143143
TypeD = TypeD.getNonReferenceType();
144144

145-
if (!areTypesEquals(TypeS, TypeD, IgnoreTypeAliases))
145+
if (!areTypesEqual(TypeS, TypeD, IgnoreTypeAliases))
146146
return;
147147

148148
if (areBinaryOperatorOperandsTypesEqual(SourceExpr, IgnoreTypeAliases))
@@ -179,7 +179,6 @@ void RedundantCastingCheck::check(const MatchFinder::MatchResult &Result) {
179179
}
180180

181181
if (utils::fixit::areParensNeededForStatement(*SourceExpr)) {
182-
183182
Diag << FixItHint::CreateInsertion(SourceExprBegin, "(")
184183
<< FixItHint::CreateInsertion(NextToken, ")");
185184
}

0 commit comments

Comments
 (0)