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 <christian.kandeler@qt.io>
This commit is contained in:
hjk
2022-11-21 16:48:50 +01:00
parent 822e2a224a
commit fa1adf4d40
69 changed files with 351 additions and 313 deletions

View File

@@ -275,7 +275,7 @@ void Manager::initialize()
if (doc.data() == nullptr)
return;
d->m_awaitingDocuments.insert(FilePath::fromString(doc->fileName()));
d->m_awaitingDocuments.insert(doc->filePath());
d->m_timer.start(400); // Accumulate multiple requests into one, restarts the timer
});

View File

@@ -215,7 +215,7 @@ ParserTreeItem::ConstPtr Parser::getParseDocumentTree(const CPlusPlus::Document:
if (doc.isNull())
return ParserTreeItem::ConstPtr();
const FilePath fileName = FilePath::fromString(doc->fileName());
const FilePath fileName = doc->filePath();
ParserTreeItem::ConstPtr itemPtr = ParserTreeItem::parseDocument(doc);
@@ -235,8 +235,7 @@ ParserTreeItem::ConstPtr Parser::getCachedOrParseDocumentTree(const CPlusPlus::D
if (doc.isNull())
return ParserTreeItem::ConstPtr();
const QString &fileName = doc->fileName();
const auto it = d->m_documentCache.constFind(FilePath::fromString(fileName));
const auto it = d->m_documentCache.constFind(doc->filePath());
if (it != d->m_documentCache.constEnd() && !it.value().tree.isNull()
&& it.value().treeRevision == doc->revision()) {
return it.value().tree;