[PATCH] D20693: [clang-tidy] New checker to replace dynamic exception specifications
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 10 17:04:43 PST 2017
aaron.ballman added inline comments.
Comment at: docs/clang-tidy/checks/modernize-use-noexcept.rst:6-8
+The check converts dynamic exception specifications, e.g.,
+``throw()``, ``throw(<exception>[,...])``, or ``throw(...)``, to
+``noexcept``, ``noexcept(false)``, blank, or a user defined macro.
> alexfh wrote:
> > alexfh wrote:
> > > This description doesn't say why `noexcept` is better.
> > This still needs to be addressed.
> Absolutely, but I'll probably do all the code changes first while it's still fresh in my mind.
Since we're talking about documentation, should we note that this check does produce a subtle, obscure change in behavior? When you have `throw()` on a function signature and that function winds up throwing something, this would result in `std::unexpected()` being called. When that gets modified to be `noexcept`, the call to `std::unexpected()` is replaced by a call to `std::terminate()`. This hopefully does not break any code, but we may want to document the fact that failing to honor a dynamic exception specification is slightly different than failing to honor an exception specification so that users are aware of the slightly different semantics.
More information about the cfe-commits