summaryrefslogtreecommitdiff
path: root/src/libs/cplusplus/FastPreprocessor.cpp
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2022-11-24 13:05:41 +0100
committerhjk <hjk@qt.io>2022-11-30 17:27:56 +0000
commit39ffdb416ff3381515b7b4bf579acb23941cd6fc (patch)
tree544fd0f432246e397c3b851ed35d2b6d297dc661 /src/libs/cplusplus/FastPreprocessor.cpp
parentdc3a4f0002b2c8e4c437b2d6b3bf9e2e4be91a19 (diff)
downloadqt-creator-39ffdb416ff3381515b7b4bf579acb23941cd6fc.tar.gz
CPlusPlus: Use FilePath for resolved include paths
... and fix fallout. Change-Id: I66886e91ff476eff15db51cc024a8021e952d44d Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'src/libs/cplusplus/FastPreprocessor.cpp')
-rw-r--r--src/libs/cplusplus/FastPreprocessor.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/libs/cplusplus/FastPreprocessor.cpp b/src/libs/cplusplus/FastPreprocessor.cpp
index c948776c4b..8cc01e6250 100644
--- a/src/libs/cplusplus/FastPreprocessor.cpp
+++ b/src/libs/cplusplus/FastPreprocessor.cpp
@@ -29,11 +29,11 @@ QByteArray FastPreprocessor::run(Document::Ptr newDoc,
_preproc.setKeepComments(true);
if (Document::Ptr doc = _snapshot.document(filePath)) {
- _merged.insert(filePath.toString());
+ _merged.insert(filePath);
for (Snapshot::const_iterator i = _snapshot.begin(), ei = _snapshot.end(); i != ei; ++i) {
if (isInjectedFile(i.key().toString()))
- mergeEnvironment(i.key().toString());
+ mergeEnvironment(i.key());
}
const QList<Document::Include> includes = doc->resolvedIncludes();
@@ -55,20 +55,21 @@ void FastPreprocessor::sourceNeeded(int line, const QString &fileName, IncludeTy
{
Q_UNUSED(initialIncludes)
Q_ASSERT(_currentDoc);
+ FilePath filePath = FilePath::fromString(fileName);
if (_addIncludesToCurrentDoc) {
- // CHECKME: Is that cleanName needed?
- const QString cleanName = QDir::cleanPath(fileName);
- _currentDoc->addIncludeFile(Document::Include(fileName, cleanName, line, mode));
+ // CHECKME: Is that cleanPath needed?
+ const FilePath cleanPath = filePath.cleanPath();
+ _currentDoc->addIncludeFile(Document::Include(fileName, cleanPath, line, mode));
}
- mergeEnvironment(fileName);
+ mergeEnvironment(filePath);
}
-void FastPreprocessor::mergeEnvironment(const QString &fileName)
+void FastPreprocessor::mergeEnvironment(const FilePath &filePath)
{
- if (! _merged.contains(fileName)) {
- _merged.insert(fileName);
+ if (! _merged.contains(filePath)) {
+ _merged.insert(filePath);
- if (Document::Ptr doc = _snapshot.document(fileName)) {
+ if (Document::Ptr doc = _snapshot.document(filePath)) {
const QList<Document::Include> includes = doc->resolvedIncludes();
for (const Document::Include &i : includes)
mergeEnvironment(i.resolvedFileName());