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

Roman Lebedev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 7 06:16:40 PDT 2018


lebedev.ri 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();
----------------
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 :)


https://reviews.llvm.org/D33537





More information about the cfe-commits mailing list