[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
Mon Feb 12 07:43:44 PST 2018


Szelethus updated this revision to Diff 133860.
Szelethus added a comment.

Fixed almost everything mentioned in comments.

I also came up with this problem:

   RegularException funcReturningExceptioniTest(int i) {
     return RegularException();
   }
   
   void returnedValueTest() {
     funcReturningExceptioniTest(3); //Should this emit a warning?
  }

I'm not sure whether it'd be a good idea to warn about these cases. Unused return values can be found by many other means, and I'm afraid the standard library is filled with these cases.

I've also added this code snippet to the test file.


https://reviews.llvm.org/D43120

Files:
  clang-tidy/misc/CMakeLists.txt
  clang-tidy/misc/MiscTidyModule.cpp
  clang-tidy/misc/ThrowKeywordMissingCheck.cpp
  clang-tidy/misc/ThrowKeywordMissingCheck.h
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/misc-throw-keyword-missing.rst
  test/clang-tidy/misc-throw-keyword-missing.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43120.133860.patch
Type: text/x-patch
Size: 11864 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180212/384eecf6/attachment-0001.bin>


More information about the cfe-commits mailing list