C++: Fix order of written classes in cplusplus-update-frontend

The tool produced always different output because of an iteration
through a QSet (order not defined).

Change-Id: I002997cc7e20a89e428cad439eb7afee5abb8b86
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
Nikolai Kosjar
2012-12-04 11:42:21 +01:00
parent a281dfd4b1
commit 6d9c7d93f2

View File

@@ -1599,7 +1599,7 @@ void generateASTPatternBuilder_h(const QDir &cplusplusDir)
<< endl; << endl;
Control *control = AST_h_document->control(); Control *control = AST_h_document->control();
QSet<QString> listClasses; QSet<QString> classesSet;
foreach (ClassSpecifierAST *classNode, astNodes.deriveds) { foreach (ClassSpecifierAST *classNode, astNodes.deriveds) {
Class *klass = classNode->symbol; Class *klass = classNode->symbol;
@@ -1639,7 +1639,7 @@ void generateASTPatternBuilder_h(const QDir &cplusplusDir)
const QString tyName = oo(ptrTy->elementType()); const QString tyName = oo(ptrTy->elementType());
if (tyName.endsWith(QLatin1String("ListAST"))) if (tyName.endsWith(QLatin1String("ListAST")))
listClasses.insert(tyName); classesSet.insert(tyName);
if (tyName.endsWith(QLatin1String("AST"))) { if (tyName.endsWith(QLatin1String("AST"))) {
if (! first) if (! first)
out << ", "; out << ", ";
@@ -1669,7 +1669,9 @@ void generateASTPatternBuilder_h(const QDir &cplusplusDir)
<< endl; << endl;
} }
foreach (const QString &className, listClasses) { QStringList classesList = classesSet.toList();
qSort(classesList);
foreach (const QString &className, classesList) {
const QString methodName = className.left(className.length() - 3); const QString methodName = className.left(className.length() - 3);
const QString elementName = className.left(className.length() - 7) + QLatin1String("AST"); const QString elementName = className.left(className.length() - 7) + QLatin1String("AST");
out out