[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 04:03:12 PST 2018


Szelethus created this revision.
Szelethus added reviewers: cfe-commits, xazax.hun.
Szelethus added a project: clang-tools-extra.
Herald added subscribers: hintonda, rnkovacs, mgorny.

New checker called misc-throw-keyword-missing warns about cases where a temporary object's type is (likely) an exception but is not thrown. This is done by checking whether the type's name (or one of its baseclass' name) contains the substring "EXCEPTION", "Exception" or "exception".

  void f(int i){
      if(i = 0)
          // Exception is created but not thrown.
          std::runtime_error("Wrong argument");
  }


Repository:
  rCTE Clang Tools Extra

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.133583.patch
Type: text/x-patch
Size: 11114 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180209/6b7a50b3/attachment-0001.bin>


More information about the cfe-commits mailing list