Qt-WrongQGlobalStatic

Finds Q_GLOBAL_STATICs being used with trivial types

Required inputs: IR

Using Q_GLOBAL_STATIC with trivial types is unnecessary and creates code bloat. Trivial types are non-class types or class types that are trivially default constructible.

Example:

struct Trivial
{
    int v;
};

Q_GLOBAL_STATIC(Trivial, t); // Wrong
static Trivial t; // Correct
        

This rule is based on clazy rule wrong-qglobalstatic

Possible Messages

Key

Text

Severity

Disabled

wrong_qglobalstatic

Do not use Q_GLOBAL_STATIC with {} type.

None

False

Options

level

level : int = 0

Importance level of the rule as given for clazy. 0 is most desirable, higher values fall off in quality.