[clang-tools-extra] 24a7587 - [clang-tidy][NFC] Fix readability-make-member-function-const findings
Piotr Zegar via cfe-commits
cfe-commits at lists.llvm.org
Sun Aug 27 01:53:53 PDT 2023
Author: Piotr Zegar
Date: 2023-08-27T08:52:11Z
New Revision: 24a7587b79648002ad47e4de425ad498fb863d60
URL: https://github.com/llvm/llvm-project/commit/24a7587b79648002ad47e4de425ad498fb863d60
DIFF: https://github.com/llvm/llvm-project/commit/24a7587b79648002ad47e4de425ad498fb863d60.diff
LOG: [clang-tidy][NFC] Fix readability-make-member-function-const findings
Fix issues found by clang-tidy in clang-tidy source directory.
Added:
Modified:
clang-tools-extra/clang-tidy/altera/StructPackAlignCheck.cpp
clang-tools-extra/clang-tidy/altera/StructPackAlignCheck.h
clang-tools-extra/clang-tidy/altera/UnrollLoopsCheck.cpp
clang-tools-extra/clang-tidy/altera/UnrollLoopsCheck.h
clang-tools-extra/clang-tidy/bugprone/NotNullTerminatedResultCheck.cpp
clang-tools-extra/clang-tidy/bugprone/NotNullTerminatedResultCheck.h
clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.h
Removed:
################################################################################
diff --git a/clang-tools-extra/clang-tidy/altera/StructPackAlignCheck.cpp b/clang-tools-extra/clang-tidy/altera/StructPackAlignCheck.cpp
index ac458d4b5d35d9..0b7887ecfdfac6 100644
--- a/clang-tools-extra/clang-tidy/altera/StructPackAlignCheck.cpp
+++ b/clang-tools-extra/clang-tidy/altera/StructPackAlignCheck.cpp
@@ -24,7 +24,7 @@ void StructPackAlignCheck::registerMatchers(MatchFinder *Finder) {
}
CharUnits
-StructPackAlignCheck::computeRecommendedAlignment(CharUnits MinByteSize) {
+StructPackAlignCheck::computeRecommendedAlignment(CharUnits MinByteSize) const {
CharUnits NewAlign = CharUnits::fromQuantity(1);
if (!MinByteSize.isPowerOfTwo()) {
int MSB = (int)MinByteSize.getQuantity();
diff --git a/clang-tools-extra/clang-tidy/altera/StructPackAlignCheck.h b/clang-tools-extra/clang-tidy/altera/StructPackAlignCheck.h
index f46d8e3b875a9b..5edfd40ef77bc6 100644
--- a/clang-tools-extra/clang-tidy/altera/StructPackAlignCheck.h
+++ b/clang-tools-extra/clang-tidy/altera/StructPackAlignCheck.h
@@ -29,7 +29,7 @@ class StructPackAlignCheck : public ClangTidyCheck {
private:
const unsigned MaxConfiguredAlignment;
- CharUnits computeRecommendedAlignment(CharUnits MinByteSize);
+ CharUnits computeRecommendedAlignment(CharUnits MinByteSize) const;
};
} // namespace clang::tidy::altera
diff --git a/clang-tools-extra/clang-tidy/altera/UnrollLoopsCheck.cpp b/clang-tools-extra/clang-tidy/altera/UnrollLoopsCheck.cpp
index 7bd12adacc4065..e25708d4c05554 100644
--- a/clang-tools-extra/clang-tidy/altera/UnrollLoopsCheck.cpp
+++ b/clang-tools-extra/clang-tidy/altera/UnrollLoopsCheck.cpp
@@ -246,7 +246,7 @@ bool UnrollLoopsCheck::extractValue(int &Value, const BinaryOperator *Op,
}
bool UnrollLoopsCheck::exprHasLargeNumIterations(const Expr *Expression,
- const ASTContext *Context) {
+ const ASTContext *Context) const {
Expr::EvalResult Result;
if (Expression->EvaluateAsRValue(Result, *Context)) {
if (!Result.Val.isInt())
diff --git a/clang-tools-extra/clang-tidy/altera/UnrollLoopsCheck.h b/clang-tools-extra/clang-tidy/altera/UnrollLoopsCheck.h
index e4bf7464c688ef..0d8306e8437b73 100644
--- a/clang-tools-extra/clang-tidy/altera/UnrollLoopsCheck.h
+++ b/clang-tools-extra/clang-tidy/altera/UnrollLoopsCheck.h
@@ -56,7 +56,7 @@ class UnrollLoopsCheck : public ClangTidyCheck {
/// bound on the number of loops is greater than max_loop_iterations or not.
/// If the expression is not evaluatable or not an integer, returns false.
bool exprHasLargeNumIterations(const Expr *Expression,
- const ASTContext *Context);
+ const ASTContext *Context) const;
/// Returns the type of unrolling, if any, associated with the given
/// statement.
enum UnrollType unrollType(const Stmt *Statement, ASTContext *Context);
diff --git a/clang-tools-extra/clang-tidy/bugprone/NotNullTerminatedResultCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/NotNullTerminatedResultCheck.cpp
index ccc28efca68cda..44db5029fd9936 100644
--- a/clang-tools-extra/clang-tidy/bugprone/NotNullTerminatedResultCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/NotNullTerminatedResultCheck.cpp
@@ -939,7 +939,7 @@ void NotNullTerminatedResultCheck::memchrFix(
void NotNullTerminatedResultCheck::memmoveFix(
StringRef Name, const MatchFinder::MatchResult &Result,
- DiagnosticBuilder &Diag) {
+ DiagnosticBuilder &Diag) const {
bool IsOverflows = isDestCapacityFix(Result, Diag);
if (UseSafeFunctions && isKnownDest(Result)) {
diff --git a/clang-tools-extra/clang-tidy/bugprone/NotNullTerminatedResultCheck.h b/clang-tools-extra/clang-tidy/bugprone/NotNullTerminatedResultCheck.h
index caed870cd1ca56..1eeead02b17ab4 100644
--- a/clang-tools-extra/clang-tidy/bugprone/NotNullTerminatedResultCheck.h
+++ b/clang-tools-extra/clang-tidy/bugprone/NotNullTerminatedResultCheck.h
@@ -50,7 +50,7 @@ class NotNullTerminatedResultCheck : public ClangTidyCheck {
const ast_matchers::MatchFinder::MatchResult &Result);
void memmoveFix(StringRef Name,
const ast_matchers::MatchFinder::MatchResult &Result,
- DiagnosticBuilder &Diag);
+ DiagnosticBuilder &Diag) const;
void strerror_sFix(const ast_matchers::MatchFinder::MatchResult &Result);
void ncmpFix(StringRef Name,
const ast_matchers::MatchFinder::MatchResult &Result);
diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.h b/clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.h
index 981a73a20611af..6042f0fd6cb054 100644
--- a/clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.h
+++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.h
@@ -47,7 +47,7 @@ class SpecialMemberFunctionsCheck : public ClangTidyCheck {
SpecialMemberFunctionKind FunctionKind;
bool IsDeleted;
- bool operator==(const SpecialMemberFunctionData &Other) {
+ bool operator==(const SpecialMemberFunctionData &Other) const {
return (Other.FunctionKind == FunctionKind) &&
(Other.IsDeleted == IsDeleted);
}
More information about the cfe-commits
mailing list