Commit 535bdcc9 authored by Sergey Shambir's avatar Sergey Shambir
Browse files

Qt4Project: simplified C++ codemodel interaction.



Now it uses ProjectPart::evaluateToolchain() to read toolchain info with
given compiler flags.

Change-Id: I9afce7090eba6fc0662981dfd065603ac235a83f
Reviewed-by: default avatarDaniel Teske <daniel.teske@digia.com>
parent 2d8a9674
...@@ -515,13 +515,11 @@ void Qt4Project::updateCppCodeModel() ...@@ -515,13 +515,11 @@ void Qt4Project::updateCppCodeModel()
Kit *k = 0; Kit *k = 0;
QtSupport::BaseQtVersion *qtVersion = 0; QtSupport::BaseQtVersion *qtVersion = 0;
ToolChain *tc = 0;
if (ProjectExplorer::Target *target = activeTarget()) if (ProjectExplorer::Target *target = activeTarget())
k = target->kit(); k = target->kit();
else else
k = KitManager::instance()->defaultKit(); k = KitManager::instance()->defaultKit();
qtVersion = QtSupport::QtKitInformation::qtVersion(k); qtVersion = QtSupport::QtKitInformation::qtVersion(k);
tc = ToolChainKitInformation::toolChain(k);
CppTools::CppModelManagerInterface *modelmanager = CppTools::CppModelManagerInterface *modelmanager =
CppTools::CppModelManagerInterface::instance(); CppTools::CppModelManagerInterface::instance();
...@@ -552,46 +550,35 @@ void Qt4Project::updateCppCodeModel() ...@@ -552,46 +550,35 @@ void Qt4Project::updateCppCodeModel()
part->qtVersion = ProjectPart::NoQt; part->qtVersion = ProjectPart::NoQt;
const QStringList cxxflags = pro->variableValue(CppFlagsVar); const QStringList cxxflags = pro->variableValue(CppFlagsVar);
part->evaluateToolchain(ToolChainKitInformation::toolChain(k),
cxxflags,
cxxflags,
SysRootKitInformation::sysRoot(k));
// part->defines // part->defines
if (tc)
part->defines = tc->predefinedMacros(cxxflags);
part->defines += pro->cxxDefines(); part->defines += pro->cxxDefines();
// part->includePaths // part->includePaths, part->frameworkPaths
part->includePaths.append(pro->variableValue(IncludePathVar)); part->includePaths.append(pro->variableValue(IncludePathVar));
QList<HeaderPath> headers; if (qtVersion) {
if (tc) foreach (const HeaderPath &header, qtVersion->systemHeaderPathes(k)) {
headers = tc->systemHeaderPaths(cxxflags, SysRootKitInformation::sysRoot(k)); if (header.kind() == HeaderPath::FrameworkHeaderPath)
if (qtVersion) part->frameworkPaths.append(header.path());
headers.append(qtVersion->systemHeaderPathes(k));
foreach (const HeaderPath &headerPath, headers) {
if (headerPath.kind() == HeaderPath::FrameworkHeaderPath)
part->frameworkPaths.append(headerPath.path());
else else
part->includePaths.append(headerPath.path()); part->includePaths.append(header.path());
} }
if (qtVersion) {
if (!qtVersion->frameworkInstallPath().isEmpty()) if (!qtVersion->frameworkInstallPath().isEmpty())
part->frameworkPaths.append(qtVersion->frameworkInstallPath()); part->frameworkPaths.append(qtVersion->frameworkInstallPath());
} }
if (Qt4ProFileNode *node = rootQt4ProjectNode()) if (Qt4ProFileNode *node = rootQt4ProjectNode())
part->includePaths.append(node->resolvedMkspecPath()); part->includePaths.append(node->resolvedMkspecPath());
// part->precompiledHeaders // part->precompiledHeaders
part->precompiledHeaders.append(pro->variableValue(PrecompiledHeaderVar)); part->precompiledHeaders.append(pro->variableValue(PrecompiledHeaderVar));
// part->language // part->files
if (tc)
part->cxxVersion = (tc->compilerFlags(cxxflags) | ToolChain::StandardCxx11)
? ProjectPart::CXX11 : ProjectPart::CXX98;
else
part->cxxVersion = ProjectPart::CXX11;
foreach (const QString &file, pro->variableValue(CppSourceVar)) { foreach (const QString &file, pro->variableValue(CppSourceVar)) {
allFiles << file; allFiles << file;
part->files << ProjectFile(file, ProjectFile::CXXSource); part->files << ProjectFile(file, ProjectFile::CXXSource);
......
Supports Markdown
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