[PATCH] D14619: [PATCH] clang-tidy checker for nothrow copy constructible exception objects

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 12 09:13:33 PST 2015


aaron.ballman created this revision.
aaron.ballman added reviewers: alexfh, sbenza.
aaron.ballman added a subscriber: cfe-commits.

This patch adds a new clang-tidy checker that flags throw expressions whose thrown type is not nothrow copy constructible. While the compiler is free to elide copy constructor calls in some cases, it is under no obligation to do so, which makes the code a portability concern as well as a security concern.

This checker corresponds to the CERT secure coding rule: https://www.securecoding.cert.org/confluence/display/cplusplus/ERR60-CPP.+Exception+objects+must+be+nothrow+copy+constructible

http://reviews.llvm.org/D14619

Files:
  clang-tidy/cert/CERTTidyModule.cpp
  clang-tidy/cert/CMakeLists.txt
  clang-tidy/cert/ThrownExceptionTypeCheck.cpp
  clang-tidy/cert/ThrownExceptionTypeCheck.h
  docs/clang-tidy/checks/cert-thrown-exception-type.rst
  docs/clang-tidy/checks/list.rst
  test/clang-tidy/cert-throw-exception-type.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14619.40061.patch
Type: text/x-patch
Size: 8220 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151112/7dc7465f/attachment.bin>


More information about the cfe-commits mailing list