aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/cppeditor
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2022-11-23 19:00:38 +0100
committerhjk <hjk@qt.io>2022-11-29 12:27:10 +0000
commit83720540a1370ef455cf129beb3c30fe565e0b68 (patch)
tree6efa64c52dc0c6cee8a733326a0f0bb00f7f8fb0 /src/plugins/cppeditor
parent9a32aae70678ad88a04174e0939be17326aaff11 (diff)
CppEditor: Convert parts of ModelManagerInterface to FilePath
Change-Id: If7503b6d6732e1735eb8d48ece6e80886d10c647 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/plugins/cppeditor')
-rw-r--r--src/plugins/cppeditor/baseeditordocumentparser.cpp2
-rw-r--r--src/plugins/cppeditor/baseeditordocumentparser.h2
-rw-r--r--src/plugins/cppeditor/builtineditordocumentparser.cpp2
-rw-r--r--src/plugins/cppeditor/builtineditordocumentparser.h2
-rw-r--r--src/plugins/cppeditor/cppcodemodelinspectordialog.cpp2
-rw-r--r--src/plugins/cppeditor/cppcompletion_test.cpp2
-rw-r--r--src/plugins/cppeditor/cppcompletionassist.cpp2
-rw-r--r--src/plugins/cppeditor/cppincludehierarchy.cpp2
-rw-r--r--src/plugins/cppeditor/cpplocatorfilter_test.cpp16
-rw-r--r--src/plugins/cppeditor/cppmodelmanager.cpp12
-rw-r--r--src/plugins/cppeditor/cppmodelmanager.h4
-rw-r--r--src/plugins/cppeditor/cppmodelmanager_test.cpp46
-rw-r--r--src/plugins/cppeditor/cppquickfixes.cpp3
-rw-r--r--src/plugins/cppeditor/cppsourceprocessor_test.cpp4
-rw-r--r--src/plugins/cppeditor/cpptoolstestcase.cpp10
-rw-r--r--src/plugins/cppeditor/cpptoolstestcase.h10
-rw-r--r--src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp3
17 files changed, 60 insertions, 64 deletions
diff --git a/src/plugins/cppeditor/baseeditordocumentparser.cpp b/src/plugins/cppeditor/baseeditordocumentparser.cpp
index 48a9605124..8451126572 100644
--- a/src/plugins/cppeditor/baseeditordocumentparser.cpp
+++ b/src/plugins/cppeditor/baseeditordocumentparser.cpp
@@ -87,7 +87,7 @@ ProjectPartInfo BaseEditorDocumentParser::projectPartInfo() const
return state().projectPartInfo;
}
-BaseEditorDocumentParser::Ptr BaseEditorDocumentParser::get(const QString &filePath)
+BaseEditorDocumentParser::Ptr BaseEditorDocumentParser::get(const FilePath &filePath)
{
CppModelManager *cmmi = CppModelManager::instance();
if (CppEditorDocumentHandle *cppEditorDocument = cmmi->cppEditorDocument(filePath)) {
diff --git a/src/plugins/cppeditor/baseeditordocumentparser.h b/src/plugins/cppeditor/baseeditordocumentparser.h
index 98317b5c2d..59fc9d50dc 100644
--- a/src/plugins/cppeditor/baseeditordocumentparser.h
+++ b/src/plugins/cppeditor/baseeditordocumentparser.h
@@ -24,7 +24,7 @@ class CPPEDITOR_EXPORT BaseEditorDocumentParser : public QObject
public:
using Ptr = QSharedPointer<BaseEditorDocumentParser>;
- static Ptr get(const QString &filePath);
+ static Ptr get(const Utils::FilePath &filePath);
struct Configuration {
bool usePrecompiledHeaders = false;
diff --git a/src/plugins/cppeditor/builtineditordocumentparser.cpp b/src/plugins/cppeditor/builtineditordocumentparser.cpp
index 1c5baa8481..7593684d7c 100644
--- a/src/plugins/cppeditor/builtineditordocumentparser.cpp
+++ b/src/plugins/cppeditor/builtineditordocumentparser.cpp
@@ -239,7 +239,7 @@ ProjectExplorer::HeaderPaths BuiltinEditorDocumentParser::headerPaths() const
return extraState().headerPaths;
}
-BuiltinEditorDocumentParser::Ptr BuiltinEditorDocumentParser::get(const QString &filePath)
+BuiltinEditorDocumentParser::Ptr BuiltinEditorDocumentParser::get(const FilePath &filePath)
{
if (BaseEditorDocumentParser::Ptr b = BaseEditorDocumentParser::get(filePath))
return b.objectCast<BuiltinEditorDocumentParser>();
diff --git a/src/plugins/cppeditor/builtineditordocumentparser.h b/src/plugins/cppeditor/builtineditordocumentparser.h
index ab97ce0d6f..e37dcfeb86 100644
--- a/src/plugins/cppeditor/builtineditordocumentparser.h
+++ b/src/plugins/cppeditor/builtineditordocumentparser.h
@@ -33,7 +33,7 @@ signals:
public:
using Ptr = QSharedPointer<BuiltinEditorDocumentParser>;
- static Ptr get(const QString &filePath);
+ static Ptr get(const Utils::FilePath &filePath);
private:
void updateImpl(const QFutureInterface<void> &future,
diff --git a/src/plugins/cppeditor/cppcodemodelinspectordialog.cpp b/src/plugins/cppeditor/cppcodemodelinspectordialog.cpp
index 176bd9f4fc..1f2349f113 100644
--- a/src/plugins/cppeditor/cppcodemodelinspectordialog.cpp
+++ b/src/plugins/cppeditor/cppcodemodelinspectordialog.cpp
@@ -1515,7 +1515,7 @@ void CppCodeModelInspectorDialog::refresh()
TextEditor::BaseTextEditor *editor = currentEditor();
CppEditorDocumentHandle *cppEditorDocument = nullptr;
if (editor) {
- const QString editorFilePath = editor->document()->filePath().toString();
+ const FilePath editorFilePath = editor->document()->filePath();
cppEditorDocument = cmmi->cppEditorDocument(editorFilePath);
if (auto documentProcessor = CppModelManager::cppEditorDocumentProcessor(editorFilePath)) {
const Snapshot editorSnapshot = documentProcessor->snapshot();
diff --git a/src/plugins/cppeditor/cppcompletion_test.cpp b/src/plugins/cppeditor/cppcompletion_test.cpp
index 7fa42a4be9..beba34ac4d 100644
--- a/src/plugins/cppeditor/cppcompletion_test.cpp
+++ b/src/plugins/cppeditor/cppcompletion_test.cpp
@@ -68,7 +68,7 @@ public:
m_textDocument = m_editorWidget->document();
// Get Document
- const Document::Ptr document = waitForFileInGlobalSnapshot(filePath.toString());
+ const Document::Ptr document = waitForFileInGlobalSnapshot(filePath);
QVERIFY(document);
QVERIFY(document->diagnosticMessages().isEmpty());
diff --git a/src/plugins/cppeditor/cppcompletionassist.cpp b/src/plugins/cppeditor/cppcompletionassist.cpp
index 8be4155bcf..0e68454d09 100644
--- a/src/plugins/cppeditor/cppcompletionassist.cpp
+++ b/src/plugins/cppeditor/cppcompletionassist.cpp
@@ -411,7 +411,7 @@ std::unique_ptr<AssistInterface> InternalCompletionAssistProvider::createAssistI
return std::make_unique<CppCompletionAssistInterface>(
filePath,
textEditorWidget,
- BuiltinEditorDocumentParser::get(filePath.toString()),
+ BuiltinEditorDocumentParser::get(filePath),
languageFeatures,
reason,
CppModelManager::instance()->workingCopy());
diff --git a/src/plugins/cppeditor/cppincludehierarchy.cpp b/src/plugins/cppeditor/cppincludehierarchy.cpp
index 439f8e1fea..d9211aebed 100644
--- a/src/plugins/cppeditor/cppincludehierarchy.cpp
+++ b/src/plugins/cppeditor/cppincludehierarchy.cpp
@@ -197,7 +197,7 @@ void CppIncludeHierarchyItem::fetchMore()
model()->m_seen.insert(m_filePath);
- const QString editorFilePath = model()->editorFilePath();
+ const FilePath editorFilePath = FilePath::fromString(model()->editorFilePath());
setChildrenChecked();
if (m_subTree == InIncludes) {
diff --git a/src/plugins/cppeditor/cpplocatorfilter_test.cpp b/src/plugins/cppeditor/cpplocatorfilter_test.cpp
index a48d74da30..d838387c3b 100644
--- a/src/plugins/cppeditor/cpplocatorfilter_test.cpp
+++ b/src/plugins/cppeditor/cpplocatorfilter_test.cpp
@@ -69,14 +69,14 @@ class CppCurrentDocumentFilterTestCase
, public CppEditor::Tests::TestCase
{
public:
- CppCurrentDocumentFilterTestCase(const QString &fileName,
+ CppCurrentDocumentFilterTestCase(const FilePath &filePath,
const ResultDataList &expectedResults,
const QString &searchText = QString())
: BasicLocatorFilterTest(CppModelManager::instance()->currentDocumentFilter())
- , m_fileName(fileName)
+ , m_filePath(filePath)
{
QVERIFY(succeededSoFar());
- QVERIFY(!m_fileName.isEmpty());
+ QVERIFY(!m_filePath.isEmpty());
ResultDataList results = ResultData::fromFilterEntryList(matchesFor(searchText));
if (debug) {
@@ -93,10 +93,10 @@ private:
QVERIFY(DocumentModel::openedDocuments().isEmpty());
QVERIFY(garbageCollectGlobalSnapshot());
- m_editor = EditorManager::openEditor(FilePath::fromString(m_fileName));
+ m_editor = EditorManager::openEditor(m_filePath);
QVERIFY(m_editor);
- QVERIFY(waitForFileInGlobalSnapshot(m_fileName));
+ QVERIFY(waitForFileInGlobalSnapshot(m_filePath));
}
void doAfterLocatorRun() override
@@ -109,7 +109,7 @@ private:
private:
IEditor *m_editor = nullptr;
- const QString m_fileName;
+ const FilePath m_filePath;
};
} // anonymous namespace
@@ -301,7 +301,7 @@ void LocatorFilterTest::testLocatorFilter_data()
void LocatorFilterTest::testCurrentDocumentFilter()
{
MyTestDataDir testDirectory("testdata_basic");
- const QString testFile = testDirectory.file("file1.cpp");
+ const FilePath testFile = testDirectory.filePath("file1.cpp");
auto expectedResults = ResultDataList{
ResultData("int myVariable", ""),
@@ -355,7 +355,7 @@ void LocatorFilterTest::testCurrentDocumentFilter()
void LocatorFilterTest::testCurrentDocumentHighlighting()
{
MyTestDataDir testDirectory("testdata_basic");
- const QString testFile = testDirectory.file("file1.cpp");
+ const FilePath testFile = testDirectory.filePath("file1.cpp");
const QString searchText = "pos";
const ResultDataList expectedResults{
diff --git a/src/plugins/cppeditor/cppmodelmanager.cpp b/src/plugins/cppeditor/cppmodelmanager.cpp
index 8b27d02491..cce4594704 100644
--- a/src/plugins/cppeditor/cppmodelmanager.cpp
+++ b/src/plugins/cppeditor/cppmodelmanager.cpp
@@ -1111,16 +1111,16 @@ void CppModelManager::removeExtraEditorSupport(AbstractEditorSupport *editorSupp
d->m_extraEditorSupports.remove(editorSupport);
}
-CppEditorDocumentHandle *CppModelManager::cppEditorDocument(const QString &filePath) const
+CppEditorDocumentHandle *CppModelManager::cppEditorDocument(const FilePath &filePath) const
{
if (filePath.isEmpty())
return nullptr;
QMutexLocker locker(&d->m_cppEditorDocumentsMutex);
- return d->m_cppEditorDocuments.value(filePath, 0);
+ return d->m_cppEditorDocuments.value(filePath.toString(), 0);
}
-BaseEditorDocumentProcessor *CppModelManager::cppEditorDocumentProcessor(const QString &filePath)
+BaseEditorDocumentProcessor *CppModelManager::cppEditorDocumentProcessor(const FilePath &filePath)
{
const auto document = instance()->cppEditorDocument(filePath);
return document ? document->processor() : nullptr;
@@ -1442,7 +1442,7 @@ void CppModelManager::updateCppEditorDocuments(bool projectsUpdated) const
const QList<Core::IEditor *> editors = Core::EditorManager::visibleEditors();
for (Core::IEditor *editor: editors) {
if (Core::IDocument *document = editor->document()) {
- const QString filePath = document->filePath().toString();
+ const FilePath filePath = document->filePath();
if (CppEditorDocumentHandle *theCppEditorDocument = cppEditorDocument(filePath)) {
visibleCppEditorDocuments.insert(document);
theCppEditorDocument->processor()->run(projectsUpdated);
@@ -1455,7 +1455,7 @@ void CppModelManager::updateCppEditorDocuments(bool projectsUpdated) const
= Utils::toSet(Core::DocumentModel::openedDocuments());
invisibleCppEditorDocuments.subtract(visibleCppEditorDocuments);
for (Core::IDocument *document : std::as_const(invisibleCppEditorDocuments)) {
- const QString filePath = document->filePath().toString();
+ const FilePath filePath = document->filePath();
if (CppEditorDocumentHandle *theCppEditorDocument = cppEditorDocument(filePath)) {
const CppEditorDocumentHandle::RefreshReason refreshReason = projectsUpdated
? CppEditorDocumentHandle::ProjectUpdate
@@ -1708,7 +1708,7 @@ void CppModelManager::onCurrentEditorChanged(Core::IEditor *editor)
if (!editor || !editor->document())
return;
- const QString filePath = editor->document()->filePath().toString();
+ const FilePath filePath = editor->document()->filePath();
if (CppEditorDocumentHandle *theCppEditorDocument = cppEditorDocument(filePath)) {
const CppEditorDocumentHandle::RefreshReason refreshReason
= theCppEditorDocument->refreshReason();
diff --git a/src/plugins/cppeditor/cppmodelmanager.h b/src/plugins/cppeditor/cppmodelmanager.h
index 63f52d22e3..6de6b58f45 100644
--- a/src/plugins/cppeditor/cppmodelmanager.h
+++ b/src/plugins/cppeditor/cppmodelmanager.h
@@ -137,8 +137,8 @@ public:
void removeExtraEditorSupport(AbstractEditorSupport *editorSupport);
const QList<CppEditorDocumentHandle *> cppEditorDocuments() const;
- CppEditorDocumentHandle *cppEditorDocument(const QString &filePath) const;
- static BaseEditorDocumentProcessor *cppEditorDocumentProcessor(const QString &filePath);
+ CppEditorDocumentHandle *cppEditorDocument(const Utils::FilePath &filePath) const;
+ static BaseEditorDocumentProcessor *cppEditorDocumentProcessor(const Utils::FilePath &filePath);
void registerCppEditorDocument(CppEditorDocumentHandle *cppEditorDocument);
void unregisterCppEditorDocument(const QString &filePath);
diff --git a/src/plugins/cppeditor/cppmodelmanager_test.cpp b/src/plugins/cppeditor/cppmodelmanager_test.cpp
index 0c08e81008..dbc560c53c 100644
--- a/src/plugins/cppeditor/cppmodelmanager_test.cpp
+++ b/src/plugins/cppeditor/cppmodelmanager_test.cpp
@@ -5,7 +5,6 @@
#include "baseeditordocumentprocessor.h"
#include "builtineditordocumentparser.h"
-#include "cppsourceprocessor.h"
#include "cpptoolstestcase.h"
#include "editordocumenthandle.h"
#include "modelmanagertesthelper.h"
@@ -161,15 +160,15 @@ private:
const Utils::FilePath m_filePath;
};
-ProjectPart::ConstPtr projectPartOfEditorDocument(const QString &filePath)
+} // anonymous namespace
+
+static ProjectPart::ConstPtr projectPartOfEditorDocument(const FilePath &filePath)
{
auto *editorDocument = CppModelManager::instance()->cppEditorDocument(filePath);
QTC_ASSERT(editorDocument, return ProjectPart::ConstPtr());
return editorDocument->processor()->parser()->projectPartInfo().projectPart;
}
-} // anonymous namespace
-
/// Check: The preprocessor cleans include and framework paths.
void ModelManagerTest::testPathsAreClean()
{
@@ -792,8 +791,8 @@ void ModelManagerTest::testPrecompiledHeaders()
ModelManagerTestHelper helper;
MyTestDataDir testDataDirectory(_("testdata_defines"));
- const QString main1File = testDataDirectory.file(_("main1.cpp"));
- const QString main2File = testDataDirectory.file(_("main2.cpp"));
+ const FilePath main1File = testDataDirectory.filePath("main1.cpp");
+ const FilePath main2File = testDataDirectory.filePath("main2.cpp");
const QString header = testDataDirectory.file(_("header.h"));
const QString pch1File = testDataDirectory.file(_("pch1.h"));
const QString pch2File = testDataDirectory.file(_("pch2.h"));
@@ -809,7 +808,7 @@ void ModelManagerTest::testPrecompiledHeaders()
rpp1.setPreCompiledHeaders({pch1File});
rpp1.setHeaderPaths({HeaderPath::makeUser(testDataDirectory.includeDir(false))});
const auto part1 = ProjectPart::create(project->projectFilePath(), rpp1, {},
- {{main1File, ProjectFile::CXXSource}, {header, ProjectFile::CXXHeader}});
+ {{main1File.toString(), ProjectFile::CXXSource}, {header, ProjectFile::CXXHeader}});
RawProjectPart rpp2;
rpp2.setProjectFileLocation("project2.projectfile");
@@ -817,7 +816,7 @@ void ModelManagerTest::testPrecompiledHeaders()
rpp2.setPreCompiledHeaders({pch2File});
rpp2.setHeaderPaths({HeaderPath::makeUser(testDataDirectory.includeDir(false))});
const auto part2 = ProjectPart::create(project->projectFilePath(), rpp2, {},
- {{main2File, ProjectFile::CXXSource}, {header, ProjectFile::CXXHeader}});
+ {{main2File.toString(), ProjectFile::CXXSource}, {header, ProjectFile::CXXHeader}});
const auto pi = ProjectInfo::create({project, KitInfo(nullptr), {}, {}}, {part1, part2});
@@ -830,7 +829,7 @@ void ModelManagerTest::testPrecompiledHeaders()
struct Data {
QString firstDeclarationName;
QString firstClassInPchFile;
- QString fileName;
+ FilePath filePath;
} d[] = {
{_("one"), _("ClassInPch1"), main1File},
{_("two"), _("ClassInPch2"), main2File}
@@ -838,16 +837,15 @@ void ModelManagerTest::testPrecompiledHeaders()
for (auto &i : d) {
const QString firstDeclarationName = i.firstDeclarationName;
const QByteArray firstClassInPchFile = i.firstClassInPchFile.toUtf8();
- const QString fileName = i.fileName;
+ const FilePath filePath = i.filePath;
- Core::IEditor *editor = Core::EditorManager::openEditor(
- Utils::FilePath::fromString(fileName));
+ Core::IEditor *editor = Core::EditorManager::openEditor(filePath);
EditorCloser closer(editor);
QVERIFY(editor);
QCOMPARE(Core::DocumentModel::openedDocuments().size(), 1);
QVERIFY(mm->isCppEditor(editor));
- auto parser = BuiltinEditorDocumentParser::get(fileName);
+ auto parser = BuiltinEditorDocumentParser::get(filePath);
QVERIFY(parser);
BaseEditorDocumentParser::Configuration config = parser->configuration();
config.usePrecompiledHeaders = true;
@@ -856,7 +854,7 @@ void ModelManagerTest::testPrecompiledHeaders()
Utils::Language::Cxx, false});
// Check if defines from pch are considered
- Document::Ptr document = mm->document(Utils::FilePath::fromString(fileName));
+ Document::Ptr document = mm->document(filePath);
QCOMPARE(nameOfFirstDeclaration(document), firstDeclarationName);
// Check if declarations from pch are considered
@@ -922,7 +920,7 @@ void ModelManagerTest::testDefinesPerEditor()
QCOMPARE(Core::DocumentModel::openedDocuments().size(), 1);
QVERIFY(mm->isCppEditor(editor));
- const QString filePath = editor->document()->filePath().toString();
+ const FilePath filePath = editor->document()->filePath();
const auto parser = BaseEditorDocumentParser::get(filePath);
BaseEditorDocumentParser::Configuration config = parser->configuration();
config.editorDefines = editorDefines.toUtf8();
@@ -940,11 +938,11 @@ void ModelManagerTest::testUpdateEditorsAfterProjectUpdate()
ModelManagerTestHelper helper;
MyTestDataDir testDataDirectory(_("testdata_defines"));
- const QString fileA = testDataDirectory.file(_("main1.cpp")); // content not relevant
- const QString fileB = testDataDirectory.file(_("main2.cpp")); // content not relevant
+ const FilePath fileA = testDataDirectory.filePath("main1.cpp"); // content not relevant
+ const FilePath fileB = testDataDirectory.filePath("main2.cpp"); // content not relevant
// Open file A in editor
- Core::IEditor *editorA = Core::EditorManager::openEditor(Utils::FilePath::fromString(fileA));
+ Core::IEditor *editorA = Core::EditorManager::openEditor(fileA);
QVERIFY(editorA);
EditorCloser closerA(editorA);
QCOMPARE(Core::DocumentModel::openedDocuments().size(), 1);
@@ -953,7 +951,7 @@ void ModelManagerTest::testUpdateEditorsAfterProjectUpdate()
QVERIFY(!documentAProjectPart->hasProject());
// Open file B in editor
- Core::IEditor *editorB = Core::EditorManager::openEditor(Utils::FilePath::fromString(fileB));
+ Core::IEditor *editorB = Core::EditorManager::openEditor(fileB);
QVERIFY(editorB);
EditorCloser closerB(editorB);
QCOMPARE(Core::DocumentModel::openedDocuments().size(), 2);
@@ -971,7 +969,7 @@ void ModelManagerTest::testUpdateEditorsAfterProjectUpdate()
RawProjectPart rpp;
rpp.setQtVersion(Utils::QtMajorVersion::None);
const auto part = ProjectPart::create(project->projectFilePath(), rpp, {},
- {{fileA, ProjectFile::CXXSource}, {fileB, ProjectFile::CXXSource}});
+ {{fileA.toString(), ProjectFile::CXXSource}, {fileB.toString(), ProjectFile::CXXSource}});
const auto pi = ProjectInfo::create({project, KitInfo(nullptr), {}, {}}, {part});
helper.updateProjectInfo(pi);
@@ -1157,7 +1155,7 @@ void ModelManagerTest::testRenameIncludesInEditor()
QCOMPARE(renamedHeaderContents, originalMalformedGuardContents);
// Update the c++ model manager again and check for the new includes
- TestCase::waitForProcessedEditorDocument(mainFile.toString());
+ TestCase::waitForProcessedEditorDocument(mainFile);
modelManager->updateSourceFiles(sourceFiles).waitForFinished();
QCoreApplication::processEvents();
snapshot = modelManager->snapshot();
@@ -1186,7 +1184,7 @@ void ModelManagerTest::testDocumentsAndRevisions()
TextEditor::BaseTextEditor *editor1;
QVERIFY(helper.openCppEditor(filePath1, &editor1));
helper.closeEditorAtEndOfTestCase(editor1);
- QVERIFY(TestCase::waitForProcessedEditorDocument(filePath1.toString()));
+ QVERIFY(TestCase::waitForProcessedEditorDocument(filePath1));
VERIFY_DOCUMENT_REVISION(modelManager->document(filePath1), 2U);
VERIFY_DOCUMENT_REVISION(modelManager->document(filePath2), 1U);
@@ -1199,7 +1197,7 @@ void ModelManagerTest::testDocumentsAndRevisions()
TextEditor::BaseTextEditor *editor2;
QVERIFY(helper.openCppEditor(filePath2, &editor2));
helper.closeEditorAtEndOfTestCase(editor2);
- QVERIFY(TestCase::waitForProcessedEditorDocument(filePath2.toString()));
+ QVERIFY(TestCase::waitForProcessedEditorDocument(filePath2));
VERIFY_DOCUMENT_REVISION(modelManager->document(filePath1), 3U);
VERIFY_DOCUMENT_REVISION(modelManager->document(filePath2), 3U);
@@ -1209,4 +1207,4 @@ void ModelManagerTest::testDocumentsAndRevisions()
VERIFY_DOCUMENT_REVISION(modelManager->document(filePath2), 4U);
}
-} // namespace CppEditor::Internal
+} // CppEditor::Internal
diff --git a/src/plugins/cppeditor/cppquickfixes.cpp b/src/plugins/cppeditor/cppquickfixes.cpp
index 97f0c9500a..91181b91f5 100644
--- a/src/plugins/cppeditor/cppquickfixes.cpp
+++ b/src/plugins/cppeditor/cppquickfixes.cpp
@@ -7629,8 +7629,7 @@ void ConvertQt4Connect::match(const CppQuickFixInterface &interface, QuickFixOpe
void ExtraRefactoringOperations::match(const CppQuickFixInterface &interface,
QuickFixOperations &result)
{
- const auto processor = CppModelManager::cppEditorDocumentProcessor(
- interface.filePath().toString());
+ const auto processor = CppModelManager::cppEditorDocumentProcessor(interface.filePath());
if (processor) {
const auto clangFixItOperations = processor->extraRefactoringOperations(interface);
result.append(clangFixItOperations);
diff --git a/src/plugins/cppeditor/cppsourceprocessor_test.cpp b/src/plugins/cppeditor/cppsourceprocessor_test.cpp
index 58e0fdf630..06b1748d8f 100644
--- a/src/plugins/cppeditor/cppsourceprocessor_test.cpp
+++ b/src/plugins/cppeditor/cppsourceprocessor_test.cpp
@@ -110,8 +110,8 @@ void SourceProcessorTest::testIncludesCyclic()
testCase.closeEditorAtEndOfTestCase(editor);
// Check editor snapshot
- const QString filePath = editor->document()->filePath().toString();
- auto *processor = CppModelManager::cppEditorDocumentProcessor(filePath);
+ const FilePath filePath = editor->document()->filePath();
+ auto processor = CppModelManager::cppEditorDocumentProcessor(filePath);
QVERIFY(processor);
QVERIFY(TestCase::waitForProcessedEditorDocument(filePath));
Snapshot snapshot = processor->snapshot();
diff --git a/src/plugins/cppeditor/cpptoolstestcase.cpp b/src/plugins/cppeditor/cpptoolstestcase.cpp
index 79fdca9471..86d7008443 100644
--- a/src/plugins/cppeditor/cpptoolstestcase.cpp
+++ b/src/plugins/cppeditor/cpptoolstestcase.cpp
@@ -268,7 +268,7 @@ static bool waitForProcessedEditorDocument_internal(CppEditorDocumentHandle *edi
}
}
-bool TestCase::waitForProcessedEditorDocument(const QString &filePath, int timeOutInMs)
+bool TestCase::waitForProcessedEditorDocument(const FilePath &filePath, int timeOutInMs)
{
auto *editorDocument = CppModelManager::instance()->cppEditorDocument(filePath);
return waitForProcessedEditorDocument_internal(editorDocument, timeOutInMs);
@@ -314,21 +314,21 @@ bool TestCase::closeEditorWithoutGarbageCollectorInvocation(Core::IEditor *edito
return closeEditorsWithoutGarbageCollectorInvocation({editor});
}
-CPlusPlus::Document::Ptr TestCase::waitForFileInGlobalSnapshot(const QString &filePath,
+CPlusPlus::Document::Ptr TestCase::waitForFileInGlobalSnapshot(const FilePath &filePath,
int timeOutInMs)
{
- const auto documents = waitForFilesInGlobalSnapshot(QStringList(filePath), timeOutInMs);
+ const auto documents = waitForFilesInGlobalSnapshot({filePath}, timeOutInMs);
return documents.isEmpty() ? CPlusPlus::Document::Ptr() : documents.first();
}
-QList<CPlusPlus::Document::Ptr> TestCase::waitForFilesInGlobalSnapshot(const QStringList &filePaths,
+QList<CPlusPlus::Document::Ptr> TestCase::waitForFilesInGlobalSnapshot(const FilePaths &filePaths,
int timeOutInMs)
{
QElapsedTimer t;
t.start();
QList<CPlusPlus::Document::Ptr> result;
- for (const QString &filePath : filePaths) {
+ for (const FilePath &filePath : filePaths) {
forever {
if (CPlusPlus::Document::Ptr document = globalSnapshot().document(filePath)) {
result.append(document);
diff --git a/src/plugins/cppeditor/cpptoolstestcase.h b/src/plugins/cppeditor/cpptoolstestcase.h
index 53284f38be..20faf4ec90 100644
--- a/src/plugins/cppeditor/cpptoolstestcase.h
+++ b/src/plugins/cppeditor/cpptoolstestcase.h
@@ -135,19 +135,19 @@ public:
static CPlusPlus::Snapshot globalSnapshot();
static bool garbageCollectGlobalSnapshot();
- static bool waitForProcessedEditorDocument(const QString &filePath, int timeOutInMs = 5000);
+ static bool waitForProcessedEditorDocument(
+ const Utils::FilePath &filePath, int timeOutInMs = 5000);
+
static CPlusPlus::Document::Ptr waitForRehighlightedSemanticDocument(
CppEditorWidget *editorWidget);
enum { defaultTimeOutInMs = 30 * 1000 /*= 30 secs*/ };
static bool waitUntilProjectIsFullyOpened(ProjectExplorer::Project *project,
int timeOutInMs = defaultTimeOutInMs);
- static CPlusPlus::Document::Ptr waitForFileInGlobalSnapshot(
- const QString &filePath,
+ static CPlusPlus::Document::Ptr waitForFileInGlobalSnapshot(const Utils::FilePath &filePath,
int timeOutInMs = defaultTimeOutInMs);
static QList<CPlusPlus::Document::Ptr> waitForFilesInGlobalSnapshot(
- const QStringList &filePaths,
- int timeOutInMs = defaultTimeOutInMs);
+ const Utils::FilePaths &filePaths, int timeOutInMs = defaultTimeOutInMs);
static bool writeFile(const Utils::FilePath &filePath, const QByteArray &contents);
diff --git a/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp b/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp
index c15995504e..c4f325abdc 100644
--- a/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp
+++ b/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp
@@ -302,8 +302,7 @@ F2TestCase::F2TestCase(CppEditorAction action,
// The file is "Full Checked" since it is in the working copy now,
// that is the function bodies are processed.
forever {
- const Document::Ptr document =
- waitForFileInGlobalSnapshot(testFile->filePath().toString());
+ const Document::Ptr document = waitForFileInGlobalSnapshot(testFile->filePath());
QVERIFY(document);
if (document->checkMode() == Document::FullCheck) {
if (!document->diagnosticMessages().isEmpty())