aboutsummaryrefslogtreecommitdiff
path: root/clang-tools-extra/clang-tidy/modernize
diff options
context:
space:
mode:
authorAlexander Kornienko <alexfh@google.com>2021-01-29 00:49:53 +0100
committerAlexander Kornienko <alexfh@google.com>2021-01-29 01:01:19 +0100
commitab2d3ce47d6fead7fb79b3c0c7c4c6ac2b930d45 (patch)
treee0508e1690f4d6d8b3b93b4cc68d67f0bc0d8914 /clang-tools-extra/clang-tidy/modernize
parenta1a3fdcdba52c9d0a045af5f68365c273467b127 (diff)
downloadllvm-ab2d3ce47d6fead7fb79b3c0c7c4c6ac2b930d45.zip
llvm-ab2d3ce47d6fead7fb79b3c0c7c4c6ac2b930d45.tar.gz
llvm-ab2d3ce47d6fead7fb79b3c0c7c4c6ac2b930d45.tar.bz2
[clang-tidy] Applied clang-tidy fixes. NFC
Applied fixes enabled by the LLVM's .clang-tidy configs. Reverted files where fixes introduced compile errors: clang-tools-extra/clang-tidy/hicpp/NoAssemblerCheck.cpp clang-tools-extra/clang-tidy/misc/ThrowByValueCatchByReferenceCheck.cpp $ clang-tools-extra/clang-tidy/tool/run-clang-tidy.py -fix clang-tools-extra/clang-tidy/ Enabled checks: llvm-else-after-return llvm-header-guard llvm-include-order llvm-namespace-comment llvm-prefer-isa-or-dyn-cast-in-conditionals llvm-prefer-register-over-unsigned llvm-qualified-auto llvm-twine-local misc-definitions-in-headers misc-misplaced-const misc-new-delete-overloads misc-no-recursion misc-non-copyable-objects misc-redundant-expression misc-static-assert misc-throw-by-value-catch-by-reference misc-unconventional-assign-operator misc-uniqueptr-reset-release misc-unused-alias-decls misc-unused-using-decls readability-identifier-naming Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D95614
Diffstat (limited to 'clang-tools-extra/clang-tidy/modernize')
-rw-r--r--clang-tools-extra/clang-tidy/modernize/DeprecatedIosBaseAliasesCheck.cpp2
-rw-r--r--clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp34
-rw-r--r--clang-tools-extra/clang-tidy/modernize/LoopConvertUtils.cpp8
-rw-r--r--clang-tools-extra/clang-tidy/modernize/MakeSmartPtrCheck.cpp31
-rw-r--r--clang-tools-extra/clang-tidy/modernize/RedundantVoidArgCheck.cpp4
-rw-r--r--clang-tools-extra/clang-tidy/modernize/ReplaceRandomShuffleCheck.cpp15
-rw-r--r--clang-tools-extra/clang-tidy/modernize/UseAutoCheck.cpp4
-rw-r--r--clang-tools-extra/clang-tidy/modernize/UseEqualsDefaultCheck.cpp2
-rw-r--r--clang-tools-extra/clang-tidy/modernize/UseNullptrCheck.cpp4
-rw-r--r--clang-tools-extra/clang-tidy/modernize/UseOverrideCheck.cpp12
-rw-r--r--clang-tools-extra/clang-tidy/modernize/UseTrailingReturnTypeCheck.cpp20
-rw-r--r--clang-tools-extra/clang-tidy/modernize/UseUsingCheck.cpp12
12 files changed, 73 insertions, 75 deletions
diff --git a/clang-tools-extra/clang-tidy/modernize/DeprecatedIosBaseAliasesCheck.cpp b/clang-tools-extra/clang-tidy/modernize/DeprecatedIosBaseAliasesCheck.cpp
index 2eef983..d621600 100644
--- a/clang-tools-extra/clang-tidy/modernize/DeprecatedIosBaseAliasesCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/DeprecatedIosBaseAliasesCheck.cpp
@@ -59,7 +59,7 @@ void DeprecatedIosBaseAliasesCheck::check(
SourceLocation EndLoc = IoStateLoc.getLocWithOffset(TypeName.size() - 1);
if (Replacement) {
- auto FixName = *Replacement;
+ const char *FixName = *Replacement;
auto Builder = diag(IoStateLoc, "'std::ios_base::%0' is deprecated; use "
"'std::ios_base::%1' instead")
<< TypeName << FixName;
diff --git a/clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp b/clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp
index 65384af..c017cac 100644
--- a/clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp
@@ -71,20 +71,20 @@ static const char EndVarName[] = "endVar";
static const char DerefByValueResultName[] = "derefByValueResult";
static const char DerefByRefResultName[] = "derefByRefResult";
// shared matchers
-static const TypeMatcher AnyType() { return anything(); }
+static const TypeMatcher anyType() { return anything(); }
-static const StatementMatcher IntegerComparisonMatcher() {
+static const StatementMatcher integerComparisonMatcher() {
return expr(ignoringParenImpCasts(
declRefExpr(to(varDecl(hasType(isInteger())).bind(ConditionVarName)))));
}
-static const DeclarationMatcher InitToZeroMatcher() {
+static const DeclarationMatcher initToZeroMatcher() {
return varDecl(
hasInitializer(ignoringParenImpCasts(integerLiteral(equals(0)))))
.bind(InitVarName);
}
-static const StatementMatcher IncrementVarMatcher() {
+static const StatementMatcher incrementVarMatcher() {
return declRefExpr(to(varDecl(hasType(isInteger())).bind(IncrementVarName)));
}
@@ -112,15 +112,16 @@ StatementMatcher makeArrayLoopMatcher() {
return forStmt(
unless(isInTemplateInstantiation()),
- hasLoopInit(declStmt(hasSingleDecl(InitToZeroMatcher()))),
+ hasLoopInit(declStmt(hasSingleDecl(initToZeroMatcher()))),
hasCondition(anyOf(
binaryOperator(hasOperatorName("<"),
- hasLHS(IntegerComparisonMatcher()),
+ hasLHS(integerComparisonMatcher()),
hasRHS(ArrayBoundMatcher)),
binaryOperator(hasOperatorName(">"), hasLHS(ArrayBoundMatcher),
- hasRHS(IntegerComparisonMatcher())))),
- hasIncrement(unaryOperator(hasOperatorName("++"),
- hasUnaryOperand(IncrementVarMatcher()))))
+ hasRHS(integerComparisonMatcher())))),
+ hasIncrement(
+ unaryOperator(hasOperatorName("++"),
+ hasUnaryOperand(incrementVarMatcher()))))
.bind(LoopNameArray);
}
@@ -226,7 +227,7 @@ StatementMatcher makeIteratorLoopMatcher(bool IsReverse) {
hasIncrement(anyOf(
unaryOperator(hasOperatorName("++"),
hasUnaryOperand(declRefExpr(
- to(varDecl(hasType(pointsTo(AnyType())))
+ to(varDecl(hasType(pointsTo(anyType())))
.bind(IncrementVarName))))),
cxxOperatorCallExpr(
hasOverloadedOperatorName("++"),
@@ -313,17 +314,18 @@ StatementMatcher makePseudoArrayLoopMatcher() {
unless(isInTemplateInstantiation()),
hasLoopInit(
anyOf(declStmt(declCountIs(2),
- containsDeclaration(0, InitToZeroMatcher()),
+ containsDeclaration(0, initToZeroMatcher()),
containsDeclaration(1, EndDeclMatcher)),
- declStmt(hasSingleDecl(InitToZeroMatcher())))),
+ declStmt(hasSingleDecl(initToZeroMatcher())))),
hasCondition(anyOf(
binaryOperator(hasOperatorName("<"),
- hasLHS(IntegerComparisonMatcher()),
+ hasLHS(integerComparisonMatcher()),
hasRHS(IndexBoundMatcher)),
binaryOperator(hasOperatorName(">"), hasLHS(IndexBoundMatcher),
- hasRHS(IntegerComparisonMatcher())))),
- hasIncrement(unaryOperator(hasOperatorName("++"),
- hasUnaryOperand(IncrementVarMatcher()))))
+ hasRHS(integerComparisonMatcher())))),
+ hasIncrement(
+ unaryOperator(hasOperatorName("++"),
+ hasUnaryOperand(incrementVarMatcher()))))
.bind(LoopNamePseudoArray);
}
diff --git a/clang-tools-extra/clang-tidy/modernize/LoopConvertUtils.cpp b/clang-tools-extra/clang-tidy/modernize/LoopConvertUtils.cpp
index c20472c..74dd4a3 100644
--- a/clang-tools-extra/clang-tidy/modernize/LoopConvertUtils.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/LoopConvertUtils.cpp
@@ -10,8 +10,8 @@
#include "clang/Basic/IdentifierTable.h"
#include "clang/Basic/LLVM.h"
#include "clang/Basic/Lambda.h"
-#include "clang/Basic/SourceManager.h"
#include "clang/Basic/SourceLocation.h"
+#include "clang/Basic/SourceManager.h"
#include "clang/Basic/TokenKinds.h"
#include "clang/Lex/Lexer.h"
#include "llvm/ADT/APSInt.h"
@@ -50,8 +50,8 @@ bool StmtAncestorASTVisitor::TraverseStmt(Stmt *Statement) {
/// Scope, as we can map a VarDecl to its DeclStmt, then walk up the parent tree
/// using StmtAncestors.
bool StmtAncestorASTVisitor::VisitDeclStmt(DeclStmt *Decls) {
- for (const auto *decl : Decls->decls()) {
- if (const auto *V = dyn_cast<VarDecl>(decl))
+ for (const auto *Decl : Decls->decls()) {
+ if (const auto *V = dyn_cast<VarDecl>(Decl))
DeclParents.insert(std::make_pair(V, Decls));
}
return true;
@@ -356,7 +356,7 @@ static bool isAliasDecl(ASTContext *Context, const Decl *TheDecl,
bool OnlyCasts = true;
const Expr *Init = VDecl->getInit()->IgnoreParenImpCasts();
- if (Init && isa<CXXConstructExpr>(Init)) {
+ if (isa_and_nonnull<CXXConstructExpr>(Init)) {
Init = digThroughConstructors(Init);
OnlyCasts = false;
}
diff --git a/clang-tools-extra/clang-tidy/modernize/MakeSmartPtrCheck.cpp b/clang-tools-extra/clang-tidy/modernize/MakeSmartPtrCheck.cpp
index 4130140..54a5c5a 100644
--- a/clang-tools-extra/clang-tidy/modernize/MakeSmartPtrCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/MakeSmartPtrCheck.cpp
@@ -24,8 +24,7 @@ constexpr char ConstructorCall[] = "constructorCall";
constexpr char ResetCall[] = "resetCall";
constexpr char NewExpression[] = "newExpression";
-std::string GetNewExprName(const CXXNewExpr *NewExpr,
- const SourceManager &SM,
+std::string getNewExprName(const CXXNewExpr *NewExpr, const SourceManager &SM,
const LangOptions &Lang) {
StringRef WrittenName = Lexer::getSourceText(
CharSourceRange::getTokenRange(
@@ -183,8 +182,7 @@ void MakeSmartPtrCheck::checkConstruct(SourceManager &SM, ASTContext *Ctx,
// we have to add it back.
ConstructCallEnd = ConstructCallStart.getLocWithOffset(ExprStr.size());
Diag << FixItHint::CreateInsertion(
- ConstructCallEnd,
- "<" + GetNewExprName(New, SM, getLangOpts()) + ">");
+ ConstructCallEnd, "<" + getNewExprName(New, SM, getLangOpts()) + ">");
} else {
ConstructCallEnd = ConstructCallStart.getLocWithOffset(LAngle);
}
@@ -248,7 +246,7 @@ void MakeSmartPtrCheck::checkReset(SourceManager &SM, ASTContext *Ctx,
Diag << FixItHint::CreateReplacement(
CharSourceRange::getCharRange(OperatorLoc, ExprEnd),
(llvm::Twine(" = ") + MakeSmartPtrFunctionName + "<" +
- GetNewExprName(New, SM, getLangOpts()) + ">")
+ getNewExprName(New, SM, getLangOpts()) + ">")
.str());
if (Expr->isArrow())
@@ -389,19 +387,18 @@ bool MakeSmartPtrCheck::replaceNew(DiagnosticBuilder &Diag,
// std::make_smart_ptr<S>(std::initializer_list<int>({}));
// std::make_smart_ptr<S2>(S{1, 2}, 3);
return false;
- } else {
- // Direct initialization with ordinary constructors.
- // struct S { S(int x); S(); };
- // smart_ptr<S>(new S{5});
- // smart_ptr<S>(new S{}); // use default constructor
- // The arguments in the initialization list are going to be forwarded to
- // the constructor, so this has to be replaced with:
- // std::make_smart_ptr<S>(5);
- // std::make_smart_ptr<S>();
- InitRange = SourceRange(
- NewConstruct->getParenOrBraceRange().getBegin().getLocWithOffset(1),
- NewConstruct->getParenOrBraceRange().getEnd().getLocWithOffset(-1));
}
+ // Direct initialization with ordinary constructors.
+ // struct S { S(int x); S(); };
+ // smart_ptr<S>(new S{5});
+ // smart_ptr<S>(new S{}); // use default constructor
+ // The arguments in the initialization list are going to be forwarded to
+ // the constructor, so this has to be replaced with:
+ // std::make_smart_ptr<S>(5);
+ // std::make_smart_ptr<S>();
+ InitRange = SourceRange(
+ NewConstruct->getParenOrBraceRange().getBegin().getLocWithOffset(1),
+ NewConstruct->getParenOrBraceRange().getEnd().getLocWithOffset(-1));
} else {
// Aggregate initialization.
// smart_ptr<Pair>(new Pair{first, second});
diff --git a/clang-tools-extra/clang-tidy/modernize/RedundantVoidArgCheck.cpp b/clang-tools-extra/clang-tidy/modernize/RedundantVoidArgCheck.cpp
index 7e44738..3214ae8 100644
--- a/clang-tools-extra/clang-tidy/modernize/RedundantVoidArgCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/RedundantVoidArgCheck.cpp
@@ -20,13 +20,13 @@ namespace {
// Determine if the given QualType is a nullary function or pointer to same.
bool protoTypeHasNoParms(QualType QT) {
- if (auto PT = QT->getAs<PointerType>()) {
+ if (const auto *PT = QT->getAs<PointerType>()) {
QT = PT->getPointeeType();
}
if (auto *MPT = QT->getAs<MemberPointerType>()) {
QT = MPT->getPointeeType();
}
- if (auto FP = QT->getAs<FunctionProtoType>()) {
+ if (const auto *FP = QT->getAs<FunctionProtoType>()) {
return FP->getNumParams() == 0;
}
return false;
diff --git a/clang-tools-extra/clang-tidy/modernize/ReplaceRandomShuffleCheck.cpp b/clang-tools-extra/clang-tidy/modernize/ReplaceRandomShuffleCheck.cpp
index f21482d..3cb934e 100644
--- a/clang-tools-extra/clang-tidy/modernize/ReplaceRandomShuffleCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/ReplaceRandomShuffleCheck.cpp
@@ -71,15 +71,14 @@ void ReplaceRandomShuffleCheck::check(const MatchFinder::MatchResult &Result) {
MatchedArgumentThree->getSourceRange(),
"std::mt19937(std::random_device()())");
return DiagL;
- } else {
- auto DiagL = diag(MatchedCallExpr->getBeginLoc(),
- "'std::random_shuffle' has been removed in C++17; use "
- "'std::shuffle' instead");
- DiagL << FixItHint::CreateInsertion(
- MatchedCallExpr->getRParenLoc(),
- ", std::mt19937(std::random_device()())");
- return DiagL;
}
+ auto DiagL = diag(MatchedCallExpr->getBeginLoc(),
+ "'std::random_shuffle' has been removed in C++17; use "
+ "'std::shuffle' instead");
+ DiagL << FixItHint::CreateInsertion(
+ MatchedCallExpr->getRParenLoc(),
+ ", std::mt19937(std::random_device()())");
+ return DiagL;
}();
std::string NewName = "shuffle";
diff --git a/clang-tools-extra/clang-tidy/modernize/UseAutoCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseAutoCheck.cpp
index fab13cdb..a4a81ce 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseAutoCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseAutoCheck.cpp
@@ -27,7 +27,7 @@ const char DeclWithNewId[] = "decl_new";
const char DeclWithCastId[] = "decl_cast";
const char DeclWithTemplateCastId[] = "decl_template";
-size_t GetTypeNameLength(bool RemoveStars, StringRef Text) {
+size_t getTypeNameLength(bool RemoveStars, StringRef Text) {
enum CharType { Space, Alpha, Punctuation };
CharType LastChar = Space, BeforeSpace = Punctuation;
size_t NumChars = 0;
@@ -399,7 +399,7 @@ void UseAutoCheck::replaceExpr(
SourceRange Range(Loc.getSourceRange());
if (MinTypeNameLength != 0 &&
- GetTypeNameLength(RemoveStars,
+ getTypeNameLength(RemoveStars,
tooling::fixit::getText(Loc.getSourceRange(),
FirstDecl->getASTContext())) <
MinTypeNameLength)
diff --git a/clang-tools-extra/clang-tidy/modernize/UseEqualsDefaultCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseEqualsDefaultCheck.cpp
index d1d2582..9b91d181 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseEqualsDefaultCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseEqualsDefaultCheck.cpp
@@ -7,10 +7,10 @@
//===----------------------------------------------------------------------===//
#include "UseEqualsDefaultCheck.h"
+#include "../utils/LexerUtils.h"
#include "clang/AST/ASTContext.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/Lex/Lexer.h"
-#include "../utils/LexerUtils.h"
using namespace clang::ast_matchers;
diff --git a/clang-tools-extra/clang-tidy/modernize/UseNullptrCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseNullptrCheck.cpp
index 25a789d..e32687b 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseNullptrCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseNullptrCheck.cpp
@@ -173,9 +173,9 @@ private:
class CastSequenceVisitor : public RecursiveASTVisitor<CastSequenceVisitor> {
public:
CastSequenceVisitor(ASTContext &Context, ArrayRef<StringRef> NullMacros,
- ClangTidyCheck &check)
+ ClangTidyCheck &Check)
: SM(Context.getSourceManager()), Context(Context),
- NullMacros(NullMacros), Check(check), FirstSubExpr(nullptr),
+ NullMacros(NullMacros), Check(Check), FirstSubExpr(nullptr),
PruneSubtree(false) {}
bool TraverseStmt(Stmt *S) {
diff --git a/clang-tools-extra/clang-tidy/modernize/UseOverrideCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseOverrideCheck.cpp
index bfce7a6..510e17f 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseOverrideCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseOverrideCheck.cpp
@@ -43,7 +43,7 @@ void UseOverrideCheck::registerMatchers(MatchFinder *Finder) {
// Re-lex the tokens to get precise locations to insert 'override' and remove
// 'virtual'.
static SmallVector<Token, 16>
-ParseTokens(CharSourceRange Range, const MatchFinder::MatchResult &Result) {
+parseTokens(CharSourceRange Range, const MatchFinder::MatchResult &Result) {
const SourceManager &Sources = *Result.SourceManager;
std::pair<FileID, unsigned> LocInfo =
Sources.getDecomposedLoc(Range.getBegin());
@@ -75,7 +75,7 @@ ParseTokens(CharSourceRange Range, const MatchFinder::MatchResult &Result) {
return Tokens;
}
-static StringRef GetText(const Token &Tok, const SourceManager &Sources) {
+static StringRef getText(const Token &Tok, const SourceManager &Sources) {
return StringRef(Sources.getCharacterData(Tok.getLocation()),
Tok.getLength());
}
@@ -136,7 +136,7 @@ void UseOverrideCheck::check(const MatchFinder::MatchResult &Result) {
// FIXME: Instead of re-lexing and looking for specific macros such as
// 'ABSTRACT', properly store the location of 'virtual' and '= 0' in each
// FunctionDecl.
- SmallVector<Token, 16> Tokens = ParseTokens(FileRange, Result);
+ SmallVector<Token, 16> Tokens = parseTokens(FileRange, Result);
// Add 'override' on inline declarations that don't already have it.
if (!HasFinal && !HasOverride) {
@@ -185,15 +185,15 @@ void UseOverrideCheck::check(const MatchFinder::MatchResult &Result) {
// location will point until after those markings. Therefore, the override
// keyword shouldn't be inserted at the end, but before the '='.
if (Tokens.size() > 2 &&
- (GetText(Tokens.back(), Sources) == "0" ||
+ (getText(Tokens.back(), Sources) == "0" ||
Tokens.back().is(tok::kw_default) ||
Tokens.back().is(tok::kw_delete)) &&
- GetText(Tokens[Tokens.size() - 2], Sources) == "=") {
+ getText(Tokens[Tokens.size() - 2], Sources) == "=") {
InsertLoc = Tokens[Tokens.size() - 2].getLocation();
// Check if we need to insert a space.
if ((Tokens[Tokens.size() - 2].getFlags() & Token::LeadingSpace) == 0)
ReplacementText = " " + OverrideSpelling + " ";
- } else if (GetText(Tokens.back(), Sources) == "ABSTRACT")
+ } else if (getText(Tokens.back(), Sources) == "ABSTRACT")
InsertLoc = Tokens.back().getLocation();
}
diff --git a/clang-tools-extra/clang-tidy/modernize/UseTrailingReturnTypeCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseTrailingReturnTypeCheck.cpp
index bbb1e8c..b5c7227 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseTrailingReturnTypeCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseTrailingReturnTypeCheck.cpp
@@ -31,7 +31,7 @@ public:
bool shouldWalkTypesOfTypeLocs() const { return false; }
- bool VisitUnqualName(StringRef UnqualName) {
+ bool visitUnqualName(StringRef UnqualName) {
// Check for collisions with function arguments.
for (ParmVarDecl *Param : F.parameters())
if (const IdentifierInfo *Ident = Param->getIdentifier())
@@ -49,17 +49,17 @@ public:
if (!Elaborated) {
switch (TL.getTypeLocClass()) {
case TypeLoc::Record:
- if (VisitUnqualName(
+ if (visitUnqualName(
TL.getAs<RecordTypeLoc>().getTypePtr()->getDecl()->getName()))
return false;
break;
case TypeLoc::Enum:
- if (VisitUnqualName(
+ if (visitUnqualName(
TL.getAs<EnumTypeLoc>().getTypePtr()->getDecl()->getName()))
return false;
break;
case TypeLoc::TemplateSpecialization:
- if (VisitUnqualName(TL.getAs<TemplateSpecializationTypeLoc>()
+ if (visitUnqualName(TL.getAs<TemplateSpecializationTypeLoc>()
.getTypePtr()
->getTemplateName()
.getAsTemplateDecl()
@@ -67,7 +67,7 @@ public:
return false;
break;
case TypeLoc::Typedef:
- if (VisitUnqualName(
+ if (visitUnqualName(
TL.getAs<TypedefTypeLoc>().getTypePtr()->getDecl()->getName()))
return false;
break;
@@ -97,7 +97,7 @@ public:
bool VisitDeclRefExpr(DeclRefExpr *S) {
DeclarationName Name = S->getNameInfo().getName();
return S->getQualifierLoc() || !Name.isIdentifier() ||
- !VisitUnqualName(Name.getAsIdentifierInfo()->getName());
+ !visitUnqualName(Name.getAsIdentifierInfo()->getName());
}
private:
@@ -160,11 +160,11 @@ SourceLocation UseTrailingReturnTypeCheck::findTrailingReturnTypeSourceLocation(
return Result;
}
-static bool IsCVR(Token T) {
+static bool isCvr(Token T) {
return T.isOneOf(tok::kw_const, tok::kw_volatile, tok::kw_restrict);
}
-static bool IsSpecifier(Token T) {
+static bool isSpecifier(Token T) {
return T.isOneOf(tok::kw_constexpr, tok::kw_inline, tok::kw_extern,
tok::kw_static, tok::kw_friend, tok::kw_virtual);
}
@@ -192,8 +192,8 @@ classifyToken(const FunctionDecl &F, Preprocessor &PP, Token Tok) {
if (T.is(tok::eof))
break;
- bool Qual = IsCVR(T);
- bool Spec = IsSpecifier(T);
+ bool Qual = isCvr(T);
+ bool Spec = isSpecifier(T);
CT.isQualifier &= Qual;
CT.isSpecifier &= Spec;
ContainsQualifiers |= Qual;
diff --git a/clang-tools-extra/clang-tidy/modernize/UseUsingCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseUsingCheck.cpp
index f3e8506..a12a056 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseUsingCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseUsingCheck.cpp
@@ -58,13 +58,13 @@ void UseUsingCheck::check(const MatchFinder::MatchResult &Result) {
return;
}
- auto printPolicy = PrintingPolicy(getLangOpts());
- printPolicy.SuppressScope = true;
- printPolicy.ConstantArraySizeAsWritten = true;
- printPolicy.UseVoidForZeroParams = false;
- printPolicy.PrintInjectedClassNameWithArguments = false;
+ PrintingPolicy PrintPolicy(getLangOpts());
+ PrintPolicy.SuppressScope = true;
+ PrintPolicy.ConstantArraySizeAsWritten = true;
+ PrintPolicy.UseVoidForZeroParams = false;
+ PrintPolicy.PrintInjectedClassNameWithArguments = false;
- std::string Type = MatchedDecl->getUnderlyingType().getAsString(printPolicy);
+ std::string Type = MatchedDecl->getUnderlyingType().getAsString(PrintPolicy);
std::string Name = MatchedDecl->getNameAsString();
SourceRange ReplaceRange = MatchedDecl->getSourceRange();