range-loop-detach: Improve presentation of fixit in compiler output, use std::as_const for C++17, fix check and ouput for Qt6
The previous presentation was confusing and even gave me the impression that the check was broken:
../tests/range-loop-detach/main.cpp:113:5: warning: c++11 range-loop might detach Qt container (QStringList) [-Wclazy-range-loop-detach]
for (const auto &s : f2->m_list) {} // Warn
^
qAsConst( )
Now, the check replaces the entire range, making the change more clear and better visualizes the problematic section
../tests/range-loop-detach/main.cpp:113:5: warning: c++11 range-loop might detach Qt container (QStringList) [-Wclazy-range-loop-detach]
for (const auto &s : f2->m_list) {} // Warn
^ ~~~~~~~~~~
qAsConst(f2->m_list)
Also adapt the check/test for Qt6 and don't always use qAsConst, because it is deprecated in Qt6.
Edited by Alexander Lohnau