Compile fix with recent Qt dev

The reasoning in 1b4766e26c did not take into account that the scope
of QT_NO_JAVA_STYLE_ITERATORS may change over time, as done with
f70905448f6 in Qt base.

Change-Id: Ib1966ff26c4d36d5f62e149d6b45baa4aecf825d
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
hjk
2019-07-24 13:43:54 +02:00
parent 02e224fcfa
commit e3b1106afa
70 changed files with 238 additions and 491 deletions

View File

@@ -205,9 +205,7 @@ private:
LookupContext context(m_document, m_snapshot);
CppTools::SemanticInfo::LocalUseIterator it(uses);
while (it.hasNext()) {
it.next();
for (auto it = uses.cbegin(), end = uses.cend(); it != end; ++it) {
const SemanticUses &uses = it.value();
bool good = false;

View File

@@ -618,9 +618,8 @@ void Dumper::dumpWorkingCopy(const WorkingCopy &workingCopy)
m_out << "Working Copy contains " << workingCopy.size() << " entries{{{1\n";
const QByteArray i1 = indent(1);
QHashIterator< ::Utils::FilePath, QPair<QByteArray, unsigned> > it = workingCopy.iterator();
while (it.hasNext()) {
it.next();
const WorkingCopy::Table &elements = workingCopy.elements();
for (auto it = elements.cbegin(), end = elements.cend(); it != end; ++it) {
const ::Utils::FilePath &filePath = it.key();
unsigned sourcRevision = it.value().second;
m_out << i1 << "rev=" << sourcRevision << ", " << filePath << "\n";

View File

@@ -93,9 +93,7 @@ struct Result
{
QList<Result> result;
CppTools::SemanticInfo::LocalUseIterator it(localUses);
while (it.hasNext()) {
it.next();
for (auto it = localUses.cbegin(), end = localUses.cend(); it != end; ++it) {
const CPlusPlus::Symbol *symbol = it.key();
const QList<CppTools::SemanticInfo::Use> &uses = it.value();
foreach (const CppTools::SemanticInfo::Use &use, uses)

View File

@@ -103,10 +103,7 @@ QList<IndexItem::Ptr> CppLocatorData::allIndexItems(
const QHash<QString, QList<IndexItem::Ptr>> &items) const
{
QList<IndexItem::Ptr> result;
QHashIterator<QString, QList<IndexItem::Ptr> > it(items);
while (it.hasNext()) {
it.next();
result.append(it.value());
}
for (const QList<IndexItem::Ptr> &subItems : items)
result.append(subItems);
return result;
}

View File

@@ -608,10 +608,7 @@ void CppModelManager::ensureUpdated()
QStringList CppModelManager::internalProjectFiles() const
{
QStringList files;
QMapIterator<ProjectExplorer::Project *, ProjectInfo> it(d->m_projectToProjectsInfo);
while (it.hasNext()) {
it.next();
const ProjectInfo pinfo = it.value();
for (const ProjectInfo &pinfo : d->m_projectToProjectsInfo) {
foreach (const ProjectPart::Ptr &part, pinfo.projectParts()) {
foreach (const ProjectFile &file, part->files)
files += file.path;
@@ -624,10 +621,7 @@ QStringList CppModelManager::internalProjectFiles() const
ProjectExplorer::HeaderPaths CppModelManager::internalHeaderPaths() const
{
ProjectExplorer::HeaderPaths headerPaths;
QMapIterator<ProjectExplorer::Project *, ProjectInfo> it(d->m_projectToProjectsInfo);
while (it.hasNext()) {
it.next();
const ProjectInfo pinfo = it.value();
for (const ProjectInfo &pinfo : d->m_projectToProjectsInfo) {
foreach (const ProjectPart::Ptr &part, pinfo.projectParts()) {
foreach (const ProjectExplorer::HeaderPath &path, part->headerPaths) {
ProjectExplorer::HeaderPath hp(QDir::cleanPath(path.path), path.type);
@@ -655,10 +649,7 @@ ProjectExplorer::Macros CppModelManager::internalDefinedMacros() const
{
ProjectExplorer::Macros macros;
QSet<ProjectExplorer::Macro> alreadyIn;
QMapIterator<ProjectExplorer::Project *, ProjectInfo> it(d->m_projectToProjectsInfo);
while (it.hasNext()) {
it.next();
const ProjectInfo pinfo = it.value();
for (const ProjectInfo &pinfo : d->m_projectToProjectsInfo) {
for (const ProjectPart::Ptr &part : pinfo.projectParts()) {
addUnique(part->toolChainMacros, macros, alreadyIn);
addUnique(part->projectMacros, macros, alreadyIn);
@@ -783,11 +774,8 @@ WorkingCopy CppModelManager::buildWorkingCopyList()
cppEditorDocument->revision());
}
QSetIterator<AbstractEditorSupport *> it(d->m_extraEditorSupports);
while (it.hasNext()) {
AbstractEditorSupport *es = it.next();
for (AbstractEditorSupport *es : qAsConst(d->m_extraEditorSupports))
workingCopy.insert(es->fileName(), es->contents(), es->revision());
}
// Add the project configuration file
QByteArray conf = codeModelConfiguration();
@@ -815,9 +803,7 @@ static QSet<QString> tooBigFilesRemoved(const QSet<QString> &files, int fileSize
QSet<QString> result;
QFileInfo fileInfo;
QSetIterator<QString> i(files);
while (i.hasNext()) {
const QString filePath = i.next();
for (const QString &filePath : files) {
fileInfo.setFile(filePath);
if (fileSizeExceedsLimit(fileInfo, fileSizeLimitInMb))
continue;
@@ -887,9 +873,8 @@ QList<CppEditorDocumentHandle *> CppModelManager::cppEditorDocuments() const
void CppModelManager::removeFilesFromSnapshot(const QSet<QString> &filesToRemove)
{
QMutexLocker snapshotLocker(&d->m_snapshotMutex);
QSetIterator<QString> i(filesToRemove);
while (i.hasNext())
d->m_snapshot.remove(i.next());
for (const QString &file : filesToRemove)
d->m_snapshot.remove(file);
}
class ProjectInfoComparer
@@ -935,9 +920,7 @@ public:
commonSourceFiles.intersect(m_oldSourceFiles);
QList<Document::Ptr> documentsToCheck;
QSetIterator<QString> i(commonSourceFiles);
while (i.hasNext()) {
const QString file = i.next();
for (const QString &file : commonSourceFiles) {
if (Document::Ptr document = snapshot.document(file))
documentsToCheck << document;
}

View File

@@ -618,11 +618,10 @@ void CppToolsPlugin::test_modelmanager_extraeditorsupport_uiFiles()
QCOMPARE(workingCopy.size(), 2); // mm->configurationFileName() and "ui_*.h"
QStringList fileNamesInWorkinCopy;
QHashIterator<Utils::FilePath, QPair<QByteArray, unsigned> > it = workingCopy.iterator();
while (it.hasNext()) {
it.next();
const WorkingCopy::Table &elements = workingCopy.elements();
for (auto it = elements.cbegin(), end = elements.cend(); it != end; ++it)
fileNamesInWorkinCopy << Utils::FilePath::fromString(it.key().toString()).fileName();
}
fileNamesInWorkinCopy.sort();
const QString expectedUiHeaderFileName = _("ui_mainwindow.h");
QCOMPARE(fileNamesInWorkinCopy.at(0), mm->configurationFileName());

View File

@@ -62,7 +62,6 @@ public:
public:
using Use = TextEditor::HighlightingResult;
using LocalUseMap = QHash<CPlusPlus::Symbol *, QList<Use>>;
using LocalUseIterator = QHashIterator<CPlusPlus::Symbol *, QList<Use>>;
// Document specific
unsigned revision = 0;

View File

@@ -70,14 +70,14 @@ public:
QPair<QByteArray, unsigned> get(const Utils::FilePath &fileName) const
{ return _elements.value(fileName); }
QHashIterator<Utils::FilePath, QPair<QByteArray, unsigned> > iterator() const
{ return QHashIterator<Utils::FilePath, QPair<QByteArray, unsigned> >(_elements); }
using Table = QHash<Utils::FilePath, QPair<QByteArray, unsigned> >;
const Table &elements() const
{ return _elements; }
int size() const
{ return _elements.size(); }
private:
using Table = QHash<Utils::FilePath, QPair<QByteArray, unsigned> >;
Table _elements;
};