diff options
| author | Baranov Victor <bar.victor.2002@gmail.com> | 2025-11-21 23:36:41 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-21 23:36:41 +0300 |
| commit | 4d97b78b8fa1f5e1a9ea1d7ab5ac181a239e0813 (patch) | |
| tree | c4fd59fa814cafcfb8a485dce94cc39841dc5994 | |
| parent | a52e1af7f766e26a78d10d31da98af041dd66410 (diff) | |
[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.
| -rw-r--r-- | clang-tools-extra/clang-tidy/.clang-tidy | 1 | ||||
| -rw-r--r-- | clang-tools-extra/clang-tidy/utils/ExceptionAnalyzer.cpp | 7 |
2 files changed, 5 insertions, 3 deletions
diff --git a/clang-tools-extra/clang-tidy/.clang-tidy b/clang-tools-extra/clang-tidy/.clang-tidy index 34eeec2f2a91..82d0df869717 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 028aa427e29a..f766a1bca655 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); } } |
