Skip to content

Commit c368372

Browse files
committed
[clang-tidy][NFC] Enable readability-convert-member-functions-to-static in the codebase
1 parent 4eec28c commit c368372

30 files changed

+105
-96
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ Checks: >
2323
-readability-avoid-nested-conditional-operator,
2424
-readability-braces-around-statements,
2525
-readability-container-contains,
26-
-readability-convert-member-functions-to-static,
2726
-readability-else-after-return,
2827
-readability-function-cognitive-complexity,
2928
-readability-identifier-length,

clang-tools-extra/clang-tidy/ClangTidyProfiling.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ class ClangTidyProfiling {
3636
private:
3737
std::optional<StorageParams> Storage;
3838

39-
void printUserFriendlyTable(llvm::raw_ostream &OS, llvm::TimerGroup &TG);
39+
static void printUserFriendlyTable(llvm::raw_ostream &OS,
40+
llvm::TimerGroup &TG);
4041
void printAsJSON(llvm::raw_ostream &OS, llvm::TimerGroup &TG);
4142
void storeProfileData(llvm::TimerGroup &TG);
4243

clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class ExpandModularHeadersPPCallbacks::FileRecorder {
5151

5252
/// Makes sure we have contents for all the files we were interested in.
5353
/// Ideally `FilesToRecord` should be empty.
54-
void checkAllFilesRecorded() {
54+
static void checkAllFilesRecorded() {
5555
LLVM_DEBUG({
5656
for (auto FileEntry : FilesToRecord)
5757
llvm::dbgs() << "Did not record contents for input file: "

clang-tools-extra/clang-tidy/altera/IdDependentBackwardBranchCheck.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class IdDependentBackwardBranchCheck : public ClangTidyCheck {
6565
const MemberExpr *MemExpr,
6666
const FieldDecl *PotentialField);
6767
/// Returns the loop type.
68-
LoopType getLoopType(const Stmt *Loop);
68+
static LoopType getLoopType(const Stmt *Loop);
6969

7070
public:
7171
IdDependentBackwardBranchCheck(StringRef Name, ClangTidyContext *Context)

clang-tools-extra/clang-tidy/altera/KernelNameRestrictionCheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class KernelNameRestrictionPPCallbacks : public PPCallbacks {
3737
private:
3838
/// Returns true if the name of the file with path FileName is 'kernel.cl',
3939
/// 'verilog.cl', or 'vhdl.cl'. The file name check is case insensitive.
40-
bool fileNameIsRestricted(StringRef FileName);
40+
static bool fileNameIsRestricted(StringRef FileName);
4141

4242
struct IncludeDirective {
4343
SourceLocation Loc; // Location in the include directive.

clang-tools-extra/clang-tidy/altera/UnrollLoopsCheck.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ class UnrollLoopsCheck : public ClangTidyCheck {
4444
/// Attempts to extract an integer value from either side of the
4545
/// BinaryOperator. Returns true and saves the result to &value if successful,
4646
/// returns false otherwise.
47-
bool extractValue(int &Value, const BinaryOperator *Op,
48-
const ASTContext *Context);
47+
static bool extractValue(int &Value, const BinaryOperator *Op,
48+
const ASTContext *Context);
4949
/// Returns true if the given loop statement has a large number of iterations,
5050
/// as determined by the integer value in the loop's condition expression,
5151
/// if one exists.
@@ -59,13 +59,14 @@ class UnrollLoopsCheck : public ClangTidyCheck {
5959
const ASTContext *Context) const;
6060
/// Returns the type of unrolling, if any, associated with the given
6161
/// statement.
62-
enum UnrollType unrollType(const Stmt *Statement, ASTContext *Context);
62+
static enum UnrollType unrollType(const Stmt *Statement, ASTContext *Context);
6363
/// Returns the condition expression within a given for statement. If there is
6464
/// none, or if the Statement is not a loop, then returns a NULL pointer.
65-
const Expr *getCondExpr(const Stmt *Statement);
65+
static const Expr *getCondExpr(const Stmt *Statement);
6666
/// Returns True if the loop statement has known bounds.
67-
bool hasKnownBounds(const Stmt *Statement, const IntegerLiteral *CXXLoopBound,
68-
const ASTContext *Context);
67+
static bool hasKnownBounds(const Stmt *Statement,
68+
const IntegerLiteral *CXXLoopBound,
69+
const ASTContext *Context);
6970
void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
7071
};
7172

clang-tools-extra/clang-tidy/android/CloexecCheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ void CloexecCheck::insertStringFlag(
9898
}
9999

100100
StringRef CloexecCheck::getSpellingArg(const MatchFinder::MatchResult &Result,
101-
int N) const {
101+
int N) {
102102
const auto *MatchedCall = Result.Nodes.getNodeAs<CallExpr>(FuncBindingStr);
103103
const SourceManager &SM = *Result.SourceManager;
104104
return Lexer::getSourceText(

clang-tools-extra/clang-tidy/android/CloexecCheck.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ class CloexecCheck : public ClangTidyCheck {
8585
const char Mode, const int ArgPos);
8686

8787
/// Helper function to get the spelling of a particular argument.
88-
StringRef getSpellingArg(const ast_matchers::MatchFinder::MatchResult &Result,
89-
int N) const;
88+
static StringRef
89+
getSpellingArg(const ast_matchers::MatchFinder::MatchResult &Result, int N);
9090

9191
/// Binding name of the FuncDecl of a function call.
9292
static const char *FuncDeclBindingStr;

clang-tools-extra/clang-tidy/bugprone/AssignmentInIfConditionCheck.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,14 @@ void AssignmentInIfConditionCheck::check(
3535
: Check(Check) {}
3636

3737
// Dont traverse into any lambda expressions.
38-
bool TraverseLambdaExpr(LambdaExpr *, DataRecursionQueue * = nullptr) {
38+
static bool TraverseLambdaExpr(LambdaExpr *,
39+
DataRecursionQueue * = nullptr) {
3940
return true;
4041
}
4142

4243
// Dont traverse into any requires expressions.
43-
bool TraverseRequiresExpr(RequiresExpr *,
44-
DataRecursionQueue * = nullptr) {
44+
static bool TraverseRequiresExpr(RequiresExpr *,
45+
DataRecursionQueue * = nullptr) {
4546
return true;
4647
}
4748

clang-tools-extra/clang-tidy/bugprone/BranchCloneCheck.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,28 +50,32 @@ static bool isFallthroughSwitchBranch(const SwitchBranch &Branch) {
5050
struct SwitchCaseVisitor : RecursiveASTVisitor<SwitchCaseVisitor> {
5151
using RecursiveASTVisitor<SwitchCaseVisitor>::DataRecursionQueue;
5252

53-
bool TraverseLambdaExpr(LambdaExpr *, DataRecursionQueue * = nullptr) {
53+
static bool TraverseLambdaExpr(LambdaExpr *,
54+
DataRecursionQueue * = nullptr) {
5455
return true; // Ignore lambdas
5556
}
5657

57-
bool TraverseDecl(Decl *) {
58+
static bool TraverseDecl(Decl *) {
5859
return true; // No need to check declarations
5960
}
6061

61-
bool TraverseSwitchStmt(SwitchStmt *, DataRecursionQueue * = nullptr) {
62+
static bool TraverseSwitchStmt(SwitchStmt *,
63+
DataRecursionQueue * = nullptr) {
6264
return true; // Ignore sub-switches
6365
}
6466

6567
// NOLINTNEXTLINE(readability-identifier-naming) - FIXME
66-
bool TraverseSwitchCase(SwitchCase *, DataRecursionQueue * = nullptr) {
68+
static bool TraverseSwitchCase(SwitchCase *,
69+
DataRecursionQueue * = nullptr) {
6770
return true; // Ignore cases
6871
}
6972

70-
bool TraverseDefaultStmt(DefaultStmt *, DataRecursionQueue * = nullptr) {
73+
static bool TraverseDefaultStmt(DefaultStmt *,
74+
DataRecursionQueue * = nullptr) {
7175
return true; // Ignore defaults
7276
}
7377

74-
bool TraverseAttributedStmt(AttributedStmt *S) {
78+
static bool TraverseAttributedStmt(AttributedStmt *S) {
7579
if (!S)
7680
return true;
7781

0 commit comments

Comments
 (0)