diff options
| author | Maximilian Goldstein <max.goldstein@qt.io> | 2022-01-18 13:08:09 +0100 |
|---|---|---|
| committer | Maximilian Goldstein <max.goldstein@qt.io> | 2022-02-03 11:17:34 +0100 |
| commit | dc9de38abe797e835480171a047bf96e98c84e1f (patch) | |
| tree | 1ce1b77174fdc38c45a23555399a665591da2b80 /tools/qmlcachegen/qmlcachegen.cpp | |
| parent | a0f5baad2a645bfaa65773451e9d76944ae9a951 (diff) | |
qmllint: Warn about missing singleton pragmas/qmldir entries
This change adds a warning if we encounter a component marked as a
singleton in a qmldir file which does not contain a pragma
Singleton entry and vice versa.
Note that the warning only gets triggered if the singleton is
actually used.
Fixes: QTBUG-98558
Change-Id: Id7c63f48ba49759c15dffcaee0270c7caab2eb7d
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Diffstat (limited to 'tools/qmlcachegen/qmlcachegen.cpp')
| -rw-r--r-- | tools/qmlcachegen/qmlcachegen.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/qmlcachegen/qmlcachegen.cpp b/tools/qmlcachegen/qmlcachegen.cpp index cca7abcfe0..d6869ab05b 100644 --- a/tools/qmlcachegen/qmlcachegen.cpp +++ b/tools/qmlcachegen/qmlcachegen.cpp @@ -293,6 +293,14 @@ int main(int argc, char **argv) error.augment(QStringLiteral("Error compiling qml file: ")).print(); return EXIT_FAILURE; } + + QList<QQmlJS::DiagnosticMessage> warnings = importer.takeGlobalWarnings(); + + if (!warnings.isEmpty()) { + logger.logWarning(QStringLiteral("Type warnings occurred while compiling file:"), + Log_Import); + logger.processMessages(warnings, QtWarningMsg, Log_Import); + } } } else if (inputFile.endsWith(QLatin1String(".js")) || inputFile.endsWith(QLatin1String(".mjs"))) { QQmlJSCompileError error; |
