Skip to content

Commit 74c7a62

Browse files
committed
[clang-tidy][NFC] fix typo in ExceptionAnalyzer; replace count()>0 with contains
1 parent 3f9d02a commit 74c7a62

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ namespace {
2020

2121
AST_MATCHER_P(FunctionDecl, isEnabled, llvm::StringSet<>,
2222
FunctionsThatShouldNotThrow) {
23-
return FunctionsThatShouldNotThrow.count(Node.getNameAsString()) > 0;
23+
return FunctionsThatShouldNotThrow.contains(Node.getNameAsString());
2424
}
2525

2626
AST_MATCHER(FunctionDecl, isExplicitThrow) {

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ ExceptionAnalyzer::ExceptionInfo::filterIgnoredExceptions(
418418
if (TD->getDeclName().isIdentifier()) {
419419
if ((IgnoreBadAlloc &&
420420
(TD->getName() == "bad_alloc" && TD->isInStdNamespace())) ||
421-
(IgnoredTypes.count(TD->getName()) > 0))
421+
(IgnoredTypes.contains(TD->getName())))
422422
TypesToDelete.push_back(T);
423423
}
424424
}
@@ -449,7 +449,7 @@ void ExceptionAnalyzer::ExceptionInfo::reevaluateBehaviour() {
449449
ExceptionAnalyzer::ExceptionInfo ExceptionAnalyzer::throwsException(
450450
const FunctionDecl *Func, const ExceptionInfo::Throwables &Caught,
451451
llvm::SmallSet<const FunctionDecl *, 32> &CallStack) {
452-
if (!Func || CallStack.count(Func) || (!CallStack.empty() && !canThrow(Func)))
452+
if (!Func || CallStack.contains(Func) || (!CallStack.empty() && !canThrow(Func)))
453453
return ExceptionInfo::createNonThrowing();
454454

455455
if (const Stmt *Body = Func->getBody()) {
@@ -507,7 +507,7 @@ ExceptionAnalyzer::ExceptionInfo ExceptionAnalyzer::throwsException(
507507
for (unsigned I = 0; I < Try->getNumHandlers(); ++I) {
508508
const CXXCatchStmt *Catch = Try->getHandler(I);
509509

510-
// Everything is catched through 'catch(...)'.
510+
// Everything is caught through 'catch(...)'.
511511
if (!Catch->getExceptionDecl()) {
512512
ExceptionInfo Rethrown = throwsException(
513513
Catch->getHandlerBlock(), Uncaught.getExceptionTypes(), CallStack);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ class ExceptionAnalyzer {
101101
/// Recalculate the 'Behaviour' for example after filtering.
102102
void reevaluateBehaviour();
103103

104-
/// Keep track if the entity related to this 'ExceptionInfo' can in princple
104+
/// Keep track if the entity related to this 'ExceptionInfo' can in principle
105105
/// throw, if it's unknown or if it won't throw.
106106
State Behaviour;
107107

0 commit comments

Comments
 (0)