QtQml: Add more fine grained logging categories for qv4codegen.cpp

We want to control the warnings about variables used before declaration
and injected signal parameters separately, and they are not necessarily
part of the compiler warnings.

Fixes: QTBUG-116764
Change-Id: If3f28f99b539a069cbdb7854d701c027debc77be
Reviewed-by: Andreas Aardal Hanssen <andrhans@cisco.com>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
This commit is contained in:
Ulf Hermann 2023-09-07 09:59:26 +02:00
parent f716d3d71a
commit 1bd18723f7
1 changed files with 4 additions and 3 deletions

View File

@ -31,7 +31,8 @@ QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
Q_LOGGING_CATEGORY(lcQmlCompiler, "qt.qml.compiler");
Q_LOGGING_CATEGORY(lcQmlUsedBeforeDeclared, "qt.qml.usedbeforedeclared");
Q_LOGGING_CATEGORY(lcQmlInjectedParameter, "qt.qml.injectedparameter");
using namespace QV4;
using namespace QV4::Compiler;
@ -42,7 +43,7 @@ void CodegenWarningInterface::reportVarUsedBeforeDeclaration(
const QString &name, const QString &fileName, QQmlJS::SourceLocation declarationLocation,
QQmlJS::SourceLocation accessLocation)
{
qCWarning(lcQmlCompiler).nospace().noquote()
qCWarning(lcQmlUsedBeforeDeclared).nospace().noquote()
<< fileName << ":" << accessLocation.startLine << ":" << accessLocation.startColumn
<< " Variable \"" << name << "\" is used before its declaration at "
<< declarationLocation.startLine << ":" << declarationLocation.startColumn << ".";
@ -2609,7 +2610,7 @@ Codegen::Reference Codegen::referenceForName(const QString &name, bool isLhs, co
}
if (resolved.isInjected && accessLocation.isValid()) {
qCWarning(lcQmlCompiler).nospace().noquote()
qCWarning(lcQmlInjectedParameter).nospace().noquote()
<< url().toString() << ":" << accessLocation.startLine
<< ":" << accessLocation.startColumn << " Parameter \"" << name
<< "\" is not declared."