From 03a91f9f98e0b3524be1be4e9c54c7be75a6b855 Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 23 Nov 2022 18:29:50 +0100 Subject: [PATCH] CppEditor: Remove Snapshot::remove(QString) overload ... and fix fallout. Change-Id: Ibbf865c3e4158fc98bb9b5372ce0633807b85576 Reviewed-by: Christian Stenger Reviewed-by: Qt CI Bot --- src/libs/cplusplus/CppDocument.h | 2 -- .../cppeditor/baseeditordocumentparser.cpp | 6 +++-- .../cppeditor/baseeditordocumentparser.h | 8 +++--- .../cppeditor/baseeditordocumentprocessor.cpp | 2 +- .../cppeditor/builtineditordocumentparser.cpp | 12 ++++----- .../cppeditor/builtineditordocumentparser.h | 2 +- .../builtineditordocumentprocessor.cpp | 3 +-- .../cppeditor/builtinindexingsupport.cpp | 4 +-- .../cppeditor/cppfollowsymbolundercursor.cpp | 2 +- src/plugins/cppeditor/cppmodelmanager.cpp | 9 ++++--- src/plugins/cppeditor/cppmodelmanager.h | 2 +- .../cppeditor/cppmodelmanager_test.cpp | 6 ++--- src/plugins/cppeditor/cppsourceprocessor.cpp | 27 ++++++++++--------- src/plugins/cppeditor/cppsourceprocessor.h | 8 +++--- src/plugins/cppeditor/cppworkingcopy.h | 6 ----- .../cppeditor/fileandtokenactions_test.cpp | 12 ++++----- 16 files changed, 53 insertions(+), 58 deletions(-) diff --git a/src/libs/cplusplus/CppDocument.h b/src/libs/cplusplus/CppDocument.h index ed5f672a63d..f46de300f4e 100644 --- a/src/libs/cplusplus/CppDocument.h +++ b/src/libs/cplusplus/CppDocument.h @@ -381,8 +381,6 @@ public: void insert(Document::Ptr doc); // ### remove void remove(const Utils::FilePath &fileName); // ### remove - void remove(const QString &fileName) - { remove(Utils::FilePath::fromString(fileName)); } const_iterator begin() const { return _documents.begin(); } const_iterator end() const { return _documents.end(); } diff --git a/src/plugins/cppeditor/baseeditordocumentparser.cpp b/src/plugins/cppeditor/baseeditordocumentparser.cpp index 1395b057a08..48a96051245 100644 --- a/src/plugins/cppeditor/baseeditordocumentparser.cpp +++ b/src/plugins/cppeditor/baseeditordocumentparser.cpp @@ -8,6 +8,8 @@ #include "cppprojectpartchooser.h" #include "editordocumenthandle.h" +using namespace Utils; + namespace CppEditor { /*! @@ -29,7 +31,7 @@ namespace CppEditor { \endlist */ -BaseEditorDocumentParser::BaseEditorDocumentParser(const QString &filePath) +BaseEditorDocumentParser::BaseEditorDocumentParser(const FilePath &filePath) : m_filePath(filePath) { static int meta = qRegisterMetaType("ProjectPartInfo"); @@ -38,7 +40,7 @@ BaseEditorDocumentParser::BaseEditorDocumentParser(const QString &filePath) BaseEditorDocumentParser::~BaseEditorDocumentParser() = default; -QString BaseEditorDocumentParser::filePath() const +const FilePath &BaseEditorDocumentParser::filePath() const { return m_filePath; } diff --git a/src/plugins/cppeditor/baseeditordocumentparser.h b/src/plugins/cppeditor/baseeditordocumentparser.h index 7a83c01caa5..98317b5c2da 100644 --- a/src/plugins/cppeditor/baseeditordocumentparser.h +++ b/src/plugins/cppeditor/baseeditordocumentparser.h @@ -58,10 +58,10 @@ public: }; public: - BaseEditorDocumentParser(const QString &filePath); + BaseEditorDocumentParser(const Utils::FilePath &filePath); ~BaseEditorDocumentParser() override; - QString filePath() const; + const Utils::FilePath &filePath() const; Configuration configuration() const; void setConfiguration(const Configuration &configuration); @@ -94,10 +94,10 @@ private: virtual void updateImpl(const QFutureInterface &future, const UpdateParams &updateParams) = 0; - const QString m_filePath; + const Utils::FilePath m_filePath; Configuration m_configuration; State m_state; mutable QMutex m_updateIsRunning; }; -} // namespace CppEditor +} // CppEditor diff --git a/src/plugins/cppeditor/baseeditordocumentprocessor.cpp b/src/plugins/cppeditor/baseeditordocumentprocessor.cpp index 252f0a49928..c470bb2dffe 100644 --- a/src/plugins/cppeditor/baseeditordocumentprocessor.cpp +++ b/src/plugins/cppeditor/baseeditordocumentprocessor.cpp @@ -69,7 +69,7 @@ void BaseEditorDocumentProcessor::runParser(QFutureInterface &future, } parser->update(future, updateParams); - CppModelManager::instance()->finishedRefreshingSourceFiles({parser->filePath()}); + CppModelManager::instance()->finishedRefreshingSourceFiles({parser->filePath().toString()}); future.setProgressValue(1); } diff --git a/src/plugins/cppeditor/builtineditordocumentparser.cpp b/src/plugins/cppeditor/builtineditordocumentparser.cpp index 02d52f4096a..1c5baa84818 100644 --- a/src/plugins/cppeditor/builtineditordocumentparser.cpp +++ b/src/plugins/cppeditor/builtineditordocumentparser.cpp @@ -31,7 +31,7 @@ static QByteArray overwrittenToolchainDefines(const ProjectPart &projectPart) return defines; } -BuiltinEditorDocumentParser::BuiltinEditorDocumentParser(const QString &filePath, +BuiltinEditorDocumentParser::BuiltinEditorDocumentParser(const FilePath &filePath, int fileSizeLimitInMb) : BaseEditorDocumentParser(filePath) , m_fileSizeLimitInMb(fileSizeLimitInMb) @@ -62,7 +62,7 @@ void BuiltinEditorDocumentParser::updateImpl(const QFutureInterface &futur QString projectConfigFile; LanguageFeatures features = LanguageFeatures::defaultFeatures(); - baseState.projectPartInfo = determineProjectPart(filePath(), + baseState.projectPartInfo = determineProjectPart(filePath().toString(), baseConfig.preferredProjectPartId, baseState.projectPartInfo, updateParams.activeProject, @@ -166,7 +166,7 @@ void BuiltinEditorDocumentParser::updateImpl(const QFutureInterface &futur state.snapshot.remove(filePath()); Internal::CppSourceProcessor sourceProcessor(state.snapshot, [&](const Document::Ptr &doc) { - const bool isInEditor = doc->filePath().toString() == filePath(); + const bool isInEditor = doc->filePath() == filePath(); Document::Ptr otherDoc = modelManager->document(doc->filePath()); unsigned newRev = otherDoc.isNull() ? 1U : otherDoc->revision() + 1; if (isInEditor) @@ -193,12 +193,12 @@ void BuiltinEditorDocumentParser::updateImpl(const QFutureInterface &futur sourceProcessor.run(precompiledHeader); } if (!baseState.editorDefines.isEmpty()) - sourceProcessor.run(CppModelManager::editorConfigurationFileName()); + sourceProcessor.run(CppModelManager::editorConfigurationFileName().path()); QStringList includedFiles = state.includedFiles; if (baseConfig.usePrecompiledHeaders) includedFiles << state.precompiledHeaders; includedFiles.removeDuplicates(); - sourceProcessor.run(filePath(), includedFiles); + sourceProcessor.run(filePath().toString(), includedFiles); state.snapshot = sourceProcessor.snapshot(); Snapshot newSnapshot = state.snapshot.simplified(state.snapshot.document(filePath())); for (Snapshot::const_iterator i = state.snapshot.begin(), ei = state.snapshot.end(); i != ei; ++i) { @@ -253,7 +253,7 @@ void BuiltinEditorDocumentParser::addFileAndDependencies(Snapshot *snapshot, QTC_ASSERT(snapshot, return); toRemove->insert(fileName); - if (fileName != Utils::FilePath::fromString(filePath())) { + if (fileName != filePath()) { Utils::FilePaths deps = snapshot->filesDependingOn(fileName); toRemove->unite(Utils::toSet(deps)); } diff --git a/src/plugins/cppeditor/builtineditordocumentparser.h b/src/plugins/cppeditor/builtineditordocumentparser.h index ebcd1a584ab..ab97ce0d6fd 100644 --- a/src/plugins/cppeditor/builtineditordocumentparser.h +++ b/src/plugins/cppeditor/builtineditordocumentparser.h @@ -17,7 +17,7 @@ class CPPEDITOR_EXPORT BuiltinEditorDocumentParser : public BaseEditorDocumentPa Q_OBJECT public: - BuiltinEditorDocumentParser(const QString &filePath, int fileSizeLimitInMb = -1); + BuiltinEditorDocumentParser(const Utils::FilePath &filePath, int fileSizeLimitInMb = -1); bool releaseSourceAndAST() const; void setReleaseSourceAndAST(bool release); diff --git a/src/plugins/cppeditor/builtineditordocumentprocessor.cpp b/src/plugins/cppeditor/builtineditordocumentprocessor.cpp index fa74f71e6c4..51a6be16636 100644 --- a/src/plugins/cppeditor/builtineditordocumentprocessor.cpp +++ b/src/plugins/cppeditor/builtineditordocumentprocessor.cpp @@ -137,8 +137,7 @@ QList toTextEditorBlocks( BuiltinEditorDocumentProcessor::BuiltinEditorDocumentProcessor(TextEditor::TextDocument *document) : BaseEditorDocumentProcessor(document->document(), document->filePath()) - , m_parser(new BuiltinEditorDocumentParser(document->filePath().toString(), - indexerFileSizeLimitInMb())) + , m_parser(new BuiltinEditorDocumentParser(document->filePath(), indexerFileSizeLimitInMb())) , m_codeWarningsUpdated(false) , m_semanticHighlighter(new SemanticHighlighter(document)) { diff --git a/src/plugins/cppeditor/builtinindexingsupport.cpp b/src/plugins/cppeditor/builtinindexingsupport.cpp index 4a8182e34d6..7a9b2f16662 100644 --- a/src/plugins/cppeditor/builtinindexingsupport.cpp +++ b/src/plugins/cppeditor/builtinindexingsupport.cpp @@ -135,7 +135,7 @@ void indexFindErrors(QFutureInterface &indexingFuture, qDebug("FindErrorsIndexing: \"%s\"", qPrintable(file)); // Parse the file as precisely as possible - BuiltinEditorDocumentParser parser(file); + BuiltinEditorDocumentParser parser(FilePath::fromString(file)); parser.setReleaseSourceAndAST(false); parser.update({CppModelManager::instance()->workingCopy(), nullptr, Utils::Language::Cxx, false}); @@ -171,7 +171,7 @@ void index(QFutureInterface &indexingFuture, classifyFiles(params.sourceFiles, &headers, &sources); for (const QString &file : std::as_const(params.sourceFiles)) - sourceProcessor->removeFromCache(file); + sourceProcessor->removeFromCache(FilePath::fromString(file)); const int sourceCount = sources.size(); QStringList files = sources + headers; diff --git a/src/plugins/cppeditor/cppfollowsymbolundercursor.cpp b/src/plugins/cppeditor/cppfollowsymbolundercursor.cpp index dda644e2346..78bff453294 100644 --- a/src/plugins/cppeditor/cppfollowsymbolundercursor.cpp +++ b/src/plugins/cppeditor/cppfollowsymbolundercursor.cpp @@ -648,7 +648,7 @@ void FollowSymbolUnderCursor::findLink( return processLinkCallback(link); //already on definition! } else if (const Document::MacroUse *use = doc->findMacroUseAt(endOfToken - 1)) { const FilePath filePath = use->macro().filePath(); - if (filePath.path() == CppModelManager::editorConfigurationFileName()) { + if (filePath.path() == CppModelManager::editorConfigurationFileName().path()) { editorWidget->showPreProcessorWidget(); } else if (filePath.path() != CppModelManager::configurationFileName().path()) { const Macro ¯o = use->macro(); diff --git a/src/plugins/cppeditor/cppmodelmanager.cpp b/src/plugins/cppeditor/cppmodelmanager.cpp index a768af90737..8b27d024910 100644 --- a/src/plugins/cppeditor/cppmodelmanager.cpp +++ b/src/plugins/cppeditor/cppmodelmanager.cpp @@ -304,9 +304,10 @@ CppSourceProcessor *CppModelManager::createSourceProcessor() }); } -QString CppModelManager::editorConfigurationFileName() +const FilePath &CppModelManager::editorConfigurationFileName() { - return QLatin1String(""); + static const FilePath config = FilePath::fromPathPart(u""); + return config; } ModelManagerSupport *CppModelManager::modelManagerSupport(Backend backend) const @@ -1309,7 +1310,7 @@ void CppModelManager::removeProjectInfoFilesAndIncludesFromSnapshot(const Projec FilePath::fromString(cxxFile.path)); for (const FilePath &filePath : filePaths) d->m_snapshot.remove(filePath); - d->m_snapshot.remove(cxxFile.path); + d->m_snapshot.remove(FilePath::fromString(cxxFile.path)); } } } @@ -1325,7 +1326,7 @@ void CppModelManager::removeFilesFromSnapshot(const QSet &filesToRemove { QMutexLocker snapshotLocker(&d->m_snapshotMutex); for (const QString &file : filesToRemove) - d->m_snapshot.remove(file); + d->m_snapshot.remove(FilePath::fromString(file)); } class ProjectInfoComparer diff --git a/src/plugins/cppeditor/cppmodelmanager.h b/src/plugins/cppeditor/cppmodelmanager.h index 78d9a3685ed..63f52d22e36 100644 --- a/src/plugins/cppeditor/cppmodelmanager.h +++ b/src/plugins/cppeditor/cppmodelmanager.h @@ -211,7 +211,7 @@ public: static Internal::CppSourceProcessor *createSourceProcessor(); static const Utils::FilePath &configurationFileName(); - static QString editorConfigurationFileName(); + static const Utils::FilePath &editorConfigurationFileName(); void setLocatorFilter(std::unique_ptr &&filter); void setClassesFilter(std::unique_ptr &&filter); diff --git a/src/plugins/cppeditor/cppmodelmanager_test.cpp b/src/plugins/cppeditor/cppmodelmanager_test.cpp index 82ce9287fc7..0c08e810081 100644 --- a/src/plugins/cppeditor/cppmodelmanager_test.cpp +++ b/src/plugins/cppeditor/cppmodelmanager_test.cpp @@ -1059,7 +1059,7 @@ void ModelManagerTest::testRenameIncludesInEditor() const QString renamedHeaderWithUnderscoredGuard(workingDir.filePath(_("foobar4000.h"))); const QString headerWithMalformedGuard(workingDir.filePath(_("baz3.h"))); const QString renamedHeaderWithMalformedGuard(workingDir.filePath(_("foobar5000.h"))); - const QString mainFile(workingDir.filePath(_("main.cpp"))); + const FilePath mainFile = FilePath::fromString(workingDir.filePath("main.cpp")); CppModelManager *modelManager = CppModelManager::instance(); const MyTestDataDir testDir(_("testdata_project1")); @@ -1088,7 +1088,7 @@ void ModelManagerTest::testRenameIncludesInEditor() // Open a file in the editor QCOMPARE(Core::DocumentModel::openedDocuments().size(), 0); - Core::IEditor *editor = Core::EditorManager::openEditor(Utils::FilePath::fromString(mainFile)); + Core::IEditor *editor = Core::EditorManager::openEditor(mainFile); QVERIFY(editor); EditorCloser editorCloser(editor); Utils::ExecuteOnDestruction saveAllFiles([](){ @@ -1157,7 +1157,7 @@ void ModelManagerTest::testRenameIncludesInEditor() QCOMPARE(renamedHeaderContents, originalMalformedGuardContents); // Update the c++ model manager again and check for the new includes - TestCase::waitForProcessedEditorDocument(mainFile); + TestCase::waitForProcessedEditorDocument(mainFile.toString()); modelManager->updateSourceFiles(sourceFiles).waitForFinished(); QCoreApplication::processEvents(); snapshot = modelManager->snapshot(); diff --git a/src/plugins/cppeditor/cppsourceprocessor.cpp b/src/plugins/cppeditor/cppsourceprocessor.cpp index 340c441d39d..1e11b8939c5 100644 --- a/src/plugins/cppeditor/cppsourceprocessor.cpp +++ b/src/plugins/cppeditor/cppsourceprocessor.cpp @@ -170,9 +170,9 @@ void CppSourceProcessor::run(const QString &fileName, sourceNeeded(0, fileName, IncludeGlobal, initialIncludes); } -void CppSourceProcessor::removeFromCache(const QString &fileName) +void CppSourceProcessor::removeFromCache(const FilePath &filePath) { - m_snapshot.remove(fileName); + m_snapshot.remove(filePath); } void CppSourceProcessor::resetEnvironment() @@ -213,7 +213,7 @@ bool CppSourceProcessor::getFileContents(const FilePath &absoluteFilePath, return true; } -bool CppSourceProcessor::checkFile(const QString &absoluteFilePath) const +bool CppSourceProcessor::checkFile(const FilePath &absoluteFilePath) const { if (absoluteFilePath.isEmpty() || m_included.contains(absoluteFilePath) @@ -221,8 +221,7 @@ bool CppSourceProcessor::checkFile(const QString &absoluteFilePath) const return true; } - const QFileInfo fileInfo(absoluteFilePath); - return fileInfo.isFile() && fileInfo.isReadable(); + return absoluteFilePath.isReadableFile(); } QString CppSourceProcessor::cleanPath(const QString &path) @@ -240,14 +239,15 @@ QString CppSourceProcessor::resolveFile(const QString &fileName, IncludeType typ if (isInjectedFile(fileName)) return fileName; - if (QFileInfo(fileName).isAbsolute()) - return checkFile(fileName) ? fileName : QString(); + const FilePath filePath = FilePath::fromString(fileName); + if (filePath.isAbsolutePath()) + return checkFile(filePath) ? fileName : QString(); if (m_currentDoc) { if (type == IncludeLocal) { const QFileInfo currentFileInfo = m_currentDoc->filePath().toFileInfo(); const QString path = cleanPath(currentFileInfo.absolutePath()) + fileName; - if (checkFile(path)) + if (checkFile(FilePath::fromString(path))) return path; // Fall through! "16.2 Source file inclusion" from the standard states to continue // searching as if this would be a global include. @@ -291,7 +291,8 @@ QString CppSourceProcessor::resolveFile_helper(const QString &fileName, } else { path = headerPathsIt->path + fileName; } - if (m_workingCopy.contains(path) || checkFile(path)) + const FilePath filePath = FilePath::fromString(path); + if (m_workingCopy.contains(filePath) || checkFile(filePath)) return path; } } @@ -386,7 +387,7 @@ void CppSourceProcessor::mergeEnvironment(Document::Ptr doc) if (Document::Ptr includedDoc = m_snapshot.document(includedFile)) mergeEnvironment(includedDoc); - else if (!m_included.contains(includedFile)) + else if (!m_included.contains(FilePath::fromString(includedFile))) run(includedFile); } @@ -421,10 +422,10 @@ void CppSourceProcessor::sourceNeeded(int line, const QString &fileName, Include return; } } - if (m_included.contains(absoluteFileName)) + if (m_included.contains(absoluteFilePath)) return; // We've already seen this file. if (!isInjectedFile(absoluteFileName)) - m_included.insert(absoluteFileName); + m_included.insert(absoluteFilePath); // Already in snapshot? Use it! if (Document::Ptr document = m_snapshot.document(absoluteFileName)) { @@ -451,7 +452,7 @@ void CppSourceProcessor::sourceNeeded(int line, const QString &fileName, Include document->setEditorRevision(editorRevision); document->setLanguageFeatures(m_languageFeatures); for (const QString &include : initialIncludes) { - m_included.insert(include); + m_included.insert(FilePath::fromString(include)); Document::Include inc(include, include, 0, IncludeLocal); document->addIncludeFile(inc); } diff --git a/src/plugins/cppeditor/cppsourceprocessor.h b/src/plugins/cppeditor/cppsourceprocessor.h index 0270a87abb0..a3afeaac0a6 100644 --- a/src/plugins/cppeditor/cppsourceprocessor.h +++ b/src/plugins/cppeditor/cppsourceprocessor.h @@ -46,7 +46,7 @@ public: void setTodo(const QSet &files); void run(const QString &fileName, const QStringList &initialIncludes = QStringList()); - void removeFromCache(const QString &fileName); + void removeFromCache(const Utils::FilePath &filePath); void resetEnvironment(); CPlusPlus::Snapshot snapshot() const { return m_snapshot; } @@ -61,7 +61,7 @@ private: bool getFileContents(const Utils::FilePath &absoluteFilePath, QByteArray *contents, unsigned *revision) const; - bool checkFile(const QString &absoluteFilePath) const; + bool checkFile(const Utils::FilePath &absoluteFilePath) const; QString resolveFile(const QString &fileName, IncludeType type); QString resolveFile_helper(const QString &fileName, ProjectExplorer::HeaderPaths::Iterator headerPathsIt); @@ -95,7 +95,7 @@ private: ProjectExplorer::HeaderPaths m_headerPaths; CPlusPlus::LanguageFeatures m_languageFeatures; WorkingCopy m_workingCopy; - QSet m_included; + QSet m_included; CPlusPlus::Document::Ptr m_currentDoc; QSet m_todo; QSet m_processed; @@ -104,4 +104,4 @@ private: QTextCodec *m_defaultCodec; }; -} // namespace CppEditor::Internal +} // CppEditor::Internal diff --git a/src/plugins/cppeditor/cppworkingcopy.h b/src/plugins/cppeditor/cppworkingcopy.h index 074930ed6d9..86b999c5c80 100644 --- a/src/plugins/cppeditor/cppworkingcopy.h +++ b/src/plugins/cppeditor/cppworkingcopy.h @@ -18,15 +18,9 @@ class CPPEDITOR_EXPORT WorkingCopy public: WorkingCopy(); - void insert(const QString &fileName, const QByteArray &source, unsigned revision = 0) - { insert(Utils::FilePath::fromString(fileName), source, revision); } - void insert(const Utils::FilePath &fileName, const QByteArray &source, unsigned revision = 0) { _elements.insert(fileName, {source, revision}); } - bool contains(const QString &fileName) const - { return contains(Utils::FilePath::fromString(fileName)); } - bool contains(const Utils::FilePath &fileName) const { return _elements.contains(fileName); } diff --git a/src/plugins/cppeditor/fileandtokenactions_test.cpp b/src/plugins/cppeditor/fileandtokenactions_test.cpp index c5602c5f678..022baf10e2a 100644 --- a/src/plugins/cppeditor/fileandtokenactions_test.cpp +++ b/src/plugins/cppeditor/fileandtokenactions_test.cpp @@ -130,7 +130,7 @@ TestActionsTestCase::TestActionsTestCase(const Actions &tokenActions, const Acti QVERIFY(waitUntilAProjectIsLoaded()); // Collect files to process - QStringList filesToOpen; + FilePaths filesToOpen; QList > projects; const QList projectInfos = m_modelManager->projectInfos(); @@ -139,15 +139,15 @@ TestActionsTestCase::TestActionsTestCase(const Actions &tokenActions, const Acti << info->sourceFiles().size(); const QSet sourceFiles = info->sourceFiles(); for (const QString &sourceFile : sourceFiles) - filesToOpen << sourceFile; + filesToOpen << FilePath::fromString(sourceFile); } Utils::sort(filesToOpen); // Process all files from the projects - for (const QString &filePath : std::as_const(filesToOpen)) { + for (const FilePath &filePath : std::as_const(filesToOpen)) { // Skip e.g. "" - if (!QFileInfo::exists(filePath)) + if (!filePath.exists()) continue; qDebug() << " --" << filePath; @@ -159,7 +159,7 @@ TestActionsTestCase::TestActionsTestCase(const Actions &tokenActions, const Acti QCOMPARE(DocumentModel::openedDocuments().size(), 0); BaseTextEditor *editor; CppEditorWidget *editorWidget; - QVERIFY(openCppEditor(FilePath::fromString(filePath), &editor, &editorWidget)); + QVERIFY(openCppEditor(filePath, &editor, &editorWidget)); QCOMPARE(DocumentModel::openedDocuments().size(), 1); QVERIFY(m_modelManager->isCppEditor(editor)); @@ -176,7 +176,7 @@ TestActionsTestCase::TestActionsTestCase(const Actions &tokenActions, const Acti const Snapshot snapshot = globalSnapshot(); Document::Ptr document = snapshot.preprocessedDocument( - editorWidget->document()->toPlainText().toUtf8(), Utils::FilePath::fromString(filePath)); + editorWidget->document()->toPlainText().toUtf8(), filePath); QVERIFY(document); document->parse(); TranslationUnit *translationUnit = document->translationUnit();