[PATCH] D61851: [clang-tidy] New option for misc-throw-by-value-catch-by-reference

Balogh, Ádám via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 13 04:18:42 PDT 2019


baloghadamsoftware created this revision.
baloghadamsoftware added reviewers: alexfh, aaron.ballman, lebedev.ri.
baloghadamsoftware added a project: clang-tools-extra.
Herald added subscribers: gamesh411, Szelethus, rnkovacs.
Herald added a project: clang.

Catching trivial objects by value is not dangerous but may be inefficient if they are too large. This patch adds an option `WarnOnLargeObject` to the checker to also warn if such an object is caught by value. An object is considered as "large" if its size is greater than `MaxSize` which is another option. Default value is the machine word of the architecture (size of the type `size_t`).


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D61851

Files:
  clang-tidy/misc/ThrowByValueCatchByReferenceCheck.cpp
  clang-tidy/misc/ThrowByValueCatchByReferenceCheck.h
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/misc-throw-by-value-catch-by-reference.rst
  test/clang-tidy/misc-throw-by-value-catch-by-reference-warn-on-large-object.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61851.199245.patch
Type: text/x-patch
Size: 5049 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190513/3428fe8a/attachment-0001.bin>


More information about the cfe-commits mailing list