aboutsummaryrefslogtreecommitdiffstats
path: root/src/shared
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@qt.io>2016-10-25 20:04:29 +0200
committerOswald Buddenhagen <oswald.buddenhagen@qt.io>2016-11-01 17:36:41 +0000
commite19fa27601e93b19a7f1ac6eed08bb31f7997373 (patch)
treed22cdcd08cfec3d1007d5884694a287072fcadf7 /src/shared
parent0afcbaa9c8840444e2c17e26f7b5b61d877aaff2 (diff)
de-duplicate resolution of exact sources
rather than resolving them once in bulk (for the code model) and once per pri file (for the project view), resolve them only in bulk, but "tag" them. then do a cheap filtering pass for the project view. as a side effect, this fixes the problem that sources that are listed by a file that is not shown in the project tree (as is the case for qrc files synthesized by resources.prf) would not be shown at all. instead, these sources now appear belonging directly to the pro file. Task-number: QTCREATORBUG-3670 Change-Id: I1a1756d95bd90db4da1274eebcc4dad2a854f43d Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/proparser/profileevaluator.cpp16
-rw-r--r--src/shared/proparser/profileevaluator.h12
2 files changed, 17 insertions, 11 deletions
diff --git a/src/shared/proparser/profileevaluator.cpp b/src/shared/proparser/profileevaluator.cpp
index 995658cdd2..2c179a2584 100644
--- a/src/shared/proparser/profileevaluator.cpp
+++ b/src/shared/proparser/profileevaluator.cpp
@@ -119,17 +119,17 @@ QStringList ProFileEvaluator::absolutePathValues(
return result;
}
-QStringList ProFileEvaluator::absoluteFileValues(
- const QString &variable, const QString &baseDirectory, const QStringList &searchDirs,
- const ProFile *pro) const
+QVector<ProFileEvaluator::SourceFile> ProFileEvaluator::absoluteFileValues(
+ const QString &variable, const QString &baseDirectory, const QStringList &searchDirs) const
{
QMakeVfs::VfsFlags flags = (d->m_cumulative ? QMakeVfs::VfsCumulative : QMakeVfs::VfsExact);
- QStringList result;
- foreach (const QString &el, pro ? values(variable, pro) : values(variable)) {
+ QVector<SourceFile> result;
+ foreach (const ProString &str, d->values(ProKey(variable))) {
+ const QString &el = d->m_option->expandEnvVars(str.toQString());
QString absEl;
if (IoUtils::isAbsolutePath(el)) {
if (m_vfs->exists(el, flags)) {
- result << el;
+ result << SourceFile{ el, str.sourceFile() };
goto next;
}
absEl = el;
@@ -137,7 +137,7 @@ QStringList ProFileEvaluator::absoluteFileValues(
foreach (const QString &dir, searchDirs) {
QString fn = QDir::cleanPath(dir + QLatin1Char('/') + el);
if (m_vfs->exists(fn, flags)) {
- result << fn;
+ result << SourceFile{ QDir::cleanPath(fn), str.sourceFile() };
goto next;
}
}
@@ -157,7 +157,7 @@ QStringList ProFileEvaluator::absoluteFileValues(
theDir.setFilter(theDir.filter() & ~QDir::AllDirs);
foreach (const QString &fn, theDir.entryList(QStringList(wildcard)))
if (fn != QLatin1String(".") && fn != QLatin1String(".."))
- result << absDir + QLatin1Char('/') + fn;
+ result << SourceFile{ absDir + QLatin1Char('/') + fn, str.sourceFile() };
} // else if (acceptMissing)
}
}
diff --git a/src/shared/proparser/profileevaluator.h b/src/shared/proparser/profileevaluator.h
index 898198e66b..c6d4a79cfa 100644
--- a/src/shared/proparser/profileevaluator.h
+++ b/src/shared/proparser/profileevaluator.h
@@ -53,6 +53,11 @@ public:
TT_Subdirs
};
+ struct SourceFile {
+ QString fileName;
+ const ProFile *proFile;
+ };
+
// Call this from a concurrency-free context
static void initialize();
@@ -79,9 +84,8 @@ public:
QStringList fixifiedValues(
const QString &variable, const QString &baseDirectory, const QString &buildDirectory) const;
QStringList absolutePathValues(const QString &variable, const QString &baseDirectory) const;
- QStringList absoluteFileValues(
- const QString &variable, const QString &baseDirectory, const QStringList &searchDirs,
- const ProFile *pro) const;
+ QVector<SourceFile> absoluteFileValues(
+ const QString &variable, const QString &baseDirectory, const QStringList &searchDirs) const;
QString propertyValue(const QString &val) const;
private:
@@ -89,4 +93,6 @@ private:
QMakeVfs *m_vfs;
};
+Q_DECLARE_TYPEINFO(ProFileEvaluator::SourceFile, Q_MOVABLE_TYPE);
+
QT_END_NAMESPACE