Skip to content

Commit 3ae11b4

Browse files
committed
[NFC] small refactor on RenamerClangTidyCheck.cpp
1 parent 3302586 commit 3ae11b4

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ static void addUsage(RenamerClangTidyCheck::NamingCheckFailureMap &Failures,
133133
const RenamerClangTidyCheck::NamingCheckId &Decl,
134134
SourceRange Range, SourceManager *SourceMgr = nullptr) {
135135
// Do nothing if the provided range is invalid.
136-
if (Range.getBegin().isInvalid() || Range.getEnd().isInvalid())
136+
if (Range.isInvalid())
137137
return;
138138

139139
// If we have a source manager, use it to convert to the spelling location for
@@ -290,11 +290,9 @@ void RenamerClangTidyCheck::check(const MatchFinder::MatchResult &Result) {
290290
Value->getReturnType().getTypePtr()->getAs<TypedefType>())
291291
addUsage(NamingCheckFailures, Typedef->getDecl(),
292292
Value->getSourceRange());
293-
for (unsigned i = 0; i < Value->getNumParams(); ++i) {
294-
if (const TypedefType *Typedef = Value->parameters()[i]
295-
->getType()
296-
.getTypePtr()
297-
->getAs<TypedefType>())
293+
for (const ParmVarDecl *Param : Value->parameters()) {
294+
if (const TypedefType *Typedef =
295+
Param->getType().getTypePtr()->getAs<TypedefType>())
298296
addUsage(NamingCheckFailures, Typedef->getDecl(),
299297
Value->getSourceRange());
300298
}

0 commit comments

Comments
 (0)