Commit 1fcba8df authored by Nikolai Kosjar's avatar Nikolai Kosjar Committed by Fawzi Mohamed

QbsProject: Provide compiler call data

...so that analyzers can make use of it.

Change-Id: I9694535f02f631cac266c26b4f4c973a06c6c899
Reviewed-by: default avatarChristian Kandeler <christian.kandeler@digia.com>
Reviewed-by: default avatarFawzi Mohamed <fawzi.mohamed@theqtcompany.com>
parent 33359a79
......@@ -559,6 +559,7 @@ void QbsProject::updateAfterBuild()
QTC_ASSERT(m_qbsProject.isValid(), return);
m_projectData = m_qbsProject.projectData();
updateBuildTargetData();
updateCppCompilerCallData();
}
void QbsProject::registerQbsProjectParser(QbsProjectParser *p)
......@@ -682,9 +683,7 @@ void QbsProject::updateCppCodeModel()
QtSupport::BaseQtVersion *qtVersion =
QtSupport::QtKitInformation::qtVersion(activeTarget()->kit());
CppTools::CppModelManager *modelmanager =
CppTools::CppModelManager::instance();
CppTools::CppModelManager *modelmanager = CppTools::CppModelManager::instance();
if (!modelmanager)
return;
......@@ -780,8 +779,50 @@ void QbsProject::updateCppCodeModel()
QtSupport::UiCodeModelManager::update(this, uiFiles);
// Register update the code model:
// Update the code model
m_codeModelFuture = modelmanager->updateProjectInfo(pinfo);
m_codeModelProjectInfo = modelmanager->projectInfo(this);
}
void QbsProject::updateCppCompilerCallData()
{
CppTools::CppModelManager *modelManager = CppTools::CppModelManager::instance();
QTC_ASSERT(m_codeModelProjectInfo == modelManager->projectInfo(this), return);
CppTools::ProjectInfo::CompilerCallData data;
foreach (const qbs::ProductData &product, m_projectData.allProducts()) {
if (!product.isEnabled())
continue;
foreach (const qbs::GroupData &group, product.groups()) {
if (!group.isEnabled())
continue;
foreach (const QString &file, group.allFilePaths()) {
if (!CppTools::ProjectFile::isSource(CppTools::ProjectFile::classify(file)))
continue;
qbs::ErrorInfo errorInfo;
const qbs::RuleCommandList ruleCommands
= m_qbsProject.ruleCommands(product, file, QLatin1String("obj"), &errorInfo);
if (errorInfo.hasError())
continue;
QList<QStringList> calls;
foreach (const qbs::RuleCommand &ruleCommand, ruleCommands) {
if (ruleCommand.type() == qbs::RuleCommand::ProcessCommandType)
calls << ruleCommand.arguments();
}
if (!calls.isEmpty())
data.insert(file, calls);
}
}
}
m_codeModelProjectInfo.setCompilerCallData(data);
const QFuture<void> future = modelManager->updateProjectInfo(m_codeModelProjectInfo);
QTC_CHECK(future.isFinished()); // No reparse of files expected
}
void QbsProject::updateQmlJsCodeModel()
......
......@@ -33,6 +33,8 @@
#include "qbsprojectmanager.h"
#include <cpptools/cppprojects.h>
#include <projectexplorer/project.h>
#include <projectexplorer/projectnodes.h>
#include <projectexplorer/task.h>
......@@ -134,6 +136,7 @@ private:
void prepareForParsing();
void updateDocuments(const QSet<QString> &files);
void updateCppCodeModel();
void updateCppCompilerCallData();
void updateQmlJsCodeModel();
void updateApplicationTargets();
void updateDeploymentInfo();
......@@ -161,6 +164,7 @@ private:
} m_cancelStatus;
QFuture<void> m_codeModelFuture;
CppTools::ProjectInfo m_codeModelProjectInfo;
QbsBuildConfiguration *m_currentBc;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment