From fa1adf4d4001207902a5572b39da4f1cbc8752f1 Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 21 Nov 2022 16:48:50 +0100 Subject: CPlusPlus: Proliferate FilePath use The starts with CppDocument::filePath(), plus a bit of the fallout This is one patch of potentially many. It is hard to draw the line where to stop this kind of chunk, this here converts a few additional functions for which including it in the patch looked like less churn than without. Converting is mostly fromString/toString, with a few exceptions for "already seem" like caches, that use cheaper "path()" to avoid likely performance regressions (on Windows FilePath comparison is currently case-insenstive, and more expensive). There should be no difference for local operation with this patch. Change-Id: I7b35f98a0a6f0bfed4ea0f8f987faf586f7a8f2b Reviewed-by: Christian Kandeler --- src/libs/qmljs/qmljsmodelmanagerinterface.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/libs/qmljs/qmljsmodelmanagerinterface.cpp') diff --git a/src/libs/qmljs/qmljsmodelmanagerinterface.cpp b/src/libs/qmljs/qmljsmodelmanagerinterface.cpp index 70eebf6faf..71bd55119b 100644 --- a/src/libs/qmljs/qmljsmodelmanagerinterface.cpp +++ b/src/libs/qmljs/qmljsmodelmanagerinterface.cpp @@ -1350,10 +1350,10 @@ void ModelManagerInterface::maybeQueueCppQmlTypeUpdate(const CPlusPlus::Document void ModelManagerInterface::queueCppQmlTypeUpdate(const CPlusPlus::Document::Ptr &doc, bool scan) { - QPair prev = m_queuedCppDocuments.value(doc->fileName()); + QPair prev = m_queuedCppDocuments.value(doc->filePath().path()); if (prev.first && prev.second) prev.first->releaseSourceAndAST(); - m_queuedCppDocuments.insert(doc->fileName(), {doc, scan}); + m_queuedCppDocuments.insert(doc->filePath().path(), {doc, scan}); m_updateCppQmlTypesTimer->start(); } @@ -1439,13 +1439,13 @@ void ModelManagerInterface::updateCppQmlTypes( CPlusPlus::Document::Ptr doc = pair.first; const bool scan = pair.second; - const QString fileName = doc->fileName(); + const FilePath filePath = doc->filePath(); if (!scan) { - hasNewInfo = newData.remove(fileName) || hasNewInfo; - const auto savedDocs = newDeclarations.value(fileName); + hasNewInfo = newData.remove(filePath.path()) || hasNewInfo; + const auto savedDocs = newDeclarations.value(filePath.path()); for (const CPlusPlus::Document::Ptr &savedDoc : savedDocs) { finder(savedDoc); - hasNewInfo = rescanExports(savedDoc->fileName(), finder, newData) || hasNewInfo; + hasNewInfo = rescanExports(savedDoc->filePath().path(), finder, newData) || hasNewInfo; } continue; } @@ -1453,7 +1453,7 @@ void ModelManagerInterface::updateCppQmlTypes( for (auto it = newDeclarations.begin(), end = newDeclarations.end(); it != end;) { for (auto docIt = it->begin(), endDocIt = it->end(); docIt != endDocIt;) { const CPlusPlus::Document::Ptr &savedDoc = *docIt; - if (savedDoc->fileName() == fileName) { + if (savedDoc->filePath() == filePath) { savedDoc->releaseSourceAndAST(); it->erase(docIt); break; @@ -1472,7 +1472,7 @@ void ModelManagerInterface::updateCppQmlTypes( doc->keepSourceAndAST(); // keep for later reparsing when dependent doc changes } - hasNewInfo = rescanExports(fileName, finder, newData) || hasNewInfo; + hasNewInfo = rescanExports(filePath.path(), finder, newData) || hasNewInfo; doc->releaseSourceAndAST(); } -- cgit v1.2.1