Commit cc70b603 authored by Erik Verbruggen's avatar Erik Verbruggen

C++: Change QStringList to QSet<QString> to prevent conversions.

This eliminates a bunch of list->set->list conversions. Especially the
ProjectInfo::appendProjectPart takes lots of time converting for every
part added.

Change-Id: Ib3c8cd4b0ad6c012ccbeed12ebedd46b9b6cca95
Reviewed-by: default avatarDaniel Teske <daniel.teske@digia.com>
parent 50e951dc
...@@ -228,7 +228,7 @@ DocumentManager::~DocumentManager() ...@@ -228,7 +228,7 @@ DocumentManager::~DocumentManager()
delete d; delete d;
} }
QObject *DocumentManager::instance() DocumentManager *DocumentManager::instance()
{ {
return m_instance; return m_instance;
} }
......
...@@ -60,7 +60,7 @@ public: ...@@ -60,7 +60,7 @@ public:
typedef QPair<QString, Id> RecentFile; typedef QPair<QString, Id> RecentFile;
static QObject *instance(); static DocumentManager *instance();
// file pool to monitor // file pool to monitor
static void addDocuments(const QList<IDocument *> &documents, bool addWatcher = true); static void addDocuments(const QList<IDocument *> &documents, bool addWatcher = true);
......
...@@ -79,7 +79,7 @@ public: ...@@ -79,7 +79,7 @@ public:
{ {
QVERIFY(succeededSoFar()); QVERIFY(succeededSoFar());
QStringList filePaths; QSet<QString> filePaths;
const int sourceListSize = sourceList.size(); const int sourceListSize = sourceList.size();
for (int i = 0; i < sourceListSize; ++i) { for (int i = 0; i < sourceListSize; ++i) {
const QByteArray &source = sourceList.at(i); const QByteArray &source = sourceList.at(i);
......
...@@ -145,7 +145,7 @@ QuickFixTestCase::QuickFixTestCase(const QList<QuickFixTestDocument::Ptr> &theTe ...@@ -145,7 +145,7 @@ QuickFixTestCase::QuickFixTestCase(const QList<QuickFixTestDocument::Ptr> &theTe
} }
// Update Code Model // Update Code Model
QStringList filePaths; QSet<QString> filePaths;
foreach (const QuickFixTestDocument::Ptr &testFile, m_testFiles) foreach (const QuickFixTestDocument::Ptr &testFile, m_testFiles)
filePaths << testFile->filePath(); filePaths << testFile->filePath();
QVERIFY(parseFiles(filePaths)); QVERIFY(parseFiles(filePaths));
......
...@@ -268,7 +268,7 @@ F2TestCase::F2TestCase(CppEditorAction action, ...@@ -268,7 +268,7 @@ F2TestCase::F2TestCase(CppEditorAction action,
QVERIFY(testFile->writeToDisk()); QVERIFY(testFile->writeToDisk());
// Update Code Model // Update Code Model
QStringList filePaths; QSet<QString> filePaths;
foreach (const TestDocumentPtr &testFile, testFiles) foreach (const TestDocumentPtr &testFile, testFiles)
filePaths << testFile->filePath(); filePaths << testFile->filePath();
QVERIFY(parseFiles(filePaths)); QVERIFY(parseFiles(filePaths));
......
...@@ -49,7 +49,7 @@ AbstractEditorSupport::~AbstractEditorSupport() ...@@ -49,7 +49,7 @@ AbstractEditorSupport::~AbstractEditorSupport()
void AbstractEditorSupport::updateDocument() void AbstractEditorSupport::updateDocument()
{ {
++m_revision; ++m_revision;
m_modelmanager->updateSourceFiles(QStringList(fileName())); m_modelmanager->updateSourceFiles(QSet<QString>() << fileName());
} }
QString AbstractEditorSupport::functionAt(const CppModelManagerInterface *modelManager, QString AbstractEditorSupport::functionAt(const CppModelManagerInterface *modelManager,
......
...@@ -127,7 +127,7 @@ void BaseEditorDocumentProcessor::runParser(QFutureInterface<void> &future, ...@@ -127,7 +127,7 @@ void BaseEditorDocumentProcessor::runParser(QFutureInterface<void> &future,
parser->update(workingCopy); parser->update(workingCopy);
CppModelManagerInterface::instance() CppModelManagerInterface::instance()
->finishedRefreshingSourceFiles(QStringList(parser->filePath())); ->finishedRefreshingSourceFiles(QSet<QString>() << parser->filePath());
future.setProgressValue(1); future.setProgressValue(1);
} }
......
...@@ -68,7 +68,7 @@ public: ...@@ -68,7 +68,7 @@ public:
int revision; int revision;
ProjectPart::HeaderPaths headerPaths; ProjectPart::HeaderPaths headerPaths;
WorkingCopy workingCopy; WorkingCopy workingCopy;
QStringList sourceFiles; QSet<QString> sourceFiles;
}; };
class WriteTaskFileForDiagnostics class WriteTaskFileForDiagnostics
...@@ -133,7 +133,7 @@ private: ...@@ -133,7 +133,7 @@ private:
int m_processedDiagnostics; int m_processedDiagnostics;
}; };
void classifyFiles(const QStringList &files, QStringList *headers, QStringList *sources) void classifyFiles(const QSet<QString> &files, QStringList *headers, QStringList *sources)
{ {
foreach (const QString &file, files) { foreach (const QString &file, files) {
if (ProjectFile::isSource(ProjectFile::classify(file))) if (ProjectFile::isSource(ProjectFile::classify(file)))
...@@ -145,11 +145,11 @@ void classifyFiles(const QStringList &files, QStringList *headers, QStringList * ...@@ -145,11 +145,11 @@ void classifyFiles(const QStringList &files, QStringList *headers, QStringList *
void indexFindErrors(QFutureInterface<void> &future, const ParseParams params) void indexFindErrors(QFutureInterface<void> &future, const ParseParams params)
{ {
QStringList files = params.sourceFiles;
files.sort();
QStringList sources, headers; QStringList sources, headers;
classifyFiles(files, &headers, &sources); classifyFiles(params.sourceFiles, &headers, &sources);
files = sources + headers; sources.sort();
headers.sort();
QStringList files = sources + headers;
WriteTaskFileForDiagnostics taskFileWriter; WriteTaskFileForDiagnostics taskFileWriter;
QElapsedTimer timer; QElapsedTimer timer;
...@@ -196,20 +196,18 @@ void index(QFutureInterface<void> &future, const ParseParams params) ...@@ -196,20 +196,18 @@ void index(QFutureInterface<void> &future, const ParseParams params)
sourceProcessor->setHeaderPaths(params.headerPaths); sourceProcessor->setHeaderPaths(params.headerPaths);
sourceProcessor->setWorkingCopy(params.workingCopy); sourceProcessor->setWorkingCopy(params.workingCopy);
QStringList files = params.sourceFiles;
QStringList sources; QStringList sources;
QStringList headers; QStringList headers;
classifyFiles(files, &headers, &sources); classifyFiles(params.sourceFiles, &headers, &sources);
foreach (const QString &file, files) foreach (const QString &file, params.sourceFiles)
sourceProcessor->removeFromCache(file); sourceProcessor->removeFromCache(file);
const int sourceCount = sources.size(); const int sourceCount = sources.size();
files = sources; QStringList files = sources + headers;
files += headers;
sourceProcessor->setTodo(files); sourceProcessor->setTodo(files.toSet());
const QString conf = CppModelManagerInterface::configurationFileName(); const QString conf = CppModelManagerInterface::configurationFileName();
bool processingHeaders = false; bool processingHeaders = false;
...@@ -250,7 +248,7 @@ void index(QFutureInterface<void> &future, const ParseParams params) ...@@ -250,7 +248,7 @@ void index(QFutureInterface<void> &future, const ParseParams params)
void parse(QFutureInterface<void> &future, const ParseParams params) void parse(QFutureInterface<void> &future, const ParseParams params)
{ {
const QStringList files = params.sourceFiles; const QSet<QString> &files = params.sourceFiles;
if (files.isEmpty()) if (files.isEmpty())
return; return;
...@@ -356,7 +354,7 @@ BuiltinIndexingSupport::BuiltinIndexingSupport() ...@@ -356,7 +354,7 @@ BuiltinIndexingSupport::BuiltinIndexingSupport()
BuiltinIndexingSupport::~BuiltinIndexingSupport() BuiltinIndexingSupport::~BuiltinIndexingSupport()
{} {}
QFuture<void> BuiltinIndexingSupport::refreshSourceFiles(const QStringList &sourceFiles, QFuture<void> BuiltinIndexingSupport::refreshSourceFiles(const QSet<QString> &sourceFiles,
CppModelManagerInterface::ProgressNotificationMode mode) CppModelManagerInterface::ProgressNotificationMode mode)
{ {
CppModelManager *mgr = CppModelManager::instance(); CppModelManager *mgr = CppModelManager::instance();
......
...@@ -43,7 +43,7 @@ public: ...@@ -43,7 +43,7 @@ public:
BuiltinIndexingSupport(); BuiltinIndexingSupport();
~BuiltinIndexingSupport(); ~BuiltinIndexingSupport();
virtual QFuture<void> refreshSourceFiles(const QStringList &sourceFiles, virtual QFuture<void> refreshSourceFiles(const QSet<QString> &sourceFiles,
CppModelManagerInterface::ProgressNotificationMode mode); CppModelManagerInterface::ProgressNotificationMode mode);
virtual SymbolSearcher *createSymbolSearcher(SymbolSearcher::Parameters parameters, virtual SymbolSearcher *createSymbolSearcher(SymbolSearcher::Parameters parameters,
QSet<QString> fileNames); QSet<QString> fileNames);
......
...@@ -385,7 +385,7 @@ void CppFindReferences::onReplaceButtonClicked(const QString &text, ...@@ -385,7 +385,7 @@ void CppFindReferences::onReplaceButtonClicked(const QString &text,
{ {
const QStringList fileNames = TextEditor::BaseFileFind::replaceAll(text, items, preserveCase); const QStringList fileNames = TextEditor::BaseFileFind::replaceAll(text, items, preserveCase);
if (!fileNames.isEmpty()) { if (!fileNames.isEmpty()) {
m_modelManager->updateSourceFiles(fileNames); m_modelManager->updateSourceFiles(fileNames.toSet());
Core::SearchResultWindow::instance()->hide(); Core::SearchResultWindow::instance()->hide();
} }
} }
......
...@@ -82,7 +82,7 @@ class CPPTOOLS_EXPORT CppIndexingSupport ...@@ -82,7 +82,7 @@ class CPPTOOLS_EXPORT CppIndexingSupport
public: public:
virtual ~CppIndexingSupport() = 0; virtual ~CppIndexingSupport() = 0;
virtual QFuture<void> refreshSourceFiles(const QStringList &sourceFiles, virtual QFuture<void> refreshSourceFiles(const QSet<QString> &sourceFiles,
CppModelManagerInterface::ProgressNotificationMode mode) = 0; CppModelManagerInterface::ProgressNotificationMode mode) = 0;
virtual SymbolSearcher *createSymbolSearcher(SymbolSearcher::Parameters parameters, virtual SymbolSearcher *createSymbolSearcher(SymbolSearcher::Parameters parameters,
QSet<QString> fileNames) = 0; QSet<QString> fileNames) = 0;
......
...@@ -141,9 +141,9 @@ static const char pp_configuration[] = ...@@ -141,9 +141,9 @@ static const char pp_configuration[] =
"#define __inline inline\n" "#define __inline inline\n"
"#define __forceinline inline\n"; "#define __forceinline inline\n";
QStringList CppModelManager::timeStampModifiedFiles(const QList<Document::Ptr> &documentsToCheck) QSet<QString> CppModelManager::timeStampModifiedFiles(const QList<Document::Ptr> &documentsToCheck)
{ {
QStringList sourceFiles; QSet<QString> sourceFiles;
foreach (const Document::Ptr doc, documentsToCheck) { foreach (const Document::Ptr doc, documentsToCheck) {
const QDateTime lastModified = doc->lastModified(); const QDateTime lastModified = doc->lastModified();
...@@ -152,7 +152,7 @@ QStringList CppModelManager::timeStampModifiedFiles(const QList<Document::Ptr> & ...@@ -152,7 +152,7 @@ QStringList CppModelManager::timeStampModifiedFiles(const QList<Document::Ptr> &
QFileInfo fileInfo(doc->fileName()); QFileInfo fileInfo(doc->fileName());
if (fileInfo.exists() && fileInfo.lastModified() != lastModified) if (fileInfo.exists() && fileInfo.lastModified() != lastModified)
sourceFiles.append(doc->fileName()); sourceFiles.insert(doc->fileName());
} }
} }
...@@ -184,8 +184,7 @@ void CppModelManager::updateModifiedSourceFiles() ...@@ -184,8 +184,7 @@ void CppModelManager::updateModifiedSourceFiles()
foreach (const Document::Ptr document, snapshot) foreach (const Document::Ptr document, snapshot)
documentsToCheck << document; documentsToCheck << document;
const QStringList filesToUpdate = timeStampModifiedFiles(documentsToCheck); updateSourceFiles(timeStampModifiedFiles(documentsToCheck));
updateSourceFiles(filesToUpdate);
} }
/*! /*!
...@@ -224,7 +223,7 @@ CppModelManager::CppModelManager(QObject *parent) ...@@ -224,7 +223,7 @@ CppModelManager::CppModelManager(QObject *parent)
this, SIGNAL(globalSnapshotChanged())); this, SIGNAL(globalSnapshotChanged()));
connect(this, SIGNAL(aboutToRemoveFiles(QStringList)), connect(this, SIGNAL(aboutToRemoveFiles(QStringList)),
this, SIGNAL(globalSnapshotChanged())); this, SIGNAL(globalSnapshotChanged()));
connect(this, SIGNAL(sourceFilesRefreshed(QStringList)), connect(this, SIGNAL(sourceFilesRefreshed(QSet<QString>)),
this, SLOT(onSourceFilesRefreshed())); this, SLOT(onSourceFilesRefreshed()));
m_findReferences = new CppFindReferences(this); m_findReferences = new CppFindReferences(this);
...@@ -505,7 +504,7 @@ QByteArray CppModelManager::codeModelConfiguration() const ...@@ -505,7 +504,7 @@ QByteArray CppModelManager::codeModelConfiguration() const
return QByteArray::fromRawData(pp_configuration, qstrlen(pp_configuration)); return QByteArray::fromRawData(pp_configuration, qstrlen(pp_configuration));
} }
QFuture<void> CppModelManager::updateSourceFiles(const QStringList &sourceFiles, QFuture<void> CppModelManager::updateSourceFiles(const QSet<QString> &sourceFiles,
ProgressNotificationMode mode) ProgressNotificationMode mode)
{ {
if (sourceFiles.isEmpty() || !m_indexerEnabled) if (sourceFiles.isEmpty() || !m_indexerEnabled)
...@@ -565,9 +564,9 @@ public: ...@@ -565,9 +564,9 @@ public:
ProjectInfoComparer(const ProjectInfo &oldProjectInfo, ProjectInfoComparer(const ProjectInfo &oldProjectInfo,
const ProjectInfo &newProjectInfo) const ProjectInfo &newProjectInfo)
: m_old(oldProjectInfo) : m_old(oldProjectInfo)
, m_oldSourceFiles(oldProjectInfo.sourceFiles().toSet()) , m_oldSourceFiles(oldProjectInfo.sourceFiles())
, m_new(newProjectInfo) , m_new(newProjectInfo)
, m_newSourceFiles(newProjectInfo.sourceFiles().toSet()) , m_newSourceFiles(newProjectInfo.sourceFiles())
{} {}
bool definesChanged() const bool definesChanged() const
...@@ -614,7 +613,7 @@ public: ...@@ -614,7 +613,7 @@ public:
documentsToCheck << document; documentsToCheck << document;
} }
return CppModelManager::timeStampModifiedFiles(documentsToCheck).toSet(); return CppModelManager::timeStampModifiedFiles(documentsToCheck);
} }
private: private:
...@@ -645,14 +644,14 @@ QFuture<void> CppModelManager::updateProjectInfo(const ProjectInfo &newProjectIn ...@@ -645,14 +644,14 @@ QFuture<void> CppModelManager::updateProjectInfo(const ProjectInfo &newProjectIn
if (!newProjectInfo.isValid()) if (!newProjectInfo.isValid())
return QFuture<void>(); return QFuture<void>();
QStringList filesToReindex; QSet<QString> filesToReindex;
bool filesRemoved = false; bool filesRemoved = false;
{ // Only hold the mutex for a limited scope, so the dumping afterwards does not deadlock. { // Only hold the mutex for a limited scope, so the dumping afterwards does not deadlock.
QMutexLocker projectLocker(&m_projectMutex); QMutexLocker projectLocker(&m_projectMutex);
ProjectExplorer::Project *project = newProjectInfo.project().data(); ProjectExplorer::Project *project = newProjectInfo.project().data();
const QStringList newSourceFiles = newProjectInfo.sourceFiles(); const QSet<QString> newSourceFiles = newProjectInfo.sourceFiles();
// Check if we can avoid a full reindexing // Check if we can avoid a full reindexing
ProjectInfo oldProjectInfo = m_projectToProjectsInfo.value(project); ProjectInfo oldProjectInfo = m_projectToProjectsInfo.value(project);
...@@ -664,7 +663,7 @@ QFuture<void> CppModelManager::updateProjectInfo(const ProjectInfo &newProjectIn ...@@ -664,7 +663,7 @@ QFuture<void> CppModelManager::updateProjectInfo(const ProjectInfo &newProjectIn
// If the project configuration changed, do a full reindexing // If the project configuration changed, do a full reindexing
if (comparer.configurationChanged()) { if (comparer.configurationChanged()) {
removeProjectInfoFilesAndIncludesFromSnapshot(oldProjectInfo); removeProjectInfoFilesAndIncludesFromSnapshot(oldProjectInfo);
filesToReindex << newSourceFiles; filesToReindex.unite(newSourceFiles);
// The "configuration file" includes all defines and therefore should be updated // The "configuration file" includes all defines and therefore should be updated
if (comparer.definesChanged()) { if (comparer.definesChanged()) {
...@@ -675,10 +674,10 @@ QFuture<void> CppModelManager::updateProjectInfo(const ProjectInfo &newProjectIn ...@@ -675,10 +674,10 @@ QFuture<void> CppModelManager::updateProjectInfo(const ProjectInfo &newProjectIn
// Otherwise check for added and modified files // Otherwise check for added and modified files
} else { } else {
const QSet<QString> addedFiles = comparer.addedFiles(); const QSet<QString> addedFiles = comparer.addedFiles();
filesToReindex << addedFiles.toList(); filesToReindex.unite(addedFiles);
const QSet<QString> modifiedFiles = comparer.timeStampModifiedFiles(snapshot()); const QSet<QString> modifiedFiles = comparer.timeStampModifiedFiles(snapshot());
filesToReindex << modifiedFiles.toList(); filesToReindex.unite(modifiedFiles);
} }
// Announce and purge the removed files from the snapshot // Announce and purge the removed files from the snapshot
...@@ -691,7 +690,7 @@ QFuture<void> CppModelManager::updateProjectInfo(const ProjectInfo &newProjectIn ...@@ -691,7 +690,7 @@ QFuture<void> CppModelManager::updateProjectInfo(const ProjectInfo &newProjectIn
// A new project was opened/created, do a full indexing // A new project was opened/created, do a full indexing
} else { } else {
filesToReindex << newSourceFiles; filesToReindex.unite(newSourceFiles);
} }
// Update Project/ProjectInfo and File/ProjectPart table // Update Project/ProjectInfo and File/ProjectPart table
...@@ -872,7 +871,7 @@ void CppModelManager::GC() ...@@ -872,7 +871,7 @@ void CppModelManager::GC()
emit gcFinished(); emit gcFinished();
} }
void CppModelManager::finishedRefreshingSourceFiles(const QStringList &files) void CppModelManager::finishedRefreshingSourceFiles(const QSet<QString> &files)
{ {
emit sourceFilesRefreshed(files); emit sourceFilesRefreshed(files);
} }
......
...@@ -62,7 +62,7 @@ public: ...@@ -62,7 +62,7 @@ public:
static CppModelManager *instance(); static CppModelManager *instance();
virtual QFuture<void> updateSourceFiles(const QStringList &sourceFiles, virtual QFuture<void> updateSourceFiles(const QSet<QString> &sourceFiles,
ProgressNotificationMode mode = ReservedProgressNotification); ProgressNotificationMode mode = ReservedProgressNotification);
virtual WorkingCopy workingCopy() const; virtual WorkingCopy workingCopy() const;
virtual QByteArray codeModelConfiguration() const; virtual QByteArray codeModelConfiguration() const;
...@@ -106,7 +106,7 @@ public: ...@@ -106,7 +106,7 @@ public:
virtual void findMacroUsages(const CPlusPlus::Macro &macro); virtual void findMacroUsages(const CPlusPlus::Macro &macro);
virtual void renameMacroUsages(const CPlusPlus::Macro &macro, const QString &replacement); virtual void renameMacroUsages(const CPlusPlus::Macro &macro, const QString &replacement);
virtual void finishedRefreshingSourceFiles(const QStringList &files); virtual void finishedRefreshingSourceFiles(const QSet<QString> &files);
virtual void addModelManagerSupport(ModelManagerSupport *modelManagerSupport); virtual void addModelManagerSupport(ModelManagerSupport *modelManagerSupport);
virtual ModelManagerSupport *modelManagerSupportForMimeType(const QString &mimeType) const; virtual ModelManagerSupport *modelManagerSupportForMimeType(const QString &mimeType) const;
...@@ -143,7 +143,7 @@ public: ...@@ -143,7 +143,7 @@ public:
void enableGarbageCollector(bool enable); void enableGarbageCollector(bool enable);
static QStringList timeStampModifiedFiles(const QList<Document::Ptr> &documentsToCheck); static QSet<QString> timeStampModifiedFiles(const QList<Document::Ptr> &documentsToCheck);
static CppSourceProcessor *createSourceProcessor(); static CppSourceProcessor *createSourceProcessor();
......
...@@ -194,7 +194,7 @@ private: ...@@ -194,7 +194,7 @@ private:
const QString &m_filePath; const QString &m_filePath;
}; };
static QStringList updateProjectInfo(CppModelManager *modelManager, ModelManagerTestHelper *helper, static QSet<QString> updateProjectInfo(CppModelManager *modelManager, ModelManagerTestHelper *helper,
const ProjectInfo &projectInfo) const ProjectInfo &projectInfo)
{ {
helper->resetRefreshedSourceFiles(); helper->resetRefreshedSourceFiles();
...@@ -315,7 +315,7 @@ void CppToolsPlugin::test_modelmanager_refresh_also_includes_of_project_files() ...@@ -315,7 +315,7 @@ void CppToolsPlugin::test_modelmanager_refresh_also_includes_of_project_files()
part->files.append(ProjectFile(testCpp, ProjectFile::CXXSource)); part->files.append(ProjectFile(testCpp, ProjectFile::CXXSource));
pi.appendProjectPart(part); pi.appendProjectPart(part);
QStringList refreshedFiles = updateProjectInfo(mm, &helper, pi); QSet<QString> refreshedFiles = updateProjectInfo(mm, &helper, pi);
QCOMPARE(refreshedFiles.size(), 1); QCOMPARE(refreshedFiles.size(), 1);
QVERIFY(refreshedFiles.contains(testCpp)); QVERIFY(refreshedFiles.contains(testCpp));
CPlusPlus::Snapshot snapshot = mm->snapshot(); CPlusPlus::Snapshot snapshot = mm->snapshot();
...@@ -375,7 +375,7 @@ void CppToolsPlugin::test_modelmanager_refresh_several_times() ...@@ -375,7 +375,7 @@ void CppToolsPlugin::test_modelmanager_refresh_several_times()
mm->updateProjectInfo(pi); mm->updateProjectInfo(pi);
CPlusPlus::Snapshot snapshot; CPlusPlus::Snapshot snapshot;
QStringList refreshedFiles; QSet<QString> refreshedFiles;
CPlusPlus::Document::Ptr document; CPlusPlus::Document::Ptr document;
QByteArray defines = "#define FIRST_DEFINE"; QByteArray defines = "#define FIRST_DEFINE";
...@@ -441,7 +441,7 @@ void CppToolsPlugin::test_modelmanager_refresh_test_for_changes() ...@@ -441,7 +441,7 @@ void CppToolsPlugin::test_modelmanager_refresh_test_for_changes()
QFuture<void> firstFuture = mm->updateProjectInfo(pi); QFuture<void> firstFuture = mm->updateProjectInfo(pi);
QVERIFY(firstFuture.isStarted() || firstFuture.isRunning()); QVERIFY(firstFuture.isStarted() || firstFuture.isRunning());
firstFuture.waitForFinished(); firstFuture.waitForFinished();
const QStringList refreshedFiles = helper.waitForRefreshedSourceFiles(); const QSet<QString> refreshedFiles = helper.waitForRefreshedSourceFiles();
QCOMPARE(refreshedFiles.size(), 1); QCOMPARE(refreshedFiles.size(), 1);
QVERIFY(refreshedFiles.contains(testCpp)); QVERIFY(refreshedFiles.contains(testCpp));
...@@ -475,7 +475,7 @@ void CppToolsPlugin::test_modelmanager_refresh_added_and_purge_removed() ...@@ -475,7 +475,7 @@ void CppToolsPlugin::test_modelmanager_refresh_added_and_purge_removed()
pi.appendProjectPart(part); pi.appendProjectPart(part);
CPlusPlus::Snapshot snapshot; CPlusPlus::Snapshot snapshot;
QStringList refreshedFiles; QSet<QString> refreshedFiles;
refreshedFiles = updateProjectInfo(mm, &helper, pi); refreshedFiles = updateProjectInfo(mm, &helper, pi);
...@@ -533,7 +533,7 @@ void CppToolsPlugin::test_modelmanager_refresh_timeStampModified_if_sourcefiles_ ...@@ -533,7 +533,7 @@ void CppToolsPlugin::test_modelmanager_refresh_timeStampModified_if_sourcefiles_
Document::Ptr document; Document::Ptr document;
CPlusPlus::Snapshot snapshot; CPlusPlus::Snapshot snapshot;
QStringList refreshedFiles; QSet<QString> refreshedFiles;
refreshedFiles = updateProjectInfo(mm, &helper, pi); refreshedFiles = updateProjectInfo(mm, &helper, pi);
...@@ -608,7 +608,7 @@ void CppToolsPlugin::test_modelmanager_refresh_timeStampModified_if_sourcefiles_ ...@@ -608,7 +608,7 @@ void CppToolsPlugin::test_modelmanager_refresh_timeStampModified_if_sourcefiles_
/// files of the first project. /// files of the first project.
void CppToolsPlugin::test_modelmanager_snapshot_after_two_projects() void CppToolsPlugin::test_modelmanager_snapshot_after_two_projects()
{ {
QStringList refreshedFiles; QSet<QString> refreshedFiles;
ModelManagerTestHelper helper; ModelManagerTestHelper helper;
ProjectCreator project1(&helper); ProjectCreator project1(&helper);
ProjectCreator project2(&helper); ProjectCreator project2(&helper);
...@@ -622,7 +622,7 @@ void CppToolsPlugin::test_modelmanager_snapshot_after_two_projects() ...@@ -622,7 +622,7 @@ void CppToolsPlugin::test_modelmanager_snapshot_after_two_projects()
<< _("main.cpp")); << _("main.cpp"));
refreshedFiles = updateProjectInfo(mm, &helper, project1.projectInfo); refreshedFiles = updateProjectInfo(mm, &helper, project1.projectInfo);
QCOMPARE(refreshedFiles.toSet(), project1.projectFiles.toSet()); QCOMPARE(refreshedFiles, project1.projectFiles.toSet());
const int snapshotSizeAfterProject1 = mm->snapshot().size(); const int snapshotSizeAfterProject1 = mm->snapshot().size();
foreach (const QString &file, project1.projectFiles) foreach (const QString &file, project1.projectFiles)
...@@ -636,7 +636,7 @@ void CppToolsPlugin::test_modelmanager_snapshot_after_two_projects() ...@@ -636,7 +636,7 @@ void CppToolsPlugin::test_modelmanager_snapshot_after_two_projects()
<< _("main.cpp")); << _("main.cpp"));
refreshedFiles = updateProjectInfo(mm, &helper, project2.projectInfo); refreshedFiles = updateProjectInfo(mm, &helper, project2.projectInfo);
QCOMPARE(refreshedFiles.toSet(), project2.projectFiles.toSet()); QCOMPARE(refreshedFiles, project2.projectFiles.toSet());
const int snapshotSizeAfterProject2 = mm->snapshot().size(); const int snapshotSizeAfterProject2 = mm->snapshot().size();
QVERIFY(snapshotSizeAfterProject2 > snapshotSizeAfterProject1); QVERIFY(snapshotSizeAfterProject2 > snapshotSizeAfterProject1);
......
...@@ -110,7 +110,7 @@ public: ...@@ -110,7 +110,7 @@ public:
virtual void renameMacroUsages(const CPlusPlus::Macro &macro, const QString &replacement = QString()) = 0; virtual void renameMacroUsages(const CPlusPlus::Macro &macro, const QString &replacement = QString()) = 0;
virtual void findMacroUsages(const CPlusPlus::Macro &macro) = 0;