Add check for obsolete QVariant functions
Needs RevisionPublic

Authored by nicolasfella on May 10 2019, 12:52 PM.

Details

Reviewers
smartins
Summary

Give a warning and suggest replacement for functions from https://doc.qt.io/qt-5/qvariant-obsolete.html
The obvious thing would be adding a fixit, but one step at a time.

I'm usure about the correct level for this check. I don't see how it would produce a false-positive though

Inspired by D21107

Test Plan

Added test.

Diff Detail

Repository
R74 Clazy
Branch
variants
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 11725
Build 11743: arc lint + arc unit
nicolasfella requested review of this revision.May 10 2019, 12:52 PM
nicolasfella created this revision.
  • remove unneeded files
nicolasfella edited the summary of this revision. (Show Details)May 10 2019, 12:55 PM
smartins requested changes to this revision.May 12 2019, 6:53 PM

The preferred way is always to use one of the built-in clang warnings and make clazy spend less CPU cycles. I wonder why these are just not marked as deprecated.

Eitherway your check is useful and we can disable it for Qt >= 5.14 if we get to deprecate them upstream.

thanks!

src/checks/level2/obsolete-qvariant-functions.cpp
46

cache the name, 1 line before

48

no need to call c_str

tests/obsolete-qvariant-functions/config.json
2

these minimums are probably a copy-paste from another config.json and not really needed ?

This revision now requires changes to proceed.May 12 2019, 6:53 PM

Also, please edit checks.json, add your check there, with level "0", since it doesn't have false positives.

And call:
./dev-scripts/generate.py --generate

That should move the files to the correct folder automatically.

Actually these functions have been deprecated for 5.14.

See qenums.cpp on how to validate the Qt version, and bailout early if preProcessorVisitor->qtVersion() >= 51400