[CLAZY] Fixed most of level 1 and level 2 warnings
ClosedPublic

Authored by apuzio on Jan 10 2016, 5:45 PM.

Details

Summary

Fixed warnings: QString(const char*) being called [-Wclazy-qstring-uneeded-heap-allocations] with FIXIT fix-fromCharPtrAllocations
Fixed warnings: QString* being called [-Wclazy-qstring-uneeded-heap-allocations] manually (one warnings left inside foreach left, changing to QStringLiteral brakes the build)
Fixed all warnings: Use multi-arg instead [-Wclazy-qstring-arg]
Fixed all warnings (one): Don't call QString::operator[]() on temporary [-Wclazy-detaching-temporary]
Fixed all warnings: Pass small and trivially-copyable type by value (*) [-Wclazy-foreach]
Fixed all warnings: use isEmpty() instead [-Wclazy-isempty-vs-count]
Fixed warnings: Reserve candidate [-Wclazy-reserve-candidates] (one warning left)
Fixed all warnings: warning: Old Style Connect [-Wclazy-old-style-connect]

Left warnings:
warnings: Don't call QList::last() on temporary [-Wclazy-detaching-temporary]
all of warnings [-Wclazy-rule-of-three]
all of warnings: Missing reference on non-trivial type (*) and Pass small and trivially-copyable type by value (*)[-Wclazy-function-args-by-ref]

Diff Detail

Repository
R52 KDevelop: PHP Support
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
apuzio updated this revision to Diff 1837.Jan 10 2016, 5:45 PM
apuzio retitled this revision from to Fixed [-Wclazy-qstring-uneeded-heap-allocations] with FIXIT.
apuzio updated this object.
apuzio edited the test plan for this revision. (Show Details)
apuzio added a reviewer: kfunk.
apuzio set the repository for this revision to R52 KDevelop: PHP Support.
apuzio updated this revision to Diff 1838.Jan 10 2016, 6:02 PM
apuzio retitled this revision from Fixed [-Wclazy-qstring-uneeded-heap-allocations] with FIXIT to Fixed [-Wclazy-qstring-uneeded-heap-allocations] with FIXIT and MANUALLY.
apuzio updated this object.

Added manual changes (everything in one diff, because of conflicts)

apuzio updated this revision to Diff 1839.Jan 10 2016, 6:13 PM
apuzio retitled this revision from Fixed [-Wclazy-qstring-uneeded-heap-allocations] with FIXIT and MANUALLY to [CLAZY] Fixed [-Wclazy-qstring-uneeded-heap-allocations] with FIXIT and MANUALLY, Fixed [-Wclazy-qstring-arg].
apuzio updated this object.

added [-Wclazy-qstring-arg] in this diff because of conflicts

apuzio updated this revision to Diff 1843.Jan 10 2016, 7:46 PM
apuzio retitled this revision from [CLAZY] Fixed [-Wclazy-qstring-uneeded-heap-allocations] with FIXIT and MANUALLY, Fixed [-Wclazy-qstring-arg] to [CLAZY] Fixed most of level 1 and level 2 warnings.
apuzio updated this object.

Added remaining manual fixes.

kfunk edited edge metadata.Jan 10 2016, 8:04 PM
kfunk added a subscriber: mwolff.

@mwolff: Please check

mwolff requested changes to this revision.Jan 10 2016, 11:27 PM
mwolff added a reviewer: mwolff.

pretty good already, some minor things to tweak then +1 from my side.

completion/context.cpp
449

should use .compare(..., Qt::CaseInsensitive) == 0) instead

1526

please rewrite this loop to iterate over a temporary, i.e.:

auto files = DUChain::self()->allEnvironmentFiles(url);
items.reserve(files.size());
foreach(const auto& env, files) {
    ...
1769

dito, introduce a temporary please like above

completion/tests/test_completion.cpp
134

the QLatin1String("") should be replaced by a {}

513

here and below: replace by {}, see above

This revision now requires changes to proceed.Jan 10 2016, 11:27 PM
apuzio updated this revision to Diff 1893.Jan 12 2016, 9:37 AM
apuzio edited edge metadata.

Fixed issues:
"==" -> QString.compare
temporary for reserve and foreach
QLatin1String("") ->{}

apuzio marked 5 inline comments as done.Jan 12 2016, 9:39 AM
mwolff requested changes to this revision.Jan 12 2016, 10:00 PM
mwolff edited edge metadata.

one thing, then this is good from my side

completion/context.cpp
33

the .toLower() part can now be removed, if you add , Qt::CaseInsensitive as second parameter to .compare(). Please do that, it's more efficient to do so (saves temporary allocation).

This revision now requires changes to proceed.Jan 12 2016, 10:00 PM
apuzio updated this revision to Diff 1955.Jan 14 2016, 10:30 AM
apuzio edited edge metadata.

Optimized compare. (fixed the issue)

apuzio marked an inline comment as not done.Jan 14 2016, 10:31 AM
apuzio marked an inline comment as done.Jan 14 2016, 10:32 AM
kfunk accepted this revision.Jan 14 2016, 10:42 PM
kfunk edited edge metadata.

Just went through the list of changes.

Go for it!

kfunk added a comment.EditedJan 15 2016, 6:06 PM

@apuzio: Please rebase + update the patch, it no longer applies.

Push to 5.0 if possible, otherwise just upload the patch (with arc diff please!)

apuzio updated this revision to Diff 1982.Jan 15 2016, 8:30 PM
apuzio edited edge metadata.

Merged changes with current master. I can't commit becouse I don't have a developer account.

apuzio marked an inline comment as done.Jan 26 2016, 2:35 PM
This revision was automatically updated to reflect the committed changes.