llvm / llvm/llvm-project

[clang-tidy] detect unnecessary try-catch blocks

Open
#168,529 2 comments 0 reactions 0 assignees View on GitHub
check-request clang-tidy
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

```cpp
void cb() noexcept;

void f()
{
try {
cb();
} catch(...) {}
}
```

In this case the try-catch is unnecessary as nothing in the scope is throwing.

Contributor guide

Open the contributing guide

Research direction

Start in the clang-tidy area and identify the existing checks and tests for exception handling or unnecessary constructs. Reproduce the issue's noexcept callback example, then determine the check's supported scope and add coverage showing that an unnecessary try-catch block is detected without flagging valid cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.