[clang-tools-extra] 4d97b78 - [clang-tidy][NFC] Enable misc-const-correctness rule in clang-tidy codebase (#167172)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 21 12:36:45 PST 2025
Author: Baranov Victor
Date: 2025-11-21T23:36:41+03:00
New Revision: 4d97b78b8fa1f5e1a9ea1d7ab5ac181a239e0813
URL: https://github.com/llvm/llvm-project/commit/4d97b78b8fa1f5e1a9ea1d7ab5ac181a239e0813
DIFF: https://github.com/llvm/llvm-project/commit/4d97b78b8fa1f5e1a9ea1d7ab5ac181a239e0813.diff
LOG: [clang-tidy][NFC] Enable misc-const-correctness rule in clang-tidy codebase (#167172)
After successful `misc-const-correctness` cleanup (last patch
https://github.com/llvm/llvm-project/pull/167131), we can enable
`misc-const-correctness` rule for the whole project.
During cleanup, I didn't encounter any false positives so it's safe to
assume that we will have minimal FP in the future.
Added:
Modified:
clang-tools-extra/clang-tidy/.clang-tidy
clang-tools-extra/clang-tidy/utils/ExceptionAnalyzer.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/clang-tidy/.clang-tidy b/clang-tools-extra/clang-tidy/.clang-tidy
index 34eeec2f2a914..82d0df8697178 100644
--- a/clang-tools-extra/clang-tidy/.clang-tidy
+++ b/clang-tools-extra/clang-tidy/.clang-tidy
@@ -9,6 +9,7 @@ Checks: >
-bugprone-narrowing-conversions,
-bugprone-unchecked-optional-access,
-bugprone-unused-return-value,
+ misc-const-correctness,
modernize-*,
-modernize-avoid-c-arrays,
-modernize-pass-by-value,
diff --git a/clang-tools-extra/clang-tidy/utils/ExceptionAnalyzer.cpp b/clang-tools-extra/clang-tidy/utils/ExceptionAnalyzer.cpp
index 028aa427e29a4..f766a1bca655c 100644
--- a/clang-tools-extra/clang-tidy/utils/ExceptionAnalyzer.cpp
+++ b/clang-tools-extra/clang-tidy/utils/ExceptionAnalyzer.cpp
@@ -600,13 +600,14 @@ ExceptionAnalyzer::throwsException(const Stmt *St,
// whether the call itself throws.
if (const auto *Call = dyn_cast<CallExpr>(St)) {
if (const FunctionDecl *Func = Call->getDirectCallee()) {
- ExceptionInfo Excs =
+ const ExceptionInfo Excs =
throwsException(Func, Caught, CallStack, Call->getBeginLoc());
Results.merge(Excs);
}
} else if (const auto *Construct = dyn_cast<CXXConstructExpr>(St)) {
- ExceptionInfo Excs = throwsException(Construct->getConstructor(), Caught,
- CallStack, Construct->getBeginLoc());
+ const ExceptionInfo Excs =
+ throwsException(Construct->getConstructor(), Caught, CallStack,
+ Construct->getBeginLoc());
Results.merge(Excs);
}
}
More information about the cfe-commits
mailing list