diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/tools/moc/moc.cpp | 7 | ||||
-rw-r--r-- | src/tools/moc/moc.h | 3 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp index 14280712154..64fd334d467 100644 --- a/src/tools/moc/moc.cpp +++ b/src/tools/moc/moc.cpp @@ -259,6 +259,7 @@ bool Moc::parseEnum(EnumDef *def, ClassDef *containingClass) return false; // anonymous enum isTypdefEnum = true; } + def->lineNumber = symbol().lineNum; if (test(COLON)) { // C++11 strongly typed enum // enum Foo : unsigned long { ... }; def->type = normalizeType(parseType().name); @@ -464,6 +465,8 @@ bool Moc::parseFunction(FunctionDef *def, bool inMacro) } next(LPAREN, "Not a signal or slot declaration"); def->name = tempType.name; + def->lineNumber = symbol().lineNum; + scopedFunctionName = tempType.isScoped; if (!test(RPAREN)) { @@ -1366,6 +1369,7 @@ void Moc::createPropertyDef(PropertyDef &propDef, int propertyIndex, Moc::Proper { propDef.location = index; propDef.relativeIndex = propertyIndex; + propDef.lineNumber = symbol().lineNum; Type t = parseType(); QByteArray type = t.name; @@ -2156,6 +2160,7 @@ QJsonObject FunctionDef::toJson(int index) const if (revision > 0) fdef["revision"_L1] = revision; + fdef["lineNumber"_L1] = lineNumber; if (wasCloned) fdef["isCloned"_L1] = true; @@ -2220,6 +2225,7 @@ QJsonObject PropertyDef::toJson() const prop["final"_L1] = final; prop["required"_L1] = required; prop["index"_L1] = relativeIndex; + prop["lineNumber"_L1] = lineNumber; if (revision > 0) prop["revision"_L1] = revision; @@ -2231,6 +2237,7 @@ QJsonObject EnumDef::toJson(const ClassDef &cdef) const QJsonObject def; uint flags = this->flags | cdef.enumDeclarations.value(name); def["name"_L1] = QString::fromUtf8(name); + def["lineNumber"_L1] = lineNumber; if (!enumName.isEmpty()) def["alias"_L1] = QString::fromUtf8(enumName); if (!type.isEmpty()) diff --git a/src/tools/moc/moc.h b/src/tools/moc/moc.h index f08edb3f0d2..fcf000c655f 100644 --- a/src/tools/moc/moc.h +++ b/src/tools/moc/moc.h @@ -58,6 +58,7 @@ struct EnumDef QFlags<QtMocConstants::EnumFlags> flags = {}; QJsonObject toJson(const ClassDef &cdef) const; QByteArray qualifiedType(const ClassDef *cdef) const; + int lineNumber = 0; }; Q_DECLARE_TYPEINFO(EnumDef, Q_RELOCATABLE_TYPE); @@ -84,6 +85,7 @@ struct FunctionDef enum Access { Private, Protected, Public }; Access access = Private; int revision = 0; + int lineNumber = 0; bool isConst = false; bool isVirtual = false; @@ -130,6 +132,7 @@ struct PropertyDef bool final = false; bool required = false; int relativeIndex = -1; // property index in current metaobject + int lineNumber = 0; qsizetype location = -1; // token index, used for error reporting |