Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion clang-tools-extra/clang-tidy/ClangTidyModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class ClangTidyCheckFactories {
/// them a prefixed name.
class ClangTidyModule {
public:
virtual ~ClangTidyModule() {}
virtual ~ClangTidyModule() = default;

/// Implement this function in order to register all \c CheckFactories
/// belonging to this module.
Expand Down
2 changes: 1 addition & 1 deletion clang-tools-extra/clang-tidy/ClangTidyOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ class ClangTidyOptionsProvider {
static const char OptionsSourceTypeCheckCommandLineOption[];
static const char OptionsSourceTypeConfigCommandLineOption[];

virtual ~ClangTidyOptionsProvider() {}
virtual ~ClangTidyOptionsProvider() = default;

/// Returns global options, which are independent of the file.
virtual const ClangTidyGlobalOptions &getGlobalOptions() = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class ExpandModularHeadersPPCallbacks : public PPCallbacks {
ExpandModularHeadersPPCallbacks(
CompilerInstance *CI,
IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem> OverlayFS);
~ExpandModularHeadersPPCallbacks();
~ExpandModularHeadersPPCallbacks() override;

/// Returns the preprocessor that provides callbacks for the whole
/// translation unit, including the main file, textual headers, and modular
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ void DurationAdditionCheck::registerMatchers(MatchFinder *Finder) {
Finder->addMatcher(
binaryOperator(hasOperatorName("+"),
hasEitherOperand(expr(ignoringParenImpCasts(
callExpr(callee(functionDecl(TimeConversionFunction())
callExpr(callee(functionDecl(timeConversionFunction())
.bind("function_decl")))
.bind("call")))))
.bind("binop"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace clang::tidy::abseil {

void DurationComparisonCheck::registerMatchers(MatchFinder *Finder) {
auto Matcher = expr(comparisonOperatorWithCallee(functionDecl(
functionDecl(DurationConversionFunction())
functionDecl(durationConversionFunction())
.bind("function_decl"))))
.bind("binop");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace clang::tidy::abseil {

void DurationConversionCastCheck::registerMatchers(MatchFinder *Finder) {
auto CallMatcher = ignoringImpCasts(callExpr(
callee(functionDecl(DurationConversionFunction()).bind("func_decl")),
callee(functionDecl(durationConversionFunction()).bind("func_decl")),
hasArgument(0, expr().bind("arg"))));

Finder->addMatcher(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ static bool insideMacroDefinition(const MatchFinder::MatchResult &Result,

void DurationFactoryFloatCheck::registerMatchers(MatchFinder *Finder) {
Finder->addMatcher(
callExpr(callee(functionDecl(DurationFactoryFunction())),
callExpr(callee(functionDecl(durationFactoryFunction())),
hasArgument(0, anyOf(cxxStaticCastExpr(hasDestinationType(
realFloatingPointType())),
cStyleCastExpr(hasDestinationType(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ static std::optional<DurationScale> getNewScale(DurationScale OldScale,
void DurationFactoryScaleCheck::registerMatchers(MatchFinder *Finder) {
Finder->addMatcher(
callExpr(
callee(functionDecl(DurationFactoryFunction()).bind("call_decl")),
callee(functionDecl(durationFactoryFunction()).bind("call_decl")),
hasArgument(
0,
ignoringImpCasts(anyOf(
Expand Down
10 changes: 5 additions & 5 deletions clang-tools-extra/clang-tidy/abseil/DurationRewriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ bool isInMacro(const ast_matchers::MatchFinder::MatchResult &Result,
const Expr *E);

AST_MATCHER_FUNCTION(ast_matchers::internal::Matcher<FunctionDecl>,
DurationConversionFunction) {
durationConversionFunction) {
using namespace clang::ast_matchers;
return functionDecl(
hasAnyName("::absl::ToDoubleHours", "::absl::ToDoubleMinutes",
Expand All @@ -108,15 +108,15 @@ AST_MATCHER_FUNCTION(ast_matchers::internal::Matcher<FunctionDecl>,
}

AST_MATCHER_FUNCTION(ast_matchers::internal::Matcher<FunctionDecl>,
DurationFactoryFunction) {
durationFactoryFunction) {
using namespace clang::ast_matchers;
return functionDecl(hasAnyName("::absl::Nanoseconds", "::absl::Microseconds",
"::absl::Milliseconds", "::absl::Seconds",
"::absl::Minutes", "::absl::Hours"));
}

AST_MATCHER_FUNCTION(ast_matchers::internal::Matcher<FunctionDecl>,
TimeConversionFunction) {
timeConversionFunction) {
using namespace clang::ast_matchers;
return functionDecl(hasAnyName(
"::absl::ToUnixHours", "::absl::ToUnixMinutes", "::absl::ToUnixSeconds",
Expand All @@ -125,12 +125,12 @@ AST_MATCHER_FUNCTION(ast_matchers::internal::Matcher<FunctionDecl>,

AST_MATCHER_FUNCTION_P(ast_matchers::internal::Matcher<Stmt>,
comparisonOperatorWithCallee,
ast_matchers::internal::Matcher<Decl>, funcDecl) {
ast_matchers::internal::Matcher<Decl>, FuncDecl) {
using namespace clang::ast_matchers;
return binaryOperator(
anyOf(hasOperatorName(">"), hasOperatorName(">="), hasOperatorName("=="),
hasOperatorName("<="), hasOperatorName("<")),
hasEitherOperand(ignoringImpCasts(callExpr(callee(funcDecl)))));
hasEitherOperand(ignoringImpCasts(callExpr(callee(FuncDecl)))));
}

} // namespace clang::tidy::abseil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ void DurationSubtractionCheck::registerMatchers(MatchFinder *Finder) {
Finder->addMatcher(
binaryOperator(
hasOperatorName("-"),
hasLHS(callExpr(callee(functionDecl(DurationConversionFunction())
hasLHS(callExpr(callee(functionDecl(durationConversionFunction())
.bind("function_decl")),
hasArgument(0, expr().bind("lhs_arg")))))
.bind("binop"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace clang::tidy::abseil {
void TimeComparisonCheck::registerMatchers(MatchFinder *Finder) {
auto Matcher =
expr(comparisonOperatorWithCallee(functionDecl(
functionDecl(TimeConversionFunction()).bind("function_decl"))))
functionDecl(timeConversionFunction()).bind("function_decl"))))
.bind("binop");

Finder->addMatcher(Matcher, this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ void UpgradeDurationConversionsCheck::registerMatchers(MatchFinder *Finder) {
hasCastKind(CK_UserDefinedConversion)))),
hasParent(callExpr(
callee(functionDecl(
DurationFactoryFunction(),
durationFactoryFunction(),
unless(hasParent(functionTemplateDecl())))),
hasArgument(0, expr().bind("arg")))))
.bind("OuterExpr")),
Expand Down
2 changes: 1 addition & 1 deletion clang-tools-extra/clang-tidy/android/CloexecCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class CloexecCheck : public ClangTidyCheck {
/// \param Mode The required mode char.
/// \param ArgPos The 0-based position of the flag argument.
void insertStringFlag(const ast_matchers::MatchFinder::MatchResult &Result,
const char Mode, const int ArgPos);
char Mode, int ArgPos);

/// Helper function to get the spelling of a particular argument.
StringRef getSpellingArg(const ast_matchers::MatchFinder::MatchResult &Result,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class NarrowingConversionsCheck : public ClangTidyCheck {
void diagNarrowIntegerConstantToSignedInt(SourceLocation SourceLoc,
const Expr &Lhs, const Expr &Rhs,
const llvm::APSInt &Value,
const uint64_t HexBits);
uint64_t HexBits);

void diagNarrowConstant(SourceLocation SourceLoc, const Expr &Lhs,
const Expr &Rhs);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,7 @@ void NotNullTerminatedResultCheck::check(
if (Name.starts_with("mem") || Name.starts_with("wmem"))
memoryHandlerFunctionFix(Name, Result);
else if (Name == "strerror_s")
strerror_sFix(Result);
strerrorSFix(Result);
else if (Name.ends_with("ncmp"))
ncmpFix(Name, Result);
else if (Name.ends_with("xfrm"))
Expand Down Expand Up @@ -852,7 +852,7 @@ void NotNullTerminatedResultCheck::memoryHandlerFunctionFix(
if (Name.ends_with("cpy")) {
memcpyFix(Name, Result, Diag);
} else if (Name.ends_with("cpy_s")) {
memcpy_sFix(Name, Result, Diag);
memcpySFix(Name, Result, Diag);
} else if (Name.ends_with("move")) {
memmoveFix(Name, Result, Diag);
} else if (Name.ends_with("move_s")) {
Expand Down Expand Up @@ -889,7 +889,7 @@ void NotNullTerminatedResultCheck::memcpyFix(
insertNullTerminatorExpr(Name, Result, Diag);
}

void NotNullTerminatedResultCheck::memcpy_sFix(
void NotNullTerminatedResultCheck::memcpySFix(
StringRef Name, const MatchFinder::MatchResult &Result,
DiagnosticBuilder &Diag) {
bool IsOverflows = isDestCapacityFix(Result, Diag);
Expand Down Expand Up @@ -950,7 +950,7 @@ void NotNullTerminatedResultCheck::memmoveFix(
lengthArgHandle(LengthHandleKind::Increase, Result, Diag);
}

void NotNullTerminatedResultCheck::strerror_sFix(
void NotNullTerminatedResultCheck::strerrorSFix(
const MatchFinder::MatchResult &Result) {
auto Diag =
diag(Result.Nodes.getNodeAs<CallExpr>(FunctionExprName)->getBeginLoc(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ class NotNullTerminatedResultCheck : public ClangTidyCheck {
void memcpyFix(StringRef Name,
const ast_matchers::MatchFinder::MatchResult &Result,
DiagnosticBuilder &Diag);
void memcpy_sFix(StringRef Name,
const ast_matchers::MatchFinder::MatchResult &Result,
DiagnosticBuilder &Diag);
void memcpySFix(StringRef Name,
const ast_matchers::MatchFinder::MatchResult &Result,
DiagnosticBuilder &Diag);
void memchrFix(StringRef Name,
const ast_matchers::MatchFinder::MatchResult &Result);
void memmoveFix(StringRef Name,
const ast_matchers::MatchFinder::MatchResult &Result,
DiagnosticBuilder &Diag) const;
void strerror_sFix(const ast_matchers::MatchFinder::MatchResult &Result);
void strerrorSFix(const ast_matchers::MatchFinder::MatchResult &Result);
void ncmpFix(StringRef Name,
const ast_matchers::MatchFinder::MatchResult &Result);
void xfrmFix(StringRef Name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ struct DenseMapInfo<
using ClassDefId =
clang::tidy::cppcoreguidelines::SpecialMemberFunctionsCheck::ClassDefId;

static inline ClassDefId getEmptyKey() {
static ClassDefId getEmptyKey() {
return {DenseMapInfo<clang::SourceLocation>::getEmptyKey(), "EMPTY"};
}

static inline ClassDefId getTombstoneKey() {
static ClassDefId getTombstoneKey() {
return {DenseMapInfo<clang::SourceLocation>::getTombstoneKey(),
"TOMBSTONE"};
}
Expand Down
2 changes: 1 addition & 1 deletion clang-tools-extra/clang-tidy/google/TodoCommentCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace clang::tidy::google::readability {
class TodoCommentCheck : public ClangTidyCheck {
public:
TodoCommentCheck(StringRef Name, ClangTidyContext *Context);
~TodoCommentCheck();
~TodoCommentCheck() override;

void registerPPCallbacks(const SourceManager &SM, Preprocessor *PP,
Preprocessor *ModuleExpanderPP) override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace clang::tidy::misc {
class ConfusableIdentifierCheck : public ClangTidyCheck {
public:
ConfusableIdentifierCheck(StringRef Name, ClangTidyContext *Context);
~ConfusableIdentifierCheck();
~ConfusableIdentifierCheck() override;

void registerMatchers(ast_matchers::MatchFinder *Finder) override;
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace clang::tidy::misc {
class MisleadingBidirectionalCheck : public ClangTidyCheck {
public:
MisleadingBidirectionalCheck(StringRef Name, ClangTidyContext *Context);
~MisleadingBidirectionalCheck();
~MisleadingBidirectionalCheck() override;

void registerPPCallbacks(const SourceManager &SM, Preprocessor *PP,
Preprocessor *ModuleExpanderPP) override;
Expand Down
2 changes: 1 addition & 1 deletion clang-tools-extra/clang-tidy/misc/MisleadingIdentifier.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace clang::tidy::misc {
class MisleadingIdentifierCheck : public ClangTidyCheck {
public:
MisleadingIdentifierCheck(StringRef Name, ClangTidyContext *Context);
~MisleadingIdentifierCheck();
~MisleadingIdentifierCheck() override;

void registerMatchers(ast_matchers::MatchFinder *Finder) override;
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
Expand Down
2 changes: 1 addition & 1 deletion clang-tools-extra/clang-tidy/misc/UnusedParametersCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace clang::tidy::misc {
class UnusedParametersCheck : public ClangTidyCheck {
public:
UnusedParametersCheck(StringRef Name, ClangTidyContext *Context);
~UnusedParametersCheck();
~UnusedParametersCheck() override;
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
Expand Down
6 changes: 3 additions & 3 deletions clang-tools-extra/clang-tidy/modernize/LoopConvertUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ bool ForLoopIndexUseVisitor::TraverseLambdaCapture(LambdaExpr *LE,
C->getLocation()));
}
if (VDecl->isInitCapture())
TraverseStmtImpl(cast<VarDecl>(VDecl)->getInit());
traverseStmtImpl(cast<VarDecl>(VDecl)->getInit());
}
return VisitorBase::TraverseLambdaCapture(LE, C, Init);
}
Expand Down Expand Up @@ -815,7 +815,7 @@ bool ForLoopIndexUseVisitor::VisitDeclStmt(DeclStmt *S) {
return true;
}

bool ForLoopIndexUseVisitor::TraverseStmtImpl(Stmt *S) {
bool ForLoopIndexUseVisitor::traverseStmtImpl(Stmt *S) {
// All this pointer swapping is a mechanism for tracking immediate parentage
// of Stmts.
const Stmt *OldNextParent = NextStmtParent;
Expand All @@ -838,7 +838,7 @@ bool ForLoopIndexUseVisitor::TraverseStmt(Stmt *S) {
return true;
}
}
return TraverseStmtImpl(S);
return traverseStmtImpl(S);
}

std::string VariableNamer::createIndexName() {
Expand Down
2 changes: 1 addition & 1 deletion clang-tools-extra/clang-tidy/modernize/LoopConvertUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ class ForLoopIndexUseVisitor
bool VisitDeclStmt(DeclStmt *S);
bool TraverseStmt(Stmt *S);

bool TraverseStmtImpl(Stmt *S);
bool traverseStmtImpl(Stmt *S);

/// Add an expression to the list of expressions on which the container
/// expression depends.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@ class NoexceptDestructorCheck : public NoexceptFunctionBaseCheck {
void registerMatchers(ast_matchers::MatchFinder *Finder) override;

private:
DiagnosticBuilder
reportMissingNoexcept(const FunctionDecl *FuncDecl) final override;
DiagnosticBuilder reportMissingNoexcept(const FunctionDecl *FuncDecl) final;
void reportNoexceptEvaluatedToFalse(const FunctionDecl *FuncDecl,
const Expr *NoexceptExpr) final override;
const Expr *NoexceptExpr) final;
};

} // namespace clang::tidy::performance
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ class NoexceptFunctionBaseCheck : public ClangTidyCheck {
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
return LangOpts.CPlusPlus11 && LangOpts.CXXExceptions;
}
void
check(const ast_matchers::MatchFinder::MatchResult &Result) final override;
void check(const ast_matchers::MatchFinder::MatchResult &Result) final;
std::optional<TraversalKind> getCheckTraversalKind() const override {
return TK_IgnoreUnlessSpelledInSource;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,9 @@ class NoexceptMoveConstructorCheck : public NoexceptFunctionBaseCheck {
void registerMatchers(ast_matchers::MatchFinder *Finder) override;

private:
DiagnosticBuilder
reportMissingNoexcept(const FunctionDecl *FuncDecl) final override;
DiagnosticBuilder reportMissingNoexcept(const FunctionDecl *FuncDecl) final;
void reportNoexceptEvaluatedToFalse(const FunctionDecl *FuncDecl,
const Expr *NoexceptExpr) final override;
const Expr *NoexceptExpr) final;
};

} // namespace clang::tidy::performance
Expand Down
5 changes: 2 additions & 3 deletions clang-tools-extra/clang-tidy/performance/NoexceptSwapCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@ class NoexceptSwapCheck : public NoexceptFunctionBaseCheck {
void registerMatchers(ast_matchers::MatchFinder *Finder) override;

private:
DiagnosticBuilder
reportMissingNoexcept(const FunctionDecl *FuncDecl) final override;
DiagnosticBuilder reportMissingNoexcept(const FunctionDecl *FuncDecl) final;
void reportNoexceptEvaluatedToFalse(const FunctionDecl *FuncDecl,
const Expr *NoexceptExpr) final override;
const Expr *NoexceptExpr) final;
};

} // namespace clang::tidy::performance
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ class AvoidReturnWithVoidValueCheck : public ClangTidyCheck {
}
void storeOptions(ClangTidyOptions::OptionMap &Opts) override;

private:
bool IgnoreMacros;
bool StrictMode;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ enum StyleKind : int;
class IdentifierNamingCheck final : public RenamerClangTidyCheck {
public:
IdentifierNamingCheck(StringRef Name, ClangTidyContext *Context);
~IdentifierNamingCheck();
~IdentifierNamingCheck() override;

void storeOptions(ClangTidyOptions::OptionMap &Opts) override;

Expand Down
2 changes: 1 addition & 1 deletion clang-tools-extra/clang-tidy/utils/BracesAroundStatement.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ struct BraceInsertionHints {
/// The algorithm computing them respects comment before and after the statement
/// and adds line breaks before the braces accordingly.
BraceInsertionHints
getBraceInsertionsHints(const Stmt *const S, const LangOptions &LangOpts,
getBraceInsertionsHints(const Stmt *S, const LangOptions &LangOpts,
const SourceManager &SM, SourceLocation StartLoc,
SourceLocation EndLocHint = SourceLocation());

Expand Down
5 changes: 2 additions & 3 deletions clang-tools-extra/clang-tidy/utils/IncludeSorter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,8 @@ static int compareHeaders(StringRef LHS, StringRef RHS,
return LHS.compare(RHS);
}

IncludeSorter::IncludeSorter(const SourceManager *SourceMgr,
const FileID FileID, StringRef FileName,
IncludeStyle Style)
IncludeSorter::IncludeSorter(const SourceManager *SourceMgr, FileID FileID,
StringRef FileName, IncludeStyle Style)
: SourceMgr(SourceMgr), Style(Style), CurrentFileID(FileID),
CanonicalFile(makeCanonicalName(FileName, Style)) {}

Expand Down
Loading