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

Balogh, Ádám via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 25 06:18:54 PDT 2018


baloghadamsoftware added inline comments.


================
Comment at: test/clang-tidy/bugprone-exception-escape.cpp:178
+void indirect_implicit() noexcept {
+  // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'indirect_implicit' throws
+  implicit_int_thrower();
----------------
lebedev.ri wrote:
> baloghadamsoftware wrote:
> > dberris wrote:
> > > How deep does this go? Say we have a call to a function that's extern which doesn't have 'noexcept' nor a dynamic exception specifier -- do we assume that the call to an extern function may throw? Does that warn? What does the warning look like? Should it warn? How about when you call a function through a function pointer?
> > > 
> > > The documentation should cover these cases and/or more explicitly say in the warning that an exception may throw in a noexcept function (rather than just "function <...> throws").
> > We take the most conservative way here. We assume that a function throws if and only if its body has a throw statement or its header has the (old) throw() exception specification. We do not follow function pointers.
> While i realize it may have more noise, it may be nice to have a more pedantic mode (guarded by an option?).
> E.g. `noexcept` propagation, much like `const` on methods propagation.
> Or at least a test that shows that it does not happen, unless i simply did not notice it :)
This could be an enhancement in the future, yes.


https://reviews.llvm.org/D33537





More information about the cfe-commits mailing list