Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
18 lines (10 sloc) 957 Bytes


Warns when you should be passing by const-ref. Types with sizeof > 16 bytes [1] or types which are not trivially-copyable [2] or not trivially-destructible [3] should be passed by ref. A rule of thumb is that if passing by value would trigger copy-ctor and/or dtor then pass by ref instead.

This check will ignore shared pointers, you're on your own. Most of the times passing shared pointers by const-ref is the best thing to do, but occasionally that will lead to crashes if you're in a method that calls something else that makes the shared pointer ref count go down to zero.


This check supports adding missing & or const-& with:

export CLAZY_FIXIT="fix-function-args-by-ref"