aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2020-10-13 16:41:25 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2020-10-14 08:55:56 +0000
commit76febea8ee25f2abae112be1534912f5368d3bda (patch)
treea923a877f656c9d36a360a93367623be1f803983
parent6fe4f028a44e3ac06a9fe67ff0196419b0ebc0cb (diff)
QmakeProjectManager: Ensure consistent include path lists
... before and after a build. The previous algorithm did not guarantee the same order, leading to failure when analyzing an unbuilt project with clang-tidy/clazy. Change-Id: I8a700408ca0c23b1b14b47ebfe334a41c52afa5b Reviewed-by: Christian Stenger <christian.stenger@qt.io>
-rw-r--r--src/plugins/qmakeprojectmanager/qmakeparsernodes.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/plugins/qmakeprojectmanager/qmakeparsernodes.cpp b/src/plugins/qmakeprojectmanager/qmakeparsernodes.cpp
index 3a564fd20b..0babec02e8 100644
--- a/src/plugins/qmakeprojectmanager/qmakeparsernodes.cpp
+++ b/src/plugins/qmakeprojectmanager/qmakeparsernodes.cpp
@@ -1839,15 +1839,24 @@ QStringList QmakeProFile::includePaths(QtSupport::ProFileReader *reader, const F
}
bool tryUnfixified = false;
+
+ // These paths should not be checked for existence, to ensure consistent include path lists
+ // before and after building.
+ const QString mocDir = mocDirPath(reader, buildDir);
+ const QString uiDir = uiDirPath(reader, buildDir);
+
foreach (const ProFileEvaluator::SourceFile &el,
reader->fixifiedValues(QLatin1String("INCLUDEPATH"), projectDir, buildDir.toString(),
false)) {
const QString sysrootifiedPath = sysrootify(el.fileName, sysroot.toString(), projectDir,
buildDir.toString());
- if (IoUtils::isAbsolutePath(sysrootifiedPath) && IoUtils::exists(sysrootifiedPath))
+ if (IoUtils::isAbsolutePath(sysrootifiedPath)
+ && (IoUtils::exists(sysrootifiedPath) || sysrootifiedPath == mocDir
+ || sysrootifiedPath == uiDir)) {
paths << sysrootifiedPath;
- else
+ } else {
tryUnfixified = true;
+ }
}
// If sysrootifying a fixified path does not yield a valid path, try again with the
@@ -1862,10 +1871,6 @@ QStringList QmakeProFile::includePaths(QtSupport::ProFileReader *reader, const F
}
}
- // paths already contains moc dir and ui dir, due to corrrectly parsing uic.prf and moc.prf
- // except if those directories don't exist at the time of parsing
- // thus we add those directories manually (without checking for existence)
- paths << mocDirPath(reader, buildDir) << uiDirPath(reader, buildDir);
paths.removeDuplicates();
return paths;
}