From 8fe54cfcf2fd1a3d2dfc44543d78450dafa01793 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Wed, 27 Jul 2016 10:42:31 +0200 Subject: Generate forward declarations for all submachines Before, we've skipped the first machine twice. Change-Id: Ia85f01139bd948aec0b2422b9f9bedfa6261148d Reviewed-by: Ulf Hermann --- tools/qscxmlc/scxmlcppdumper.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'tools') diff --git a/tools/qscxmlc/scxmlcppdumper.cpp b/tools/qscxmlc/scxmlcppdumper.cpp index a22089e..76456cf 100644 --- a/tools/qscxmlc/scxmlcppdumper.cpp +++ b/tools/qscxmlc/scxmlcppdumper.cpp @@ -477,8 +477,7 @@ void CppDumper::dump(TranslationUnit *unit) const QString headerGuard = headerName.toUpper() .replace(QLatin1Char('.'), QLatin1Char('_')) .replace(QLatin1Char('-'), QLatin1Char('_')); - QStringList forwardDecls = classNames; - forwardDecls.pop_front(); + const QStringList forwardDecls = classNames.mid(1); writeHeaderStart(headerGuard, forwardDecls); writeImplStart(); @@ -515,9 +514,8 @@ void CppDumper::writeHeaderStart(const QString &headerGuard, const QStringList & h << l("namespace ") << m_translationUnit->namespaceName << l(" {") << endl << endl; if (!forwardDecls.isEmpty()) { - for (int i = 1, ei = forwardDecls.size(); i != ei; ++i) { - h << QStringLiteral("class %1;").arg(forwardDecls.at(i)) << endl; - } + foreach (const QString &forwardDecl, forwardDecls) + h << QStringLiteral("class %1;").arg(forwardDecl) << endl; h << endl; } } -- cgit v1.2.3