Bug 431789 - False positive with -clazy-inefficient-qlist
Summary: False positive with -clazy-inefficient-qlist
Status: RESOLVED INTENTIONAL
Alias: None
Product: clazy
Classification: Developer tools
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Unassigned bugs mailing-list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-01-18 16:36 UTC by Roman
Modified: 2021-02-07 13:12 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Roman 2021-01-18 16:36:31 UTC
Clazy shows an error about inefficient use of QList in the case of QList<T> QMap::values() method.


STEPS TO REPRODUCE
1. Call QList<T> QMap::values() for type with size 16 bytes. 

Because there is no values() method with QVector it should probably skip this case.
Comment 1 Sergio Martins 2021-02-07 13:12:35 UTC
Calling values QMap::values() just makes it worse, as it allocates a temporary container, see README-container-anti-pattern.md.

Ofc, people will always find cases where "but here it's useful for me!", for that reason, inefficient-qlist is disabled by default, and there's inefficient-qlist-soft.

Anyway, no point on spending our weekend around this since it's already a non-issue in Qt 6, where this check doesn't make sense anymore. Any effort spend here will be wasted in the long run.