aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmlcompiler/qqmljscompiler.cpp
diff options
context:
space:
mode:
authorAndrei Golubev <andrei.golubev@qt.io>2022-02-03 13:45:18 +0100
committerAndrei Golubev <andrei.golubev@qt.io>2022-02-12 23:21:29 +0100
commit690b7cb6a2ff86006ed75bb0e09e35d4ceae4c8a (patch)
tree98a4a76a8d061c5c5310245bee177e1c91c652b4 /src/qmlcompiler/qqmljscompiler.cpp
parentf99b2cce65123ac419015968ef3a4f392e55ef6c (diff)
Redesign QQmlJSLogger internals
High-level goal: be able to reuse existing infrastructure "as is" to configure semantic analysis categories in tools (qmllint, qmltc, qmlsc, etc.) To achieve that, simplify the logging to always "log" something, without explicitly specifying the severity. The severity is now baked into the category (and we can extend those to cover different cases) One slight deviation is the cache generation which likes to do its own thing at present. Provide a "forced logging" option where we can specify which severify we want. The hope is that this gets removed at some point Particular list of (noteworthy) changes: * No more "thresholding" by the level (this is rarely needed and is actually questionable). Instead, we can ignore a particular category explicitly * Category levels are repurposed as category severities (at least from the high-level picture that always should've been this way) * log{Warning,Info,Critical} removed. We use category severity instead * "category error" makes zero sense so removed: if our severity is: - QtWarningMsg (qmllint), it is already an "error" - QtCriticalMsg (compilers), it is already an "error" * Align m_output and m_{infos,warnings,errors} stored information * Accept the fact that we don't support QtDebugMsg and QtFatalMsg * Additional categories added to cover for places where the same category would be both an error and not an error Task-number: QTBUG-100052 Change-Id: I3cd5d17d58be204f48428877bed053f756ac40a8 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qmlcompiler/qqmljscompiler.cpp')
-rw-r--r--src/qmlcompiler/qqmljscompiler.cpp21
1 files changed, 6 insertions, 15 deletions
diff --git a/src/qmlcompiler/qqmljscompiler.cpp b/src/qmlcompiler/qqmljscompiler.cpp
index f9448f38ac..30b74fe6ee 100644
--- a/src/qmlcompiler/qqmljscompiler.cpp
+++ b/src/qmlcompiler/qqmljscompiler.cpp
@@ -669,26 +669,17 @@ QQmlJS::DiagnosticMessage QQmlJSAotCompiler::diagnose(
const QString &message, QtMsgType type, const QQmlJS::SourceLocation &location) const
{
if (isStrict(m_document)
- && (type == QtWarningMsg || type == QtCriticalMsg || type == QtFatalMsg)
- && m_logger->isCategoryError(Log_Compiler)) {
+ && (type == QtWarningMsg || type == QtCriticalMsg || type == QtFatalMsg)
+ && !m_logger->isCategoryIgnored(Log_Compiler)
+ && m_logger->categoryLevel(Log_Compiler) == QtCriticalMsg) {
qFatal("%s:%d: (strict mode) %s",
qPrintable(QFileInfo(m_resourcePath).fileName()),
location.startLine, qPrintable(message));
}
- switch (type) {
- case QtDebugMsg:
- case QtInfoMsg:
- m_logger->logInfo(message, Log_Compiler, location);
- break;
- case QtWarningMsg:
- m_logger->logWarning(message, Log_Compiler, location);
- break;
- case QtCriticalMsg:
- case QtFatalMsg:
- m_logger->logCritical(message, Log_Compiler, location);
- break;
- }
+ // TODO: this is a special place that explicitly sets the severity through
+ // logger's private function
+ m_logger->log(message, Log_Compiler, location, type);
return QQmlJS::DiagnosticMessage {
message,