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/cpppointerdeclarationformatter_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/cpppointerdeclarationformatter_test.cpp')
| -rw-r--r-- | src/plugins/cppeditor/cpppointerdeclarationformatter_test.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/plugins/cppeditor/cpppointerdeclarationformatter_test.cpp b/src/plugins/cppeditor/cpppointerdeclarationformatter_test.cpp index 06134ee3fc..0a5f88ab9a 100644 --- a/src/plugins/cppeditor/cpppointerdeclarationformatter_test.cpp +++ b/src/plugins/cppeditor/cpppointerdeclarationformatter_test.cpp @@ -24,6 +24,7 @@ #include <QtTest> using namespace CPlusPlus; +using namespace Utils; Q_DECLARE_METATYPE(CppEditor::Internal::Overview) @@ -63,15 +64,15 @@ public: // Write source to temprorary file CppEditor::Tests::TemporaryDir temporaryDir; QVERIFY(temporaryDir.isValid()); - const QString filePath = temporaryDir.createFile("file.h", sourceWithoutCursorMarker); + const FilePath filePath = temporaryDir.createFile("file.h", sourceWithoutCursorMarker); QVERIFY(!filePath.isEmpty()); // Preprocess source - Environment env; + CPlusPlus::Environment env; Preprocessor preprocess(nullptr, &env); const QByteArray preprocessedSource = preprocess.run(filePath, sourceWithoutCursorMarker); - Document::Ptr document = Document::create(filePath); + Document::Ptr document = Document::create(filePath.toString()); document->setUtf8Source(preprocessedSource); document->parse(parseMode); document->check(); @@ -83,9 +84,7 @@ public: QScopedPointer<TextEditor::BaseTextEditor> editor( TextEditor::PlainTextEditorFactory::createPlainTextEditor()); QString error; - editor->document()->open(&error, - Utils::FilePath::fromString(document->fileName()), - Utils::FilePath::fromString(document->fileName())); + editor->document()->open(&error, document->filePath(), document->filePath()); QVERIFY(error.isEmpty()); // Set cursor position |
