diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2021-03-01 11:44:28 +0100 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2021-03-02 11:45:41 +0000 |
commit | 49113c905d5868e6b76bb6b7b3e0a20b0c56a23a (patch) | |
tree | 6b1e934e057657ce6d2521c194a2eec740b0e561 /src/corelib/kernel | |
parent | 417895b458d230fb24ed7d5b5ec5266c4e7329d8 (diff) |
Don't access moved-from object
Clang's static analyzer tooling warns about this access-after-move [1].
While the comment above the function indicated that this was deliberate
and relying on a moved-from QString being valid, it is still bad
practice.
Since 'str' is empty in moved-from state if - and only if - it was a
non-const reference, make a compile-time check of the constness of type
T instead.
[1] https://testresults.qt.io/codechecker/daily_analyses/qtbase/dev/qtbase-dev-20210301-e14ccf0553/qstring.cpp_clang-tidy_b0545db57a2cc5dac67a56f76322ffd0.plist.html#reportHash=209ee3db0b17d21919326a1ad6635318
Pick-to: 6.1
Change-Id: Iac1813b61b6a3c2ef4053b911a4043c5382f85e4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Diffstat (limited to 'src/corelib/kernel')
0 files changed, 0 insertions, 0 deletions