forked from qt-creator/qt-creator
CppTools: Include "group id" in CompilerCallData
We will need the id in a follow-up change to match the corresponding project part. Change-Id: Id7686503f96fb238c9fa9857e7fde5cf94b0bcc7 Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
This commit is contained in:
@@ -323,14 +323,16 @@ static AnalyzeUnits unitsToAnalyzeFromCompilerCallData(
|
|||||||
|
|
||||||
AnalyzeUnits unitsToAnalyze;
|
AnalyzeUnits unitsToAnalyze;
|
||||||
|
|
||||||
QHashIterator<QString, QList<QStringList> > it(compilerCallData);
|
foreach (const ProjectInfo::CompilerCallGroup &compilerCallGroup, compilerCallData) {
|
||||||
while (it.hasNext()) {
|
QHashIterator<QString, QList<QStringList> > it(compilerCallGroup.callsPerSourceFile);
|
||||||
it.next();
|
while (it.hasNext()) {
|
||||||
const QString file = it.key();
|
it.next();
|
||||||
const QList<QStringList> compilerCalls = it.value();
|
const QString file = it.key();
|
||||||
foreach (const QStringList &options, compilerCalls) {
|
const QList<QStringList> compilerCalls = it.value();
|
||||||
const QStringList arguments = tweakedArguments(file, options, extraParams);
|
foreach (const QStringList &options, compilerCalls) {
|
||||||
unitsToAnalyze << AnalyzeUnit(file, arguments);
|
const QStringList arguments = tweakedArguments(file, options, extraParams);
|
||||||
|
unitsToAnalyze << AnalyzeUnit(file, arguments);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -36,6 +36,13 @@ ProjectInfo::ProjectInfo(QPointer<ProjectExplorer::Project> project)
|
|||||||
: m_project(project)
|
: m_project(project)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
static bool operator==(const ProjectInfo::CompilerCallGroup &first,
|
||||||
|
const ProjectInfo::CompilerCallGroup &second)
|
||||||
|
{
|
||||||
|
return first.groupId == second.groupId
|
||||||
|
&& first.callsPerSourceFile == second.callsPerSourceFile;
|
||||||
|
}
|
||||||
|
|
||||||
bool ProjectInfo::operator ==(const ProjectInfo &other) const
|
bool ProjectInfo::operator ==(const ProjectInfo &other) const
|
||||||
{
|
{
|
||||||
return m_project == other.m_project
|
return m_project == other.m_project
|
||||||
|
@@ -60,8 +60,13 @@ public:
|
|||||||
const QSet<QString> sourceFiles() const;
|
const QSet<QString> sourceFiles() const;
|
||||||
const QByteArray defines() const;
|
const QByteArray defines() const;
|
||||||
|
|
||||||
// Source file --> List of compiler calls
|
struct CompilerCallGroup {
|
||||||
typedef QHash<QString, QList<QStringList>> CompilerCallData;
|
using CallsPerSourceFile = QHash<QString, QList<QStringList>>;
|
||||||
|
|
||||||
|
QString groupId;
|
||||||
|
CallsPerSourceFile callsPerSourceFile;
|
||||||
|
};
|
||||||
|
using CompilerCallData = QVector<CompilerCallGroup>;
|
||||||
void setCompilerCallData(const CompilerCallData &data);
|
void setCompilerCallData(const CompilerCallData &data);
|
||||||
CompilerCallData compilerCallData() const;
|
CompilerCallData compilerCallData() const;
|
||||||
|
|
||||||
|
@@ -754,6 +754,14 @@ static CppTools::ProjectFile::Kind cppFileType(const qbs::SourceArtifact &source
|
|||||||
return CppTools::ProjectFile::Unclassified;
|
return CppTools::ProjectFile::Unclassified;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static QString groupLocationToProjectFile(const qbs::CodeLocation &location)
|
||||||
|
{
|
||||||
|
return QString::fromLatin1("%1:%2:%3")
|
||||||
|
.arg(location.filePath())
|
||||||
|
.arg(location.line())
|
||||||
|
.arg(location.column());
|
||||||
|
}
|
||||||
|
|
||||||
void QbsProject::updateCppCodeModel()
|
void QbsProject::updateCppCodeModel()
|
||||||
{
|
{
|
||||||
if (!m_projectData.isValid())
|
if (!m_projectData.isValid())
|
||||||
@@ -834,11 +842,7 @@ void QbsProject::updateCppCodeModel()
|
|||||||
ppBuilder.setPreCompiledHeaders(QStringList() << pch);
|
ppBuilder.setPreCompiledHeaders(QStringList() << pch);
|
||||||
|
|
||||||
ppBuilder.setDisplayName(grp.name());
|
ppBuilder.setDisplayName(grp.name());
|
||||||
ppBuilder.setProjectFile(QString::fromLatin1("%1:%2:%3")
|
ppBuilder.setProjectFile(groupLocationToProjectFile(grp.location()));
|
||||||
.arg(grp.location().filePath())
|
|
||||||
.arg(grp.location().line())
|
|
||||||
.arg(grp.location().column()));
|
|
||||||
|
|
||||||
|
|
||||||
QHash<QString, qbs::SourceArtifact> filePathToSourceArtifact;
|
QHash<QString, qbs::SourceArtifact> filePathToSourceArtifact;
|
||||||
foreach (const qbs::SourceArtifact &source, grp.allSourceArtifacts()) {
|
foreach (const qbs::SourceArtifact &source, grp.allSourceArtifacts()) {
|
||||||
@@ -902,6 +906,9 @@ void QbsProject::updateCppCompilerCallData()
|
|||||||
if (!group.isEnabled())
|
if (!group.isEnabled())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
CppTools::ProjectInfo::CompilerCallGroup compilerCallGroup;
|
||||||
|
compilerCallGroup.groupId = groupLocationToProjectFile(group.location());
|
||||||
|
|
||||||
foreach (const qbs::SourceArtifact &file, group.allSourceArtifacts()) {
|
foreach (const qbs::SourceArtifact &file, group.allSourceArtifacts()) {
|
||||||
const QString &filePath = file.filePath();
|
const QString &filePath = file.filePath();
|
||||||
if (!CppTools::ProjectFile::isSource(cppFileType(file)))
|
if (!CppTools::ProjectFile::isSource(cppFileType(file)))
|
||||||
@@ -920,8 +927,11 @@ void QbsProject::updateCppCompilerCallData()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!calls.isEmpty())
|
if (!calls.isEmpty())
|
||||||
data.insert(filePath, calls);
|
compilerCallGroup.callsPerSourceFile.insert(filePath, calls);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!compilerCallGroup.callsPerSourceFile.isEmpty())
|
||||||
|
data.append(compilerCallGroup);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user