[clang-tidy][NFC] Fix readability-inconsistent-declaration-parameter-name findings
Fix issues found by clang-tidy in clang-tidy source directory.
This commit is contained in:
parent
e41d383440
commit
f1f16331bd
@ -22,14 +22,15 @@ ClangTidyCheck::ClangTidyCheck(StringRef CheckName, ClangTidyContext *Context)
|
||||
assert(!CheckName.empty());
|
||||
}
|
||||
|
||||
DiagnosticBuilder ClangTidyCheck::diag(SourceLocation Loc, StringRef Message,
|
||||
DiagnosticBuilder ClangTidyCheck::diag(SourceLocation Loc,
|
||||
StringRef Description,
|
||||
DiagnosticIDs::Level Level) {
|
||||
return Context->diag(CheckName, Loc, Message, Level);
|
||||
return Context->diag(CheckName, Loc, Description, Level);
|
||||
}
|
||||
|
||||
DiagnosticBuilder ClangTidyCheck::diag(StringRef Message,
|
||||
DiagnosticBuilder ClangTidyCheck::diag(StringRef Description,
|
||||
DiagnosticIDs::Level Level) {
|
||||
return Context->diag(CheckName, Message, Level);
|
||||
return Context->diag(CheckName, Description, Level);
|
||||
}
|
||||
|
||||
DiagnosticBuilder
|
||||
|
@ -342,10 +342,10 @@ void ClangTidyDiagnosticConsumer::finalizeLastError() {
|
||||
namespace clang::tidy {
|
||||
|
||||
const llvm::StringMap<tooling::Replacements> *
|
||||
getFixIt(const tooling::Diagnostic &Diagnostic, bool GetFixFromNotes) {
|
||||
getFixIt(const tooling::Diagnostic &Diagnostic, bool AnyFix) {
|
||||
if (!Diagnostic.Message.Fix.empty())
|
||||
return &Diagnostic.Message.Fix;
|
||||
if (!GetFixFromNotes)
|
||||
if (!AnyFix)
|
||||
return nullptr;
|
||||
const llvm::StringMap<tooling::Replacements> *Result = nullptr;
|
||||
for (const auto &Note : Diagnostic.Notes) {
|
||||
|
@ -87,10 +87,10 @@ public:
|
||||
/// tablegen'd diagnostic IDs.
|
||||
/// FIXME: Figure out a way to manage ID spaces.
|
||||
DiagnosticBuilder diag(StringRef CheckName, SourceLocation Loc,
|
||||
StringRef Message,
|
||||
StringRef Description,
|
||||
DiagnosticIDs::Level Level = DiagnosticIDs::Warning);
|
||||
|
||||
DiagnosticBuilder diag(StringRef CheckName, StringRef Message,
|
||||
DiagnosticBuilder diag(StringRef CheckName, StringRef Description,
|
||||
DiagnosticIDs::Level Level = DiagnosticIDs::Warning);
|
||||
|
||||
DiagnosticBuilder diag(const tooling::Diagnostic &Error);
|
||||
|
@ -83,13 +83,13 @@ struct NOptionMap {
|
||||
};
|
||||
|
||||
template <>
|
||||
void yamlize(IO &IO, ClangTidyOptions::OptionMap &Options, bool,
|
||||
void yamlize(IO &IO, ClangTidyOptions::OptionMap &Val, bool,
|
||||
EmptyContext &Ctx) {
|
||||
if (IO.outputting()) {
|
||||
// Ensure check options are sorted
|
||||
std::vector<std::pair<StringRef, StringRef>> SortedOptions;
|
||||
SortedOptions.reserve(Options.size());
|
||||
for (auto &Key : Options) {
|
||||
SortedOptions.reserve(Val.size());
|
||||
for (auto &Key : Val) {
|
||||
SortedOptions.emplace_back(Key.getKey(), Key.getValue().Value);
|
||||
}
|
||||
std::sort(SortedOptions.begin(), SortedOptions.end());
|
||||
@ -109,14 +109,14 @@ void yamlize(IO &IO, ClangTidyOptions::OptionMap &Options, bool,
|
||||
// options using a list of maps containing key and value keys.
|
||||
Input &I = reinterpret_cast<Input &>(IO);
|
||||
if (isa<SequenceNode>(I.getCurrentNode())) {
|
||||
MappingNormalization<NOptionMap, ClangTidyOptions::OptionMap> NOpts(
|
||||
IO, Options);
|
||||
MappingNormalization<NOptionMap, ClangTidyOptions::OptionMap> NOpts(IO,
|
||||
Val);
|
||||
EmptyContext Ctx;
|
||||
yamlize(IO, NOpts->Options, true, Ctx);
|
||||
} else if (isa<MappingNode>(I.getCurrentNode())) {
|
||||
IO.beginMapping();
|
||||
for (StringRef Key : IO.keys()) {
|
||||
IO.mapRequired(Key.data(), Options[Key].Value);
|
||||
IO.mapRequired(Key.data(), Val[Key].Value);
|
||||
}
|
||||
IO.endMapping();
|
||||
} else {
|
||||
@ -130,18 +130,17 @@ struct ChecksVariant {
|
||||
std::optional<std::vector<std::string>> AsVector;
|
||||
};
|
||||
|
||||
template <>
|
||||
void yamlize(IO &IO, ChecksVariant &Checks, bool, EmptyContext &Ctx) {
|
||||
template <> void yamlize(IO &IO, ChecksVariant &Val, bool, EmptyContext &Ctx) {
|
||||
if (!IO.outputting()) {
|
||||
// Special case for reading from YAML
|
||||
// Must support reading from both a string or a list
|
||||
Input &I = reinterpret_cast<Input &>(IO);
|
||||
if (isa<ScalarNode, BlockScalarNode>(I.getCurrentNode())) {
|
||||
Checks.AsString = std::string();
|
||||
yamlize(IO, *Checks.AsString, true, Ctx);
|
||||
Val.AsString = std::string();
|
||||
yamlize(IO, *Val.AsString, true, Ctx);
|
||||
} else if (isa<SequenceNode>(I.getCurrentNode())) {
|
||||
Checks.AsVector = std::vector<std::string>();
|
||||
yamlize(IO, *Checks.AsVector, true, Ctx);
|
||||
Val.AsVector = std::vector<std::string>();
|
||||
yamlize(IO, *Val.AsVector, true, Ctx);
|
||||
} else {
|
||||
IO.setError("expected string or sequence");
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ namespace tooling {
|
||||
class ExpandModularHeadersPPCallbacks : public PPCallbacks {
|
||||
public:
|
||||
ExpandModularHeadersPPCallbacks(
|
||||
CompilerInstance *Compiler,
|
||||
CompilerInstance *CI,
|
||||
IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem> OverlayFS);
|
||||
~ExpandModularHeadersPPCallbacks();
|
||||
|
||||
|
@ -35,9 +35,9 @@ public:
|
||||
void EndOfMainFile() override;
|
||||
|
||||
private:
|
||||
/// Returns true if the name of the file with path FilePath is 'kernel.cl',
|
||||
/// Returns true if the name of the file with path FileName is 'kernel.cl',
|
||||
/// 'verilog.cl', or 'vhdl.cl'. The file name check is case insensitive.
|
||||
bool fileNameIsRestricted(StringRef FilePath);
|
||||
bool fileNameIsRestricted(StringRef FileName);
|
||||
|
||||
struct IncludeDirective {
|
||||
SourceLocation Loc; // Location in the include directive.
|
||||
|
@ -62,7 +62,7 @@ public:
|
||||
private:
|
||||
void checkForMissingMembers(
|
||||
const ClassDefId &ID,
|
||||
llvm::ArrayRef<SpecialMemberFunctionData> DefinedSpecialMembers);
|
||||
llvm::ArrayRef<SpecialMemberFunctionData> DefinedMembers);
|
||||
|
||||
const bool AllowMissingMoveFunctions;
|
||||
const bool AllowSoleDefaultDtor;
|
||||
|
@ -34,7 +34,7 @@ public:
|
||||
}
|
||||
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
|
||||
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
|
||||
void storeOptions(ClangTidyOptions::OptionMap &Options) override;
|
||||
void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
|
||||
|
||||
private:
|
||||
const StringRef UnsignedTypePrefix;
|
||||
|
@ -23,7 +23,7 @@ public:
|
||||
SignedBitwiseCheck(StringRef Name, ClangTidyContext *Context);
|
||||
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
|
||||
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
|
||||
void storeOptions(ClangTidyOptions::OptionMap &Options) override;
|
||||
void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
|
||||
|
||||
private:
|
||||
bool IgnorePositiveIntegerLiterals;
|
||||
|
@ -45,8 +45,7 @@ public:
|
||||
private:
|
||||
using NamespaceContextVec = llvm::SmallVector<NS, 6>;
|
||||
|
||||
void reportDiagnostic(const SourceManager &Sources,
|
||||
const LangOptions &LangOpts);
|
||||
void reportDiagnostic(const SourceManager &SM, const LangOptions &LangOpts);
|
||||
NamespaceContextVec Namespaces;
|
||||
};
|
||||
} // namespace clang::tidy::modernize
|
||||
|
@ -49,10 +49,10 @@ bool StmtAncestorASTVisitor::TraverseStmt(Stmt *Statement) {
|
||||
/// Combined with StmtAncestors, this provides roughly the same information as
|
||||
/// 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()) {
|
||||
bool StmtAncestorASTVisitor::VisitDeclStmt(DeclStmt *Statement) {
|
||||
for (const auto *Decl : Statement->decls()) {
|
||||
if (const auto *V = dyn_cast<VarDecl>(Decl))
|
||||
DeclParents.insert(std::make_pair(V, Decls));
|
||||
DeclParents.insert(std::make_pair(V, Statement));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -197,10 +197,10 @@ private:
|
||||
const StmtGeneratedVarNameMap *GeneratedDecls;
|
||||
bool Found;
|
||||
|
||||
bool VisitForStmt(clang::ForStmt *F);
|
||||
bool VisitNamedDecl(clang::NamedDecl *D);
|
||||
bool VisitDeclRefExpr(clang::DeclRefExpr *D);
|
||||
bool VisitTypeLoc(clang::TypeLoc TL);
|
||||
bool VisitForStmt(clang::ForStmt *);
|
||||
bool VisitNamedDecl(clang::NamedDecl *);
|
||||
bool VisitDeclRefExpr(clang::DeclRefExpr *);
|
||||
bool VisitTypeLoc(clang::TypeLoc);
|
||||
};
|
||||
|
||||
/// The information needed to describe a valid convertible usage
|
||||
|
@ -54,7 +54,7 @@ private:
|
||||
const CXXConstructExpr *Construct, const QualType *Type,
|
||||
const CXXNewExpr *New);
|
||||
void checkReset(SourceManager &SM, ASTContext *Ctx,
|
||||
const CXXMemberCallExpr *Member, const CXXNewExpr *New);
|
||||
const CXXMemberCallExpr *Reset, const CXXNewExpr *New);
|
||||
|
||||
/// Returns true when the fixes for replacing CXXNewExpr are generated.
|
||||
bool replaceNew(DiagnosticBuilder &Diag, const CXXNewExpr *New,
|
||||
|
@ -28,7 +28,7 @@ public:
|
||||
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
|
||||
return LangOpts.CPlusPlus11;
|
||||
}
|
||||
void storeOptions(ClangTidyOptions::OptionMap &Options) override;
|
||||
void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
|
||||
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
|
||||
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
|
||||
|
||||
|
@ -28,7 +28,7 @@ public:
|
||||
}
|
||||
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
|
||||
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
|
||||
void storeOptions(ClangTidyOptions::OptionMap &Options) override;
|
||||
void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
|
||||
|
||||
private:
|
||||
const std::vector<StringRef> ForbiddenSuperClassNames;
|
||||
|
@ -187,7 +187,7 @@ BracesAroundStatementsCheck::findRParenLoc(const IfOrWhileStmt *S,
|
||||
/// Returns true if braces where added.
|
||||
bool BracesAroundStatementsCheck::checkStmt(
|
||||
const MatchFinder::MatchResult &Result, const Stmt *S,
|
||||
SourceLocation InitialLoc, SourceLocation EndLocHint) {
|
||||
SourceLocation StartLoc, SourceLocation EndLocHint) {
|
||||
|
||||
while (const auto *AS = dyn_cast<AttributedStmt>(S))
|
||||
S = AS->getSubStmt();
|
||||
@ -214,20 +214,20 @@ bool BracesAroundStatementsCheck::checkStmt(
|
||||
getTokenKind(StmtBeginLoc, SM, Context) == tok::l_brace)
|
||||
return false;
|
||||
|
||||
if (!InitialLoc.isValid())
|
||||
if (StartLoc.isInvalid())
|
||||
return false;
|
||||
|
||||
// Convert InitialLoc to file location, if it's on the same macro expansion
|
||||
// Convert StartLoc to file location, if it's on the same macro expansion
|
||||
// level as the start of the statement. We also need file locations for
|
||||
// Lexer::getLocForEndOfToken working properly.
|
||||
InitialLoc = Lexer::makeFileCharRange(
|
||||
CharSourceRange::getCharRange(InitialLoc, S->getBeginLoc()),
|
||||
SM, Context->getLangOpts())
|
||||
.getBegin();
|
||||
if (InitialLoc.isInvalid())
|
||||
StartLoc = Lexer::makeFileCharRange(
|
||||
CharSourceRange::getCharRange(StartLoc, S->getBeginLoc()), SM,
|
||||
Context->getLangOpts())
|
||||
.getBegin();
|
||||
if (StartLoc.isInvalid())
|
||||
return false;
|
||||
SourceLocation StartLoc =
|
||||
Lexer::getLocForEndOfToken(InitialLoc, 0, SM, Context->getLangOpts());
|
||||
StartLoc =
|
||||
Lexer::getLocForEndOfToken(StartLoc, 0, SM, Context->getLangOpts());
|
||||
|
||||
// StartLoc points at the location of the opening brace to be inserted.
|
||||
SourceLocation EndLoc;
|
||||
|
@ -30,8 +30,8 @@ public:
|
||||
private:
|
||||
void handleCastToBool(const ImplicitCastExpr *CastExpression,
|
||||
const Stmt *ParentStatement, ASTContext &Context);
|
||||
void handleCastFromBool(const ImplicitCastExpr *CastExpression,
|
||||
const ImplicitCastExpr *FurtherImplicitCastExpression,
|
||||
void handleCastFromBool(const ImplicitCastExpr *Cast,
|
||||
const ImplicitCastExpr *NextImplicitCast,
|
||||
ASTContext &Context);
|
||||
|
||||
const bool AllowIntegerConditions;
|
||||
|
@ -36,7 +36,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
void markRedeclarationsAsVisited(const FunctionDecl *FunctionDeclaration);
|
||||
void markRedeclarationsAsVisited(const FunctionDecl *OriginalDeclaration);
|
||||
|
||||
llvm::DenseSet<const FunctionDecl *> VisitedDeclarations;
|
||||
const bool IgnoreMacros;
|
||||
|
@ -29,7 +29,7 @@ public:
|
||||
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
|
||||
|
||||
private:
|
||||
void storeOptions(ClangTidyOptions::OptionMap &Options) override;
|
||||
void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
|
||||
|
||||
llvm::Regex NamespaceCommentPattern;
|
||||
const unsigned ShortNamespaceLines;
|
||||
|
@ -22,7 +22,7 @@ class SimplifyBooleanExprCheck : public ClangTidyCheck {
|
||||
public:
|
||||
SimplifyBooleanExprCheck(StringRef Name, ClangTidyContext *Context);
|
||||
|
||||
void storeOptions(ClangTidyOptions::OptionMap &Options) override;
|
||||
void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
|
||||
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
|
||||
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
|
||||
std::optional<TraversalKind> getCheckTraversalKind() const override {
|
||||
@ -60,7 +60,7 @@ private:
|
||||
const BinaryOperator *Inner, bool TryOfferFix,
|
||||
const Stmt *Parent, const ParenExpr *Parens);
|
||||
|
||||
void issueDiag(const ASTContext &Result, SourceLocation Loc,
|
||||
void issueDiag(const ASTContext &Context, SourceLocation Loc,
|
||||
StringRef Description, SourceRange ReplacementRange,
|
||||
StringRef Replacement);
|
||||
|
||||
|
@ -78,7 +78,7 @@ public:
|
||||
/// possible to catch multiple exception types by one 'catch' if they
|
||||
/// are a subclass of the 'catch'ed exception type.
|
||||
/// Returns 'true' if some exceptions were filtered, otherwise 'false'.
|
||||
bool filterByCatch(const Type *BaseClass, const ASTContext &Context);
|
||||
bool filterByCatch(const Type *HandlerTy, const ASTContext &Context);
|
||||
|
||||
/// Filter the set of thrown exception type against a set of ignored
|
||||
/// types that shall not be considered in the exception analysis.
|
||||
|
@ -62,7 +62,8 @@ private:
|
||||
No = false,
|
||||
};
|
||||
|
||||
State analyzeRecord(const CXXRecordDecl *RecDecl, DefaultableMemberKind Kind,
|
||||
State analyzeRecord(const CXXRecordDecl *RecordDecl,
|
||||
DefaultableMemberKind Kind,
|
||||
SkipMethods SkipMethods = SkipMethods::No);
|
||||
|
||||
static State analyzeFunctionEST(const FunctionDecl *FuncDecl,
|
||||
|
@ -42,8 +42,8 @@ enum class QualifierTarget {
|
||||
std::optional<FixItHint>
|
||||
addQualifierToVarDecl(const VarDecl &Var, const ASTContext &Context,
|
||||
DeclSpec::TQ Qualifier,
|
||||
QualifierTarget CT = QualifierTarget::Pointee,
|
||||
QualifierPolicy CP = QualifierPolicy::Left);
|
||||
QualifierTarget QualTarget = QualifierTarget::Pointee,
|
||||
QualifierPolicy QualPolicy = QualifierPolicy::Left);
|
||||
|
||||
// \brief Format a pointer to an expression
|
||||
std::string formatDereference(const Expr &ExprNode, const ASTContext &Context);
|
||||
|
Loading…
x
Reference in New Issue
Block a user