From 3d33886e53722ae7e2f33741085fe01c1a1178f8 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Wed, 25 Jun 2014 17:23:19 +0200 Subject: C++: fix include/framework path handling. Instead of having two lists of paths, now only one list is used where both include paths and framework paths can be mixed. This reflects the way the compiler is invoked, and retains the (correct) search order. Task-number: QTCREATORBUG-11599 Change-Id: I373953e3e305df5b7a0d10920e12d146584adf9f Reviewed-by: Nikolai Kosjar --- src/plugins/cpptools/cppmodelmanagerinterface.cpp | 36 +++++++++++------------ 1 file changed, 17 insertions(+), 19 deletions(-) (limited to 'src/plugins/cpptools/cppmodelmanagerinterface.cpp') diff --git a/src/plugins/cpptools/cppmodelmanagerinterface.cpp b/src/plugins/cpptools/cppmodelmanagerinterface.cpp index 5b31d4a2a2..8c79e3d0da 100644 --- a/src/plugins/cpptools/cppmodelmanagerinterface.cpp +++ b/src/plugins/cpptools/cppmodelmanagerinterface.cpp @@ -154,12 +154,12 @@ void ProjectPart::evaluateToolchain(const ToolChain *tc, cWarningFlags = tc->warningFlags(cflags); cxxWarningFlags = tc->warningFlags(cxxflags); - const QList headers = tc->systemHeaderPaths(cxxflags, sysRoot); - foreach (const HeaderPath &header, headers) - if (header.kind() == HeaderPath::FrameworkHeaderPath) - frameworkPaths << header.path(); - else - includePaths << header.path(); + const QList headers = tc->systemHeaderPaths(cxxflags, sysRoot); + foreach (const ProjectExplorer::HeaderPath &header, headers) { + headerPaths << HeaderPath(header.path(), + header.kind() == ProjectExplorer::HeaderPath::FrameworkHeaderPath + ? HeaderPath::FrameworkPath : HeaderPath::IncludePath); + } toolchainDefines = tc->predefinedMacros(cxxflags); } @@ -187,8 +187,7 @@ CppModelManagerInterface *CppModelManagerInterface::instance() void CppModelManagerInterface::ProjectInfo::clearProjectParts() { m_projectParts.clear(); - m_includePaths.clear(); - m_frameworkPaths.clear(); + m_headerPaths.clear(); m_sourceFiles.clear(); m_defines.clear(); } @@ -200,17 +199,16 @@ void CppModelManagerInterface::ProjectInfo::appendProjectPart(const ProjectPart: m_projectParts.append(part); - // Update include paths - QSet incs = QSet::fromList(m_includePaths); - foreach (const QString &ins, part->includePaths) - incs.insert(ins); - m_includePaths = incs.toList(); - - // Update framework paths - QSet frms = QSet::fromList(m_frameworkPaths); - foreach (const QString &frm, part->frameworkPaths) - frms.insert(frm); - m_frameworkPaths = frms.toList(); + typedef ProjectPart::HeaderPath HeaderPath; + + // Update header paths + QSet incs = QSet::fromList(m_headerPaths); + foreach (const HeaderPath &hp, part->headerPaths) { + if (!incs.contains(hp)) { + incs.insert(hp); + m_headerPaths += hp; + } + } // Update source files QSet srcs = QSet::fromList(m_sourceFiles); -- cgit v1.2.1