[PATCH] D33537: [clang-tidy] Exception Escape Checker

Alexander Kornienko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 11 08:57:59 PDT 2018


alexfh accepted this revision.
alexfh added a comment.
This revision is now accepted and ready to land.

Looks good with one comment.



================
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();
----------------
baloghadamsoftware wrote:
> dberris wrote:
> > 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.
> I think this is a good future improvement. However, I tried to make the first version as small as possible, and then enhance it incrementally. Even the current code is too big for a Clang-Tidy check.
Could you add a relevant FIXME comment next to the diag() call in the check?


https://reviews.llvm.org/D33537





More information about the cfe-commits mailing list