forked from qt-creator/qt-creator
Supply c++11 flags and per-project info to c++ code model.
A manual squash/merge of the changes below, plus a couple of subsequent
code fixes.
59085aa5fbb99e2d786cd2c1a06c24a111ccb49f:
Modify CppModel::ProjectInfo
Adding per project node information, to pass on the correct
defines/includes for each file, instead of aggregating them incorrectly.
Also split up SOURCES and OBJECTIVE_SOURCES.
Also ask the toolchain to convert the compilerflags to flags the
codemodel understands, for now only gcc and only c++11.
Also make the toolchain aware of the flags used to compile, so that it
can emit the correct defines.
Note: No header files are passed on.
74028802314cd4e75b41b46407433e07090a304d:
GCC: Evaluate cxxflags when checking for predefined macros
ebaaa4957e4c02cc9637a998eddae1d0acd74f83:
MSVC: Take cxxflags into account when checking for predefined macros
9bfce7e889bcf7bcc47bf880e3ea25945ca7d0d7:
Compile fixes
Change-Id: I9de94ad038dfc5dc1987732e84b13fb4419c96f5
Reviewed-by: Erik Verbruggen <erik.verbruggen@nokia.com>
This commit is contained in:
@@ -257,30 +257,33 @@ void GenericProject::refresh(RefreshOptions options)
|
||||
|
||||
if (modelManager) {
|
||||
CPlusPlus::CppModelManagerInterface::ProjectInfo pinfo = modelManager->projectInfo(this);
|
||||
pinfo.clearProjectParts();
|
||||
CPlusPlus::CppModelManagerInterface::ProjectPart::Ptr part(
|
||||
new CPlusPlus::CppModelManagerInterface::ProjectPart);
|
||||
|
||||
if (m_toolChain) {
|
||||
pinfo.defines = m_toolChain->predefinedMacros();
|
||||
pinfo.defines += '\n';
|
||||
part->defines = m_toolChain->predefinedMacros(QStringList());
|
||||
part->defines += '\n';
|
||||
|
||||
foreach (const HeaderPath &headerPath, m_toolChain->systemHeaderPaths()) {
|
||||
if (headerPath.kind() == HeaderPath::FrameworkHeaderPath)
|
||||
pinfo.frameworkPaths.append(headerPath.path());
|
||||
part->frameworkPaths.append(headerPath.path());
|
||||
else
|
||||
pinfo.includePaths.append(headerPath.path());
|
||||
part->includePaths.append(headerPath.path());
|
||||
}
|
||||
}
|
||||
|
||||
pinfo.includePaths += allIncludePaths();
|
||||
pinfo.defines += m_defines;
|
||||
part->includePaths += allIncludePaths();
|
||||
part->defines += m_defines;
|
||||
|
||||
// ### add _defines.
|
||||
pinfo.sourceFiles = files();
|
||||
pinfo.sourceFiles += generated();
|
||||
part->sourceFiles = files();
|
||||
part->sourceFiles += generated();
|
||||
|
||||
QStringList filesToUpdate;
|
||||
|
||||
if (options & Configuration) {
|
||||
filesToUpdate = pinfo.sourceFiles;
|
||||
filesToUpdate = part->sourceFiles;
|
||||
filesToUpdate.append(QLatin1String("<configuration>")); // XXX don't hardcode configuration file name
|
||||
// Full update, if there's a code model update, cancel it
|
||||
m_codeModelFuture.cancel();
|
||||
@@ -291,6 +294,8 @@ void GenericProject::refresh(RefreshOptions options)
|
||||
filesToUpdate.append(newFileList.toList());
|
||||
}
|
||||
|
||||
pinfo.appendProjectPart(part);
|
||||
|
||||
modelManager->updateProjectInfo(pinfo);
|
||||
m_codeModelFuture = modelManager->updateSourceFiles(filesToUpdate);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user