forked from qt-creator/qt-creator
AutoTest: Free TestTreeItem from CppTools dependency
Makes TestTreeItem programming language agnostic. By moving the "query" methods to CppTools, the cohesion within these methods is improved, i.e. information crosses the AutoTest <-> CppTools border fewer times. Furthermore, it allows the CppTools plugin to see how its data is being used, allowing it to optimize its queries behind the scenes. Change-Id: I0a60140abaca1193d500605dfa2812b4d937d94c Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -1389,6 +1389,38 @@ void CppModelManager::onAboutToLoadSession()
|
||||
GC();
|
||||
}
|
||||
|
||||
QSet<QString> CppModelManager::dependingInternalTargets(const QString &file) const
|
||||
{
|
||||
QSet<QString> result;
|
||||
const Snapshot snapshot = this->snapshot();
|
||||
QTC_ASSERT(snapshot.contains(file), return result);
|
||||
bool wasHeader;
|
||||
const QString correspondingFile
|
||||
= correspondingHeaderOrSource(file, &wasHeader, CacheUsage::ReadOnly);
|
||||
const Utils::FilePaths dependingFiles = snapshot.filesDependingOn(
|
||||
wasHeader ? file : correspondingFile);
|
||||
for (const Utils::FilePath &fn : qAsConst(dependingFiles)) {
|
||||
for (const ProjectPart::Ptr &part : projectPart(fn))
|
||||
result.insert(part->buildSystemTarget);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
QSet<QString> CppModelManager::internalTargets(const QString &filePath) const
|
||||
{
|
||||
const QList<ProjectPart::Ptr> projectParts = projectPart(filePath);
|
||||
// if we have no project parts it's most likely a header with declarations only and CMake based
|
||||
if (projectParts.isEmpty())
|
||||
return dependingInternalTargets(filePath);
|
||||
QSet<QString> targets;
|
||||
for (const ProjectPart::Ptr &part : projectParts) {
|
||||
targets.insert(part->buildSystemTarget);
|
||||
if (part->buildTargetType != ProjectExplorer::BuildTargetType::Executable)
|
||||
targets.unite(dependingInternalTargets(filePath));
|
||||
}
|
||||
return targets;
|
||||
}
|
||||
|
||||
void CppModelManager::renameIncludes(const QString &oldFileName, const QString &newFileName)
|
||||
{
|
||||
if (oldFileName.isEmpty() || newFileName.isEmpty())
|
||||
|
Reference in New Issue
Block a user