Page MenuHomePhabricator

New misc-bad-exception-type check.
Needs ReviewPublic

Authored by sbarzowski on May 20 2017, 12:10 PM.

Details

Reviewers
Prazek
Summary

It warns about using non-class (or struct) types as an exception. It also blacklists STL smart pointers and std::string.I'm not sure if it's appropriate for mainline as it has very low chance of finding anything in an established, reviewed codebase. I see it more as something to run before the first code review.

Related check: misc-throw-by-value-catch-by-reference
There's a nonempty intersection. For example both checks will warn about throwing a pointer. However misc-throw-by-value-catch-by-reference is more lenient about the exception type (it is happy to allow int, unique_ptr and it explicitly allows string literal). Of course there are also many things that misc-throw-by-value-catch-by-reference handles that are out of scope here.

Event Timeline

sbarzowski created this revision.May 20 2017, 12:10 PM
sbarzowski retitled this revision from New misc-bad-exception-type check. It warns about using non-class (or struct) types as an exception. It also blacklists STL smart pointers and std::string. I'm not sure if it's appropriate for mainline as it has very low chance of finding... to New misc-bad-exception-type check..May 21 2017, 3:00 AM
sbarzowski edited the summary of this revision. (Show Details)
sbarzowski added a reviewer: Prazek.