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/cppeditor/cppsourceprocessor_test.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/cppeditor/cppsourceprocessor_test.cpp')
| -rw-r--r-- | src/plugins/cppeditor/cppsourceprocessor_test.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/plugins/cppeditor/cppsourceprocessor_test.cpp b/src/plugins/cppeditor/cppsourceprocessor_test.cpp index e4c30f97c1..58e0fdf630 100644 --- a/src/plugins/cppeditor/cppsourceprocessor_test.cpp +++ b/src/plugins/cppeditor/cppsourceprocessor_test.cpp @@ -21,7 +21,8 @@ #include <QtTest> using namespace CPlusPlus; -using ProjectExplorer::HeaderPathType; +using namespace ProjectExplorer; +using namespace Utils; using Include = Document::Include; using CppEditor::Tests::TestCase; @@ -46,7 +47,7 @@ public: TestIncludePaths::directoryOfTestFile())}); sourceProcessor->run(filePath); - Document::Ptr document = m_cmm->document(filePath); + Document::Ptr document = m_cmm->document(Utils::FilePath::fromString(filePath)); return document; } @@ -96,7 +97,8 @@ void SourceProcessorTest::testIncludesCyclic() { const QString fileName1 = TestIncludePaths::testFilePath(QLatin1String("cyclic1.h")); const QString fileName2 = TestIncludePaths::testFilePath(QLatin1String("cyclic2.h")); - const QSet<QString> sourceFiles = {fileName1, fileName2}; + const QSet<FilePath> sourceFiles = {FilePath::fromString(fileName1), + FilePath::fromString(fileName2)}; // Create global snapshot (needed in BuiltinEditorDocumentParser) TestCase testCase; @@ -104,7 +106,7 @@ void SourceProcessorTest::testIncludesCyclic() // Open editor TextEditor::BaseTextEditor *editor; - QVERIFY(testCase.openCppEditor(fileName1, &editor)); + QVERIFY(testCase.openCppEditor(FilePath::fromString(fileName1), &editor)); testCase.closeEditorAtEndOfTestCase(editor); // Check editor snapshot @@ -165,7 +167,7 @@ void SourceProcessorTest::testMacroUses() static bool isMacroDefinedInDocument(const QByteArray ¯oName, const Document::Ptr &document) { - for (const Macro ¯o : document->definedMacros()) { + for (const CPlusPlus::Macro ¯o : document->definedMacros()) { if (macro.name() == macroName) return true; } |
