Issue 71292
Summary [FR] clang-tidy check for exception re-throwing
Labels clang-tidy
Assignees
Reporter FalcoGer
    Rethrowing exceptions with the exception parameter creates a copy of the exception and it should be avoided in favor of just using throw.

```c++
void f()
{
  throw MyExpensiveExceptionType();
}

void g()
{
 try
  {
    f();
  }
  catch (const MyExpensiveExceptionType& ex)
  {
    // throw ex;
    //       ~~
    //       ^ Re-throwing exception arguments causes a copy to be made
    // Fix:
 throw;
  }
}
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to