summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/cppmodelmanagerinterface.h
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@digia.com>2014-06-25 17:23:19 +0200
committerErik Verbruggen <erik.verbruggen@digia.com>2014-07-04 13:51:36 +0200
commit3d33886e53722ae7e2f33741085fe01c1a1178f8 (patch)
tree132429c7f2acac09a906cc549dcbd93fe8c90e70 /src/plugins/cpptools/cppmodelmanagerinterface.h
parent76152088e93258cdd025f49902270a7c53757633 (diff)
downloadqt-creator-3d33886e53722ae7e2f33741085fe01c1a1178f8.tar.gz
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 <nikolai.kosjar@digia.com>
Diffstat (limited to 'src/plugins/cpptools/cppmodelmanagerinterface.h')
-rw-r--r--src/plugins/cpptools/cppmodelmanagerinterface.h42
1 files changed, 30 insertions, 12 deletions
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<ProjectPart> 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<HeaderPath> 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<HeaderPath> 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<ProjectExplorer::Project> m_project;
QList<ProjectPart::Ptr> 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: