diff options
author | hjk <hjk@qt.io> | 2022-11-21 16:48:50 +0100 |
---|---|---|
committer | hjk <hjk@qt.io> | 2022-11-22 15:30:00 +0000 |
commit | fa1adf4d4001207902a5572b39da4f1cbc8752f1 (patch) | |
tree | ff9cbc1c951ab862f03902d38fc4495c3e1a3ae9 /src/plugins/autotest/quick/quicktestparser.cpp | |
parent | 822e2a224a283581b38948d4626f873c6b38c044 (diff) | |
download | qt-creator-fa1adf4d4001207902a5572b39da4f1cbc8752f1.tar.gz |
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>
Diffstat (limited to 'src/plugins/autotest/quick/quicktestparser.cpp')
-rw-r--r-- | src/plugins/autotest/quick/quicktestparser.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/plugins/autotest/quick/quicktestparser.cpp b/src/plugins/autotest/quick/quicktestparser.cpp index b133938abc..594b2364a0 100644 --- a/src/plugins/autotest/quick/quicktestparser.cpp +++ b/src/plugins/autotest/quick/quicktestparser.cpp @@ -20,6 +20,7 @@ #include <utils/qtcassert.h> using namespace QmlJS; +using namespace Utils; namespace Autotest { namespace Internal { @@ -59,7 +60,7 @@ static bool includesQtQuickTest(const CPlusPlus::Document::Ptr &doc, } } - for (const QString &include : snapshot.allIncludesForDocument(doc->fileName())) { + for (const QString &include : snapshot.allIncludesForDocument(doc->filePath().toString())) { for (const QString &prefix : expectedHeaderPrefixes) { if (include.endsWith(QString("%1/quicktest.h").arg(prefix))) return true; @@ -68,7 +69,7 @@ static bool includesQtQuickTest(const CPlusPlus::Document::Ptr &doc, for (const QString &prefix : expectedHeaderPrefixes) { if (CppParser::precompiledHeaderContains(snapshot, - Utils::FilePath::fromString(doc->fileName()), + doc->filePath(), QString("%1/quicktest.h").arg(prefix))) { return true; } @@ -101,7 +102,7 @@ static QString quickTestSrcDir(const CppEditor::CppModelManager *cppMM, QString QuickTestParser::quickTestName(const CPlusPlus::Document::Ptr &doc) const { const QList<CPlusPlus::Document::MacroUse> macros = doc->macroUses(); - const Utils::FilePath filePath = Utils::FilePath::fromString(doc->fileName()); + const Utils::FilePath filePath = doc->filePath(); for (const CPlusPlus::Document::MacroUse ¯o : macros) { if (!macro.isFunctionLike() || macro.arguments().isEmpty()) @@ -253,11 +254,11 @@ bool QuickTestParser::handleQtQuickTest(QFutureInterface<TestParseResultPtr> &fu if (quickTestName(document).isEmpty()) return false; - QList<CppEditor::ProjectPart::ConstPtr> ppList = modelManager->projectPart(document->fileName()); + QList<CppEditor::ProjectPart::ConstPtr> ppList = modelManager->projectPart(document->filePath()); if (ppList.isEmpty()) // happens if shutting down while parsing return false; - const Utils::FilePath cppFileName = Utils::FilePath::fromString(document->fileName()); - const Utils::FilePath proFile = Utils::FilePath::fromString(ppList.at(0)->projectFile); + const FilePath cppFileName = document->filePath(); + const FilePath proFile = Utils::FilePath::fromString(ppList.at(0)->projectFile); m_mainCppFiles.insert(cppFileName, proFile); const Utils::FilePath srcDir = Utils::FilePath::fromString( quickTestSrcDir(modelManager, cppFileName)); |