diff options
author | Marco Bubke <marco.bubke@qt.io> | 2018-09-03 16:10:43 +0200 |
---|---|---|
committer | Marco Bubke <marco.bubke@qt.io> | 2018-09-10 09:31:32 +0000 |
commit | 3abaf647d0c632a4dfcb00d9ad2d1ffe66e014d9 (patch) | |
tree | 5efed90dedcb7b960cfa4d6ceb9b1aeb3e1a662b /src/plugins/projectexplorer/headerpath.h | |
parent | 59e734d9dae00ce2f9a00e8d197f81e7ee450b03 (diff) |
Add system include path to HeaderPath and merge ProjectPartHeaderPath
System include paths are appended after other includes by the compiler. So
we should set them as system includes and not as normal includes. Otherwise
we change the include order. Headers in system include paths are not
cluttering the screen with unwanted warning and by the way improve
performance too.
ProjectPartHeaderPath was a dopperganger of HeaderPath, so we merged them.
Change-Id: I7c394b4098b697de79761499ffcd5913cc02d652
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Diffstat (limited to 'src/plugins/projectexplorer/headerpath.h')
-rw-r--r-- | src/plugins/projectexplorer/headerpath.h | 51 |
1 files changed, 35 insertions, 16 deletions
diff --git a/src/plugins/projectexplorer/headerpath.h b/src/plugins/projectexplorer/headerpath.h index db3d5590b1..59ecf92b87 100644 --- a/src/plugins/projectexplorer/headerpath.h +++ b/src/plugins/projectexplorer/headerpath.h @@ -24,36 +24,55 @@ ****************************************************************************/ #pragma once -#include <QString> -#include "projectexplorer_export.h" +#include <QString> +#include <QVector> namespace ProjectExplorer { -class PROJECTEXPLORER_EXPORT HeaderPath +enum class IncludePathType { + Invalid, + User, + System, + Framework +}; + +class HeaderPath { public: - enum Kind { - GlobalHeaderPath, - UserHeaderPath, - FrameworkHeaderPath - }; - HeaderPath() = default; - HeaderPath(const QString &path, Kind kind) : m_path(path), m_kind(kind) + HeaderPath(const QString &path, IncludePathType type) + : path(path), type(type) { } - QString path() const { return m_path; } - Kind kind() const { return m_kind; } + bool isValid() const + { + return type != IncludePathType::Invalid; + } + + bool isFrameworkPath() const + { + return type == IncludePathType::Framework; + } bool operator==(const HeaderPath &other) const { - return m_kind == other.m_kind && m_path == other.m_path; + return type == other.type && path == other.path; } -private: - QString m_path; - Kind m_kind = GlobalHeaderPath; + bool operator!=(const HeaderPath &other) const + { + return !(*this == other); + } + + QString path; + IncludePathType type = IncludePathType::Invalid; }; +inline uint qHash(const HeaderPath &key, uint seed = 0) +{ + return ((qHash(key.path) << 2) | uint(key.type)) ^ seed; +} + +using HeaderPaths = QVector<HeaderPath>; } // namespace ProjectExplorer |