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/libs/cplusplus/FastPreprocessor.cpp | |
| parent | 822e2a224a283581b38948d4626f873c6b38c044 (diff) | |
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/libs/cplusplus/FastPreprocessor.cpp')
| -rw-r--r-- | src/libs/cplusplus/FastPreprocessor.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/libs/cplusplus/FastPreprocessor.cpp b/src/libs/cplusplus/FastPreprocessor.cpp index fb89ed26bf3..607dd55364b 100644 --- a/src/libs/cplusplus/FastPreprocessor.cpp +++ b/src/libs/cplusplus/FastPreprocessor.cpp @@ -8,6 +8,7 @@ #include <QDir> +using namespace Utils; using namespace CPlusPlus; FastPreprocessor::FastPreprocessor(const Snapshot &snapshot) @@ -23,12 +24,12 @@ QByteArray FastPreprocessor::run(Document::Ptr newDoc, std::swap(newDoc, _currentDoc); _addIncludesToCurrentDoc = _currentDoc->resolvedIncludes().isEmpty() && _currentDoc->unresolvedIncludes().isEmpty(); - const QString fileName = _currentDoc->fileName(); + const FilePath filePath = _currentDoc->filePath(); _preproc.setExpandFunctionlikeMacros(false); _preproc.setKeepComments(true); - if (Document::Ptr doc = _snapshot.document(fileName)) { - _merged.insert(fileName); + if (Document::Ptr doc = _snapshot.document(filePath)) { + _merged.insert(filePath.toString()); for (Snapshot::const_iterator i = _snapshot.begin(), ei = _snapshot.end(); i != ei; ++i) { if (isInjectedFile(i.key().toString())) @@ -43,7 +44,7 @@ QByteArray FastPreprocessor::run(Document::Ptr newDoc, _env.addMacros(_currentDoc->definedMacros()); } - const QByteArray preprocessed = _preproc.run(fileName, source); + const QByteArray preprocessed = _preproc.run(filePath, source); // qDebug("FastPreprocessor::run for %s produced [[%s]]", fileName.toUtf8().constData(), preprocessed.constData()); std::swap(newDoc, _currentDoc); return preprocessed; |
