================ @@ -0,0 +1,38 @@ +.. title:: clang-tidy - readability-use-rethrow + +readability-use-rethrow +======================= + +Detects cases where a caught exception is explicitly re-thrown as a new copy, +and suggests using a bare ``throw;`` instead. + +Throwing a caught exception by its variable name (e.g., ``throw e;``) instead +of using a bare ``throw;`` creates a new copy of the exception. This can lead +to object slicing if the exception was derived from the caught type, and it +alters the original stack trace of the exception. ---------------- unterumarmung wrote:
I'm wondering if my initial judgement was wrong and it should be a `bugprone` check or something else. https://github.com/llvm/llvm-project/pull/190580 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
