forked from qt-creator/qt-creator
ProjectPart: Add callGroupId
Do not rely on the projectfile being unique anymore. Change-Id: I52e63b3ac8aeca43ef70af1d59d1d8612bd3540e Reviewed-by: Tim Jenssen <tim.jenssen@qt.io> Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
@@ -340,7 +340,7 @@ static QStringList tweakedArguments(const ProjectPart &projectPart,
|
||||
}
|
||||
|
||||
static AnalyzeUnits unitsToAnalyzeFromCompilerCallData(
|
||||
const QHash<QString, ProjectPart::Ptr> &projectFileToProjectPart,
|
||||
const QHash<QString, ProjectPart::Ptr> &callGroupToProjectPart,
|
||||
const ProjectInfo::CompilerCallData &compilerCallData,
|
||||
const QString &targetTriple)
|
||||
{
|
||||
@@ -350,7 +350,7 @@ static AnalyzeUnits unitsToAnalyzeFromCompilerCallData(
|
||||
|
||||
foreach (const ProjectInfo::CompilerCallGroup &compilerCallGroup, compilerCallData) {
|
||||
const ProjectPart::Ptr projectPart
|
||||
= projectFileToProjectPart.value(compilerCallGroup.groupId);
|
||||
= callGroupToProjectPart.value(compilerCallGroup.groupId);
|
||||
QTC_ASSERT(projectPart, continue);
|
||||
|
||||
QHashIterator<QString, QList<QStringList> > it(compilerCallGroup.callsPerSourceFile);
|
||||
@@ -398,19 +398,14 @@ static AnalyzeUnits unitsToAnalyzeFromProjectParts(const QVector<ProjectPart::Pt
|
||||
return unitsToAnalyze;
|
||||
}
|
||||
|
||||
static QHash<QString, ProjectPart::Ptr> generateProjectFileToProjectPartMapping(
|
||||
static QHash<QString, ProjectPart::Ptr> generateCallGroupToProjectPartMapping(
|
||||
const QVector<ProjectPart::Ptr> &projectParts)
|
||||
{
|
||||
QHash<QString, ProjectPart::Ptr> mapping;
|
||||
|
||||
foreach (const ProjectPart::Ptr &projectPart, projectParts) {
|
||||
QTC_ASSERT(projectPart, continue);
|
||||
QString projectFile = projectPart->projectFile;
|
||||
if (projectPart->projectFileLine >= 0)
|
||||
projectFile += ':' + QString::number(projectPart->projectFileLine);
|
||||
if (projectPart->projectFileColumn >= 0)
|
||||
projectFile += ':' + QString::number(projectPart->projectFileColumn);
|
||||
mapping[projectFile] = projectPart;
|
||||
mapping[projectPart->callGroupId] = projectPart;
|
||||
}
|
||||
|
||||
return mapping;
|
||||
@@ -425,9 +420,9 @@ AnalyzeUnits ClangStaticAnalyzerRunControl::sortedUnitsToAnalyze()
|
||||
if (compilerCallData.isEmpty()) {
|
||||
units = unitsToAnalyzeFromProjectParts(m_projectInfo.projectParts());
|
||||
} else {
|
||||
const QHash<QString, ProjectPart::Ptr> projectFileToProjectPart
|
||||
= generateProjectFileToProjectPartMapping(m_projectInfo.projectParts());
|
||||
units = unitsToAnalyzeFromCompilerCallData(projectFileToProjectPart,
|
||||
const QHash<QString, ProjectPart::Ptr> callGroupToProjectPart
|
||||
= generateCallGroupToProjectPartMapping(m_projectInfo.projectParts());
|
||||
units = unitsToAnalyzeFromCompilerCallData(callGroupToProjectPart,
|
||||
compilerCallData,
|
||||
m_targetTriple);
|
||||
}
|
||||
|
||||
@@ -1782,12 +1782,15 @@ void CppCodeModelInspectorDialog::updateProjectPartData(const ProjectPart::Ptr &
|
||||
projectFileLocation += ":" + QString::number(part->projectFileLine);
|
||||
if (part->projectFileColumn > 0)
|
||||
projectFileLocation += ":" + QString::number(part->projectFileColumn);
|
||||
const QString callGroupId = part->callGroupId.isEmpty() ? QString::fromLatin1("<None>")
|
||||
: part->callGroupId;
|
||||
|
||||
KeyValueModel::Table table = KeyValueModel::Table()
|
||||
<< qMakePair(QString::fromLatin1("Project Part Name"), part->displayName)
|
||||
<< qMakePair(QString::fromLatin1("Project Part File"), projectFileLocation)
|
||||
<< qMakePair(QString::fromLatin1("Project Name"), projectName)
|
||||
<< qMakePair(QString::fromLatin1("Project File"), projectFilePath)
|
||||
<< qMakePair(QString::fromLatin1("Callgroup Id"), callGroupId)
|
||||
<< qMakePair(QString::fromLatin1("Selected For Building"),
|
||||
CMI::Utils::toString(part->selectedForBuilding))
|
||||
<< qMakePair(QString::fromLatin1("Language Version"),
|
||||
|
||||
@@ -184,6 +184,7 @@ static ProjectPart::Ptr projectPartFromRawProjectPart(const RawProjectPart &rawP
|
||||
part->projectConfigFile = rawProjectPart.projectConfigFile;
|
||||
part->projectFileLine = rawProjectPart.projectFileLine;
|
||||
part->projectFileColumn = rawProjectPart.projectFileColumn;
|
||||
part->callGroupId = rawProjectPart.callGroupId;
|
||||
part->qtVersion = rawProjectPart.qtVersion;
|
||||
part->projectDefines = rawProjectPart.projectDefines;
|
||||
part->headerPaths = rawProjectPart.headerPaths;
|
||||
|
||||
@@ -66,6 +66,11 @@ void RawProjectPart::setConfigFileName(const QString &configFileName)
|
||||
this->projectConfigFile = configFileName;
|
||||
}
|
||||
|
||||
void RawProjectPart::setCallGroupId(const QString &id)
|
||||
{
|
||||
callGroupId = id;
|
||||
}
|
||||
|
||||
void RawProjectPart::setQtVersion(ProjectPart::QtVersion qtVersion)
|
||||
{
|
||||
this->qtVersion = qtVersion;
|
||||
|
||||
@@ -62,6 +62,7 @@ public:
|
||||
|
||||
void setProjectFile(const QString &projectFile, int line = -1, int column = -1);
|
||||
void setConfigFileName(const QString &configFileName);
|
||||
void setCallGroupId(const QString &id);
|
||||
|
||||
void setQtVersion(ProjectPart::QtVersion qtVersion);
|
||||
|
||||
@@ -82,6 +83,7 @@ public:
|
||||
int projectFileLine = -1;
|
||||
int projectFileColumn = -1;
|
||||
QString projectConfigFile; // currently only used by the Generic Project Manager
|
||||
QString callGroupId;
|
||||
QStringList precompiledHeaders;
|
||||
ProjectPartHeaderPaths headerPaths;
|
||||
QByteArray projectDefines;
|
||||
|
||||
@@ -108,6 +108,7 @@ public:
|
||||
int projectFileLine = -1;
|
||||
int projectFileColumn = -1;
|
||||
QString projectConfigFile; // currently only used by the Generic Project Manager
|
||||
QString callGroupId;
|
||||
|
||||
ProjectFiles files;
|
||||
|
||||
|
||||
@@ -790,7 +790,7 @@ static CppTools::ProjectFile::Kind cppFileType(const qbs::ArtifactData &sourceFi
|
||||
return CppTools::ProjectFile::Unsupported;
|
||||
}
|
||||
|
||||
static QString groupLocationToProjectFile(const qbs::CodeLocation &location)
|
||||
static QString groupLocationToCallGroupId(const qbs::CodeLocation &location)
|
||||
{
|
||||
return QString::fromLatin1("%1:%2:%3")
|
||||
.arg(location.filePath())
|
||||
@@ -950,6 +950,7 @@ void QbsProject::updateCppCodeModel()
|
||||
CppTools::RawProjectPart rpp;
|
||||
rpp.setQtVersion(qtVersionForPart);
|
||||
const qbs::PropertyMap &props = grp.properties();
|
||||
rpp.setCallGroupId(groupLocationToCallGroupId(grp.location()));
|
||||
|
||||
QStringList cFlags;
|
||||
QStringList cxxFlags;
|
||||
@@ -1091,7 +1092,7 @@ void QbsProject::updateCppCompilerCallData()
|
||||
continue;
|
||||
|
||||
CppTools::ProjectInfo::CompilerCallGroup compilerCallGroup;
|
||||
compilerCallGroup.groupId = groupLocationToProjectFile(group.location());
|
||||
compilerCallGroup.groupId = groupLocationToCallGroupId(group.location());
|
||||
|
||||
foreach (const qbs::ArtifactData &file, group.allSourceArtifacts()) {
|
||||
const QString &filePath = file.filePath();
|
||||
|
||||
Reference in New Issue
Block a user