From a48adcf9be144eff9f22f30195e834f869fe19b4 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Thu, 27 Nov 2014 12:11:46 +0100 Subject: C++: handle case-insensitive file names in the CPlusPlus::Snapshot ... by keying on Utils::FileName Task-number: QTCREATORBUG-12390 Change-Id: Ia98afb5a9160a7fd9225a2f9e02539ff3c35ae86 Reviewed-by: Nikolai Kosjar --- src/plugins/cpptools/cppmodelmanager.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'src/plugins/cpptools/cppmodelmanager.cpp') diff --git a/src/plugins/cpptools/cppmodelmanager.cpp b/src/plugins/cpptools/cppmodelmanager.cpp index e2948e9fd7..ed063d99c3 100644 --- a/src/plugins/cpptools/cppmodelmanager.cpp +++ b/src/plugins/cpptools/cppmodelmanager.cpp @@ -814,12 +814,12 @@ QList CppModelManager::projectPart(const QString &fileName) co QList CppModelManager::projectPartFromDependencies(const QString &fileName) const { QSet parts; - const QStringList deps = snapshot().filesDependingOn(fileName); + const Utils::FileNameList deps = snapshot().filesDependingOn(fileName); - { - QMutexLocker locker(&d->m_projectMutex); - foreach (const QString &dep, deps) - parts.unite(QSet::fromList(d->m_fileToProjectParts.value(dep))); + QMutexLocker locker(&d->m_projectMutex); + foreach (const Utils::FileName &dep, deps) { + parts.unite(QSet::fromList( + d->m_fileToProjectParts.value(dep.toString()))); } return parts.values(); @@ -963,7 +963,7 @@ void CppModelManager::GC() } Snapshot currentSnapshot = snapshot(); - QSet reachableFiles; + QSet reachableFiles; // The configuration file is part of the project files, which is just fine. // If single files are open, without any project, then there is no need to // keep the configuration file around. @@ -974,9 +974,10 @@ void CppModelManager::GC() const QString file = todo.last(); todo.removeLast(); - if (reachableFiles.contains(file)) + const Utils::FileName fileName = Utils::FileName::fromString(file); + if (reachableFiles.contains(fileName)) continue; - reachableFiles.insert(file); + reachableFiles.insert(fileName); if (Document::Ptr doc = currentSnapshot.document(file)) todo += doc->includedFiles(); @@ -986,12 +987,12 @@ void CppModelManager::GC() QStringList notReachableFiles; Snapshot newSnapshot; for (Snapshot::const_iterator it = currentSnapshot.begin(); it != currentSnapshot.end(); ++it) { - const QString fileName = it.key(); + const Utils::FileName &fileName = it.key(); if (reachableFiles.contains(fileName)) newSnapshot.insert(it.value()); else - notReachableFiles.append(fileName); + notReachableFiles.append(fileName.toString()); } // Announce removing files and replace the snapshot -- cgit v1.2.1