Skip to content

Commit 3b452e0

Browse files
authored
[clang-tidy][NFC] Enable modernize-use-auto in clang-tidy config and fix warnings (#157468)
Closes [#156154](#156154)
1 parent df430c3 commit 3b452e0

File tree

4 files changed

+5
-6
lines changed

4 files changed

+5
-6
lines changed

clang-tools-extra/clang-tidy/.clang-tidy

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ Checks: >
1111
modernize-*,
1212
-modernize-avoid-c-arrays,
1313
-modernize-pass-by-value,
14-
-modernize-use-auto,
1514
-modernize-use-nodiscard,
1615
-modernize-use-trailing-return-type,
1716
performance-*,

clang-tools-extra/clang-tidy/modernize/UseIntegerSignComparisonCheck.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,9 @@ void UseIntegerSignComparisonCheck::check(
138138
return;
139139
const Expr *SubExprLHS = nullptr;
140140
const Expr *SubExprRHS = nullptr;
141-
SourceRange R1 = SourceRange(LHS->getBeginLoc());
142-
SourceRange R2 = SourceRange(BinaryOp->getOperatorLoc());
143-
SourceRange R3 = SourceRange(Lexer::getLocForEndOfToken(
141+
SourceRange R1(LHS->getBeginLoc());
142+
SourceRange R2(BinaryOp->getOperatorLoc());
143+
SourceRange R3(Lexer::getLocForEndOfToken(
144144
RHS->getEndLoc(), 0, *Result.SourceManager, getLangOpts()));
145145
if (const auto *LHSCast = llvm::dyn_cast<ExplicitCastExpr>(LHS)) {
146146
SubExprLHS = LHSCast->getSubExpr();

clang-tools-extra/clang-tidy/modernize/UseScopedLockCheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ static SourceRange getLockGuardRange(const TypeSourceInfo *SourceInfo) {
9898

9999
// Find the exact source range of the 'lock_guard' name token
100100
static SourceRange getLockGuardNameRange(const TypeSourceInfo *SourceInfo) {
101-
const TemplateSpecializationTypeLoc TemplateLoc =
101+
const auto TemplateLoc =
102102
SourceInfo->getTypeLoc().getAs<TemplateSpecializationTypeLoc>();
103103
if (!TemplateLoc)
104104
return {};

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ static bool maxCondition(const BinaryOperator::Opcode Op, const Expr *CondLhs,
6262
static QualType getNonTemplateAlias(QualType QT) {
6363
while (true) {
6464
// cast to a TypedefType
65-
if (const TypedefType *TT = dyn_cast<TypedefType>(QT)) {
65+
if (const auto *TT = dyn_cast<TypedefType>(QT)) {
6666
// check if the typedef is a template and if it is dependent
6767
if (!TT->getDecl()->getDescribedTemplate() &&
6868
!TT->getDecl()->getDeclContext()->isDependentContext())

0 commit comments

Comments
 (0)