Skip to content

Commit 4d97b78

Browse files
authored
[clang-tidy][NFC] Enable misc-const-correctness rule in clang-tidy codebase (#167172)
After successful `misc-const-correctness` cleanup (last patch #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.
1 parent a52e1af commit 4d97b78

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Checks: >
99
-bugprone-narrowing-conversions,
1010
-bugprone-unchecked-optional-access,
1111
-bugprone-unused-return-value,
12+
misc-const-correctness,
1213
modernize-*,
1314
-modernize-avoid-c-arrays,
1415
-modernize-pass-by-value,

clang-tools-extra/clang-tidy/utils/ExceptionAnalyzer.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -600,13 +600,14 @@ ExceptionAnalyzer::throwsException(const Stmt *St,
600600
// whether the call itself throws.
601601
if (const auto *Call = dyn_cast<CallExpr>(St)) {
602602
if (const FunctionDecl *Func = Call->getDirectCallee()) {
603-
ExceptionInfo Excs =
603+
const ExceptionInfo Excs =
604604
throwsException(Func, Caught, CallStack, Call->getBeginLoc());
605605
Results.merge(Excs);
606606
}
607607
} else if (const auto *Construct = dyn_cast<CXXConstructExpr>(St)) {
608-
ExceptionInfo Excs = throwsException(Construct->getConstructor(), Caught,
609-
CallStack, Construct->getBeginLoc());
608+
const ExceptionInfo Excs =
609+
throwsException(Construct->getConstructor(), Caught, CallStack,
610+
Construct->getBeginLoc());
610611
Results.merge(Excs);
611612
}
612613
}

0 commit comments

Comments
 (0)