[PATCH] D43120: [clang-tidy] New checker for exceptions that are created but not thrown
Umann Kristóf via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 9 06:06:50 PST 2018
Szelethus marked 5 inline comments as done.
Szelethus added inline comments.
================
Comment at: clang-tidy/misc/ThrowKeywordMissingCheck.cpp:32
+ hasType(cxxRecordDecl(
+ isSameOrDerivedFrom(matchesName("[Ee]xception|EXCEPTION")))),
+ unless(anyOf(hasAncestor(stmt(
----------------
whisperity wrote:
> `matchesName` says
>
> > Does not match typedefs of an underlying type with the given name.
>
> Does your check find the following case?
>
> ```
> typedef std::exception ERROR_BASE;
> class my_error : public ERROR_BASE {
> /* Usual yadda. */
> };
>
> int main() {
> my_error();
> }
> ```
>
It does! I've added this case to the test file.
https://reviews.llvm.org/D43120
More information about the cfe-commits
mailing list