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.h | 42 ++++++++++++++++++------- 1 file changed, 30 insertions(+), 12 deletions(-) (limited to 'src/plugins/cpptools/cppmodelmanagerinterface.h') diff --git a/src/plugins/cpptools/cppmodelmanagerinterface.h b/src/plugins/cpptools/cppmodelmanagerinterface.h index 608f199f3c..bd40a9de01 100644 --- a/src/plugins/cpptools/cppmodelmanagerinterface.h +++ b/src/plugins/cpptools/cppmodelmanagerinterface.h @@ -101,6 +101,27 @@ public: typedef QSharedPointer Ptr; + struct HeaderPath { + enum Type { InvalidPath, IncludePath, FrameworkPath }; + + public: + QString path; + Type type; + + HeaderPath(): type(InvalidPath) {} + HeaderPath(const QString &path, Type type): path(path), type(type) {} + + bool isValid() const { return type != InvalidPath; } + bool isFrameworkPath() const { return type == FrameworkPath; } + + bool operator==(const HeaderPath &other) const + { return path == other.path && type == other.type; } + + bool operator!=(const HeaderPath &other) const + { return !(*this == other); } + }; + typedef QList HeaderPaths; + public: QString displayName; QString projectFile; @@ -109,8 +130,7 @@ public: QString projectConfigFile; // currently only used by the Generic Project Manager QByteArray projectDefines; QByteArray toolchainDefines; - QStringList includePaths; - QStringList frameworkPaths; + QList headerPaths; QStringList precompiledHeaders; CVersion cVersion; CXXVersion cxxVersion; @@ -120,6 +140,9 @@ public: ProjectExplorer::ToolChain::WarningFlags cxxWarningFlags; }; +inline uint qHash(const ProjectPart::HeaderPath &key, uint seed = 0) +{ return ((qHash(key.path) << 2) | key.type) ^ seed; } + class CPPTOOLS_EXPORT CppModelManagerInterface : public CPlusPlus::CppModelManagerBase { Q_OBJECT @@ -159,11 +182,8 @@ public: void clearProjectParts(); void appendProjectPart(const ProjectPart::Ptr &part); - const QStringList includePaths() const - { return m_includePaths; } - - const QStringList frameworkPaths() const - { return m_frameworkPaths; } + const ProjectPart::HeaderPaths headerPaths() const + { return m_headerPaths; } const QStringList sourceFiles() const { return m_sourceFiles; } @@ -175,8 +195,7 @@ public: QPointer m_project; QList m_projectParts; // The members below are (re)calculated from the project parts once a part is appended. - QStringList m_includePaths; - QStringList m_frameworkPaths; + ProjectPart::HeaderPaths m_headerPaths; QStringList m_sourceFiles; QByteArray m_defines; }; @@ -266,11 +285,10 @@ public: virtual void setIndexingSupport(CppTools::CppIndexingSupport *indexingSupport) = 0; virtual CppIndexingSupport *indexingSupport() = 0; - virtual void setIncludePaths(const QStringList &includePaths) = 0; + virtual void setHeaderPaths(const ProjectPart::HeaderPaths &headerPaths) = 0; virtual void enableGarbageCollector(bool enable) = 0; - virtual QStringList includePaths() = 0; - virtual QStringList frameworkPaths() = 0; + virtual ProjectPart::HeaderPaths headerPaths() = 0; virtual QByteArray definedMacros() = 0; signals: -- cgit v1.2.1