Branch: master
Find file Copy path
c64fbfb Dec 4, 2018
0 contributors

Users who have contributed to this file

18 lines (10 sloc) 522 Bytes


Finds places where you're using C++11 range-loops with non-const Qt containers (potential detach).

Fix it by marking the container const, or, since Qt 5.7, use qAsConst():


for (auto i : qAsConst(list)) { ... }

Also warns if you're passing structs with non-trivial copy-ctor or non-trivial dtor by value, use const-ref so that the copy-ctor and dtor don't get called.


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

export CLAZY_FIXIT="fix-range-loop-add-ref"