dberris added a comment.

I'm really excited by this clang-tidy check and I think it's worth having. I do 
think there's more work needed to bring it up to a level of quality that would 
be helpful to more users.



================
Comment at: docs/clang-tidy/checks/bugprone-exception-escape.rst:6
+
+Finds functions which may throw an excpetion directly or indirectly, but they
+should not. The functions which should not throw exceptions are the following:
----------------
excpetion -> exception


================
Comment at: test/clang-tidy/bugprone-exception-escape.cpp:178
+void indirect_implicit() noexcept {
+  // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: an exception may be thrown in 
function 'indirect_implicit' which should not throw exceptions
+  implicit_int_thrower();
----------------
Can we make the warning more accurate here? Something like:

```
warning: call to 'implicit_int_thrower' may throw an exception and propagate 
through noexcept function 'indirect_implicit'
```

It would be helpful to diagnose the point at which the exception may be thrown 
from within the function (if it's an operator, a function call, etc.) that 
doesn't have exceptions handled. If you can highlight not just the line number 
but the actual expression in which the uncaught exception may propagate, it 
would make this warning much better.

If you think it's worth it (or if it's feasible), having a FixIt hint to wrap a 
block of statements where exceptions may propagate in a `try { ... } catch 
(...) { ... }` block would turn this warning from a good warning, to a great 
warning -- potentially something that could be automatically applied by a tool 
as well.


https://reviews.llvm.org/D33537



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to