Commit 41eff78e authored by Erik Verbruggen's avatar Erik Verbruggen Committed by Friedemann Kleint

C++: add method to dump the model manager configuration.

This method is called when the QTCREATOR_DUMP_PROJECT_INFO environment
variable is defined.

Change-Id: Id314994a2eed79cf688f5ef82f597524dba7a5cd
Reviewed-by: default avatarFriedemann Kleint <Friedemann.Kleint@digia.com>
parent 0b121abb
......@@ -966,6 +966,39 @@ QByteArray CppModelManager::internalDefinedMacros() const
return macros;
}
/// This method will aquire the mutex!
void CppModelManager::dumpModelManagerConfiguration()
{
// Tons of debug output...
qDebug()<<"========= CppModelManager::dumpModelManagerConfiguration ======";
foreach (const ProjectInfo &pinfo, m_projects.values()) {
qDebug()<<" for project:"<< pinfo.project().data()->document()->fileName();
foreach (const ProjectPart::Ptr &part, pinfo.projectParts()) {
qDebug() << "=== part ===";
qDebug() << "language:" << (part->language == CXX ? "C++" : "ObjC++");
qDebug() << "C++11:" << part->cxx11Enabled;
qDebug() << "Qt version:" << part->qtVersion;
qDebug() << "precompiled header:" << part->precompiledHeaders;
qDebug() << "defines:" << part->defines;
qDebug() << "includes:" << part->includePaths;
qDebug() << "frameworkPaths:" << part->frameworkPaths;
qDebug() << "sources:" << part->sourceFiles;
qDebug() << "";
}
}
ensureUpdated();
qDebug() << "=== Merged include paths ===";
foreach (const QString &inc, m_includePaths)
qDebug() << inc;
qDebug() << "=== Merged framework paths ===";
foreach (const QString &inc, m_frameworkPaths)
qDebug() << inc;
qDebug() << "=== Merged defined macros ===";
qDebug() << m_definedMacros;
qDebug()<<"========= End of dump ======";
}
void CppModelManager::addEditorSupport(AbstractEditorSupport *editorSupport)
{
m_addtionalEditorSupport.insert(editorSupport);
......@@ -1062,40 +1095,26 @@ CppModelManager::ProjectInfo CppModelManager::projectInfo(ProjectExplorer::Proje
void CppModelManager::updateProjectInfo(const ProjectInfo &pinfo)
{
#if 0
// Tons of debug output...
qDebug()<<"========= CppModelManager::updateProjectInfo ======";
qDebug()<<" for project:"<< pinfo.project().data()->document()->fileName();
foreach (const ProjectPart::Ptr &part, pinfo.projectParts()) {
qDebug() << "=== part ===";
qDebug() << "language:" << (part->language == CXX ? "C++" : "ObjC++");
qDebug() << "C++11:" << part->cxx11Enabled;
qDebug() << "Qt version:" << part->qtVersion;
qDebug() << "precompiled header:" << part->precompiledHeaders;
qDebug() << "defines:" << part->defines;
qDebug() << "includes:" << part->includePaths;
qDebug() << "frameworkPaths:" << part->frameworkPaths;
qDebug() << "sources:" << part->sourceFiles;
qDebug() << "";
}
{ // only hold the mutex for a limited scope, so the dumping afterwards can aquire it without deadlocking.
QMutexLocker locker(&mutex);
qDebug() << "";
#endif
QMutexLocker locker(&mutex);
if (! pinfo.isValid())
return;
if (! pinfo.isValid())
return;
ProjectExplorer::Project *project = pinfo.project().data();
m_projects.insert(project, pinfo);
m_dirty = true;
ProjectExplorer::Project *project = pinfo.project().data();
m_projects.insert(project, pinfo);
m_dirty = true;
m_srcToProjectPart.clear();
m_srcToProjectPart.clear();
foreach (const ProjectInfo &projectInfo, m_projects.values())
foreach (const ProjectPart::Ptr &projectPart, projectInfo.projectParts())
foreach (const QString &sourceFile, projectPart->sourceFiles)
m_srcToProjectPart[sourceFile].append(projectPart);
}
foreach (const ProjectInfo &projectInfo, m_projects.values())
foreach (const ProjectPart::Ptr &projectPart, projectInfo.projectParts())
foreach (const QString &sourceFile, projectPart->sourceFiles)
m_srcToProjectPart[sourceFile].append(projectPart);
if (!qgetenv("QTCREATOR_DUMP_PROJECT_INFO").isEmpty())
dumpModelManagerConfiguration();
}
QList<CppModelManager::ProjectPart::Ptr> CppModelManager::projectPart(const QString &fileName) const
......
......@@ -188,6 +188,8 @@ private:
QStringList internalFrameworkPaths() const;
QByteArray internalDefinedMacros() const;
void dumpModelManagerConfiguration();
private:
static QMutex m_modelManagerMutex;
static CppModelManager *m_modelManagerInstance;
......
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