diff options
author | Tobias Hunger <tobias.hunger@qt.io> | 2018-09-13 12:19:07 +0200 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@qt.io> | 2018-09-13 11:32:51 +0000 |
commit | 11245564da74a3054de4e312b5e120811cc4a536 (patch) | |
tree | d27000fb034fcf153e21f21ad85484f14c629cb0 /src | |
parent | 570fe88970e121f31cb0466c6c0aa7de490f919b (diff) | |
download | qt-creator-11245564da74a3054de4e312b5e120811cc4a536.tar.gz |
ProjectExplorer: Consistently use HeaderPaths
Use HeaderPaths over QList<HeaderPath>.
Change-Id: I8f78b0a44e0160f1a2e7a78d9db4d04fcaa22f82
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/android/androidtoolchain.cpp | 4 | ||||
-rw-r--r-- | src/plugins/cpptools/cppprojectinfogenerator.cpp | 2 | ||||
-rw-r--r-- | src/plugins/nim/project/nimtoolchain.cpp | 4 | ||||
-rw-r--r-- | src/plugins/nim/project/nimtoolchain.h | 4 | ||||
-rw-r--r-- | src/plugins/projectexplorer/abstractmsvctoolchain.cpp | 4 | ||||
-rw-r--r-- | src/plugins/projectexplorer/abstractmsvctoolchain.h | 6 | ||||
-rw-r--r-- | src/plugins/projectexplorer/customtoolchain.cpp | 12 | ||||
-rw-r--r-- | src/plugins/projectexplorer/customtoolchain.h | 6 | ||||
-rw-r--r-- | src/plugins/projectexplorer/gcctoolchain.cpp | 21 | ||||
-rw-r--r-- | src/plugins/projectexplorer/gcctoolchain.h | 15 | ||||
-rw-r--r-- | src/plugins/projectexplorer/toolchain.h | 11 | ||||
-rw-r--r-- | src/plugins/projectexplorer/toolchainsettingsaccessor.cpp | 4 |
12 files changed, 47 insertions, 46 deletions
diff --git a/src/plugins/android/androidtoolchain.cpp b/src/plugins/android/androidtoolchain.cpp index 72aa37084a..a124b29da1 100644 --- a/src/plugins/android/androidtoolchain.cpp +++ b/src/plugins/android/androidtoolchain.cpp @@ -106,7 +106,7 @@ static QString getArch(const QString &triple) // Paths added here are those that were used by qmake. They were taken from // *qtsource*/qtbase/mkspecs/common/android-base-head.conf // Adding them here allows us to use them for all build systems. -static void addSystemHeaderPaths(QList<ProjectExplorer::HeaderPath> &paths, +static void addSystemHeaderPaths(ProjectExplorer::HeaderPaths &paths, const QString &triple, const QString &version) { const Utils::FileName ndkPath = AndroidConfigurations::currentConfig().ndkLocation(); @@ -134,7 +134,7 @@ AndroidToolChain::SystemHeaderPathsRunner AndroidToolChain::createSystemHeaderPa { const QString triple = originalTargetTriple(); const QString version = this->version(); - initExtraHeaderPathsFunction([triple, version] (QList<HeaderPath> &paths) { + initExtraHeaderPathsFunction([triple, version] (HeaderPaths &paths) { addSystemHeaderPaths(paths, triple, version); }); return GccToolChain::createSystemHeaderPathsRunner(); diff --git a/src/plugins/cpptools/cppprojectinfogenerator.cpp b/src/plugins/cpptools/cppprojectinfogenerator.cpp index 87f6456aa5..f7d6ed1dbd 100644 --- a/src/plugins/cpptools/cppprojectinfogenerator.cpp +++ b/src/plugins/cpptools/cppprojectinfogenerator.cpp @@ -116,7 +116,7 @@ private: if (!m_tcInfo.headerPathsRunner) return; // No compiler set in kit. - const QList<ProjectExplorer::HeaderPath> systemHeaderPaths + const ProjectExplorer::HeaderPaths systemHeaderPaths = m_tcInfo.headerPathsRunner(m_flags.commandLineFlags, m_tcInfo.sysRootPath); diff --git a/src/plugins/nim/project/nimtoolchain.cpp b/src/plugins/nim/project/nimtoolchain.cpp index 56f6f3f9a9..0f0ecaf061 100644 --- a/src/plugins/nim/project/nimtoolchain.cpp +++ b/src/plugins/nim/project/nimtoolchain.cpp @@ -102,9 +102,9 @@ ToolChain::SystemHeaderPathsRunner NimToolChain::createSystemHeaderPathsRunner() return ToolChain::SystemHeaderPathsRunner(); } -QList<HeaderPath> NimToolChain::systemHeaderPaths(const QStringList &, const FileName &) const +HeaderPaths NimToolChain::systemHeaderPaths(const QStringList &, const FileName &) const { - return QList<HeaderPath>(); + return {}; } void NimToolChain::addToEnvironment(Environment &env) const diff --git a/src/plugins/nim/project/nimtoolchain.h b/src/plugins/nim/project/nimtoolchain.h index 4e6ee118c1..ac7324acf6 100644 --- a/src/plugins/nim/project/nimtoolchain.h +++ b/src/plugins/nim/project/nimtoolchain.h @@ -46,8 +46,8 @@ public: ProjectExplorer::WarningFlags warningFlags(const QStringList &flags) const final; SystemHeaderPathsRunner createSystemHeaderPathsRunner() const override; - QList<ProjectExplorer::HeaderPath> systemHeaderPaths(const QStringList &flags, - const Utils::FileName &sysRoot) const final; + ProjectExplorer::HeaderPaths systemHeaderPaths(const QStringList &flags, + const Utils::FileName &sysRoot) const final; void addToEnvironment(Utils::Environment &env) const final; QString makeCommand(const Utils::Environment &env) const final; Utils::FileName compilerCommand() const final; diff --git a/src/plugins/projectexplorer/abstractmsvctoolchain.cpp b/src/plugins/projectexplorer/abstractmsvctoolchain.cpp index 04bd8ab70c..375c11bbbc 100644 --- a/src/plugins/projectexplorer/abstractmsvctoolchain.cpp +++ b/src/plugins/projectexplorer/abstractmsvctoolchain.cpp @@ -225,8 +225,8 @@ ToolChain::SystemHeaderPathsRunner AbstractMsvcToolChain::createSystemHeaderPath }; } -QList<HeaderPath> AbstractMsvcToolChain::systemHeaderPaths(const QStringList &cxxflags, - const Utils::FileName &sysRoot) const +HeaderPaths AbstractMsvcToolChain::systemHeaderPaths(const QStringList &cxxflags, + const Utils::FileName &sysRoot) const { return createSystemHeaderPathsRunner()(cxxflags, sysRoot.toString()); } diff --git a/src/plugins/projectexplorer/abstractmsvctoolchain.h b/src/plugins/projectexplorer/abstractmsvctoolchain.h index 7feee8561c..55989f447e 100644 --- a/src/plugins/projectexplorer/abstractmsvctoolchain.h +++ b/src/plugins/projectexplorer/abstractmsvctoolchain.h @@ -58,8 +58,8 @@ public: CompilerFlags compilerFlags(const QStringList &cxxflags) const override; WarningFlags warningFlags(const QStringList &cflags) const override; SystemHeaderPathsRunner createSystemHeaderPathsRunner() const override; - QList<HeaderPath> systemHeaderPaths(const QStringList &cxxflags, - const Utils::FileName &sysRoot) const override; + HeaderPaths systemHeaderPaths(const QStringList &cxxflags, + const Utils::FileName &sysRoot) const override; void addToEnvironment(Utils::Environment &env) const override; QString makeCommand(const Utils::Environment &environment) const override; @@ -104,7 +104,7 @@ protected: mutable Utils::Environment m_lastEnvironment; // Last checked 'incoming' environment. mutable Utils::Environment m_resultEnvironment; // Resulting environment for VC mutable QMutex *m_headerPathsMutex = nullptr; - mutable QList<HeaderPath> m_headerPaths; + mutable HeaderPaths m_headerPaths; Abi m_abi; QString m_vcvarsBat; diff --git a/src/plugins/projectexplorer/customtoolchain.cpp b/src/plugins/projectexplorer/customtoolchain.cpp index 2b10e2ded8..ab00833738 100644 --- a/src/plugins/projectexplorer/customtoolchain.cpp +++ b/src/plugins/projectexplorer/customtoolchain.cpp @@ -168,11 +168,11 @@ void CustomToolChain::setPredefinedMacros(const Macros ¯os) ToolChain::SystemHeaderPathsRunner CustomToolChain::createSystemHeaderPathsRunner() const { - const QList<HeaderPath> systemHeaderPaths = m_systemHeaderPaths; + const HeaderPaths systemHeaderPaths = m_systemHeaderPaths; // This runner must be thread-safe! return [systemHeaderPaths](const QStringList &cxxFlags, const QString &) { - QList<HeaderPath> flagHeaderPaths; + HeaderPaths flagHeaderPaths; for (const QString &cxxFlag : cxxFlags) { if (cxxFlag.startsWith(QLatin1String("-I"))) { flagHeaderPaths.push_back({cxxFlag.mid(2).trimmed(), HeaderPathType::System}); @@ -183,8 +183,8 @@ ToolChain::SystemHeaderPathsRunner CustomToolChain::createSystemHeaderPathsRunne }; } -QList<HeaderPath> CustomToolChain::systemHeaderPaths(const QStringList &cxxFlags, - const FileName &fileName) const +HeaderPaths CustomToolChain::systemHeaderPaths(const QStringList &cxxFlags, + const FileName &fileName) const { return createSystemHeaderPathsRunner()(cxxFlags, fileName.toString()); } @@ -222,12 +222,12 @@ IOutputParser *CustomToolChain::outputParser() const QStringList CustomToolChain::headerPathsList() const { - return Utils::transform(m_systemHeaderPaths, &HeaderPath::path); + return Utils::transform<QList>(m_systemHeaderPaths, &HeaderPath::path); } void CustomToolChain::setHeaderPaths(const QStringList &list) { - QList<HeaderPath> tmp = Utils::transform(list, [](const QString &headerPath) { + HeaderPaths tmp = Utils::transform<QVector>(list, [](const QString &headerPath) { return HeaderPath(headerPath.trimmed(), HeaderPathType::System); }); diff --git a/src/plugins/projectexplorer/customtoolchain.h b/src/plugins/projectexplorer/customtoolchain.h index b0554f0d06..9bf24f5694 100644 --- a/src/plugins/projectexplorer/customtoolchain.h +++ b/src/plugins/projectexplorer/customtoolchain.h @@ -79,8 +79,8 @@ public: void setPredefinedMacros(const Macros ¯os); SystemHeaderPathsRunner createSystemHeaderPathsRunner() const override; - QList<HeaderPath> systemHeaderPaths(const QStringList &cxxFlags, - const Utils::FileName &) const override; + HeaderPaths systemHeaderPaths(const QStringList &cxxFlags, + const Utils::FileName &) const override; void addToEnvironment(Utils::Environment &env) const override; Utils::FileNameList suggestedMkspecList() const override; IOutputParser *outputParser() const override; @@ -125,7 +125,7 @@ private: Abi m_targetAbi; Macros m_predefinedMacros; - QList<HeaderPath> m_systemHeaderPaths; + HeaderPaths m_systemHeaderPaths; QStringList m_cxx11Flags; Utils::FileNameList m_mkspecs; diff --git a/src/plugins/projectexplorer/gcctoolchain.cpp b/src/plugins/projectexplorer/gcctoolchain.cpp index 89e30cee69..a97e259f10 100644 --- a/src/plugins/projectexplorer/gcctoolchain.cpp +++ b/src/plugins/projectexplorer/gcctoolchain.cpp @@ -136,10 +136,10 @@ static ProjectExplorer::Macros gccPredefinedMacros(const FileName &gcc, return predefinedMacros; } -QList<HeaderPath> GccToolChain::gccHeaderPaths(const FileName &gcc, const QStringList &arguments, - const QStringList &env) +HeaderPaths GccToolChain::gccHeaderPaths(const FileName &gcc, const QStringList &arguments, + const QStringList &env) { - QList<HeaderPath> systemHeaderPaths; + HeaderPaths systemHeaderPaths; QByteArray line; QByteArray data = runGcc(gcc, arguments, env); QBuffer cpp(&data); @@ -255,7 +255,7 @@ GccToolChain::GccToolChain(Detection d) : GccToolChain::GccToolChain(Core::Id typeId, Detection d) : ToolChain(typeId, d), m_predefinedMacrosCache(std::make_shared<Cache<QVector<Macro>, 64>>()), - m_headerPathsCache(std::make_shared<Cache<QList<HeaderPath>>>()) + m_headerPathsCache(std::make_shared<Cache<HeaderPaths>>()) { } void GccToolChain::setCompilerCommand(const FileName &path) @@ -631,7 +631,7 @@ ToolChain::SystemHeaderPathsRunner GccToolChain::createSystemHeaderPathsRunner() const QStringList platformCodeGenFlags = m_platformCodeGenFlags; OptionsReinterpreter reinterpretOptions = m_optionsReinterpreter; QTC_CHECK(reinterpretOptions); - std::shared_ptr<Cache<QList<HeaderPath>>> headerCache = m_headerPathsCache; + std::shared_ptr<Cache<HeaderPaths>> headerCache = m_headerPathsCache; Core::Id languageId = language(); // This runner must be thread-safe! @@ -642,13 +642,12 @@ ToolChain::SystemHeaderPathsRunner GccToolChain::createSystemHeaderPathsRunner() QStringList arguments = gccPrepareArguments(flags, sysRoot, platformCodeGenFlags, languageId, reinterpretOptions); - const Utils::optional<QList<HeaderPath>> cachedPaths = headerCache->check(arguments); + const Utils::optional<HeaderPaths> cachedPaths = headerCache->check(arguments); if (cachedPaths) return cachedPaths.value(); - QList<HeaderPath> paths = gccHeaderPaths(findLocalCompiler(compilerCommand, env), - arguments, - env.toStringList()); + HeaderPaths paths = gccHeaderPaths(findLocalCompiler(compilerCommand, env), + arguments, env.toStringList()); extraHeaderPathsFunction(paths); headerCache->insert(arguments, paths); @@ -664,8 +663,8 @@ ToolChain::SystemHeaderPathsRunner GccToolChain::createSystemHeaderPathsRunner() }; } -QList<HeaderPath> GccToolChain::systemHeaderPaths(const QStringList &flags, - const FileName &sysRoot) const +HeaderPaths GccToolChain::systemHeaderPaths(const QStringList &flags, + const FileName &sysRoot) const { return createSystemHeaderPathsRunner()(flags, sysRoot.toString()); } diff --git a/src/plugins/projectexplorer/gcctoolchain.h b/src/plugins/projectexplorer/gcctoolchain.h index 7cc6d60e6f..678b655042 100644 --- a/src/plugins/projectexplorer/gcctoolchain.h +++ b/src/plugins/projectexplorer/gcctoolchain.h @@ -147,8 +147,8 @@ public: Macros predefinedMacros(const QStringList &cxxflags) const override; SystemHeaderPathsRunner createSystemHeaderPathsRunner() const override; - QList<HeaderPath> systemHeaderPaths(const QStringList &flags, - const Utils::FileName &sysRoot) const override; + HeaderPaths systemHeaderPaths(const QStringList &flags, + const Utils::FileName &sysRoot) const override; void addToEnvironment(Utils::Environment &env) const override; QString makeCommand(const Utils::Environment &environment) const override; @@ -210,10 +210,11 @@ protected: using OptionsReinterpreter = std::function<QStringList(const QStringList &options)>; void setOptionsReinterpreter(const OptionsReinterpreter &optionsReinterpreter); - using ExtraHeaderPathsFunction = std::function<void(QList<HeaderPath> &)>; + using ExtraHeaderPathsFunction = std::function<void(HeaderPaths &)>; void initExtraHeaderPathsFunction(ExtraHeaderPathsFunction &&extraHeaderPathsFunction) const; - static QList<HeaderPath> gccHeaderPaths(const Utils::FileName &gcc, const QStringList &args, const QStringList &env); + static HeaderPaths gccHeaderPaths(const Utils::FileName &gcc, const QStringList &args, + const QStringList &env); class WarningFlagAdder { @@ -249,12 +250,12 @@ private: Abi m_targetAbi; mutable QList<Abi> m_supportedAbis; mutable QString m_originalTargetTriple; - mutable QList<HeaderPath> m_headerPaths; + mutable HeaderPaths m_headerPaths; mutable QString m_version; mutable std::shared_ptr<Cache<QVector<Macro>, 64>> m_predefinedMacrosCache; - mutable std::shared_ptr<Cache<QList<HeaderPath>>> m_headerPathsCache; - mutable ExtraHeaderPathsFunction m_extraHeaderPathsFunction = [](QList<HeaderPath> &) {}; + mutable std::shared_ptr<Cache<HeaderPaths>> m_headerPathsCache; + mutable ExtraHeaderPathsFunction m_extraHeaderPathsFunction = [](HeaderPaths &) {}; friend class Internal::GccToolChainConfigWidget; friend class Internal::GccToolChainFactory; diff --git a/src/plugins/projectexplorer/toolchain.h b/src/plugins/projectexplorer/toolchain.h index 7b41968d06..23d5dbf056 100644 --- a/src/plugins/projectexplorer/toolchain.h +++ b/src/plugins/projectexplorer/toolchain.h @@ -27,6 +27,8 @@ #include "projectexplorer_export.h" #include "projectexplorer_global.h" + +#include "headerpath.h" #include "projectmacro.h" #include <coreplugin/id.h> @@ -60,7 +62,6 @@ QString languageId(Language l); } // namespace Deprecated class Abi; -class HeaderPath; class IOutputParser; class ToolChainConfigWidget; class ToolChainFactory; @@ -131,11 +132,11 @@ public: virtual Macros predefinedMacros(const QStringList &cxxflags) const = 0; // A SystemHeaderPathsRunner is created in the ui thread and runs in another thread. - using SystemHeaderPathsRunner = std::function<QList<HeaderPath>(const QStringList &cxxflags, - const QString &sysRoot)>; + using SystemHeaderPathsRunner = std::function<HeaderPaths(const QStringList &cxxflags, + const QString &sysRoot)>; virtual SystemHeaderPathsRunner createSystemHeaderPathsRunner() const = 0; - virtual QList<HeaderPath> systemHeaderPaths(const QStringList &cxxflags, - const Utils::FileName &sysRoot) const = 0; + virtual HeaderPaths systemHeaderPaths(const QStringList &cxxflags, + const Utils::FileName &sysRoot) const = 0; virtual void addToEnvironment(Utils::Environment &env) const = 0; virtual QString makeCommand(const Utils::Environment &env) const = 0; diff --git a/src/plugins/projectexplorer/toolchainsettingsaccessor.cpp b/src/plugins/projectexplorer/toolchainsettingsaccessor.cpp index 3d4329ffb4..cb625b015c 100644 --- a/src/plugins/projectexplorer/toolchainsettingsaccessor.cpp +++ b/src/plugins/projectexplorer/toolchainsettingsaccessor.cpp @@ -313,8 +313,8 @@ public: CompilerFlags compilerFlags(const QStringList &cxxflags) const override { Q_UNUSED(cxxflags); return NoFlags; } WarningFlags warningFlags(const QStringList &cflags) const override { Q_UNUSED(cflags); return WarningFlags::NoWarnings; } SystemHeaderPathsRunner createSystemHeaderPathsRunner() const override { return SystemHeaderPathsRunner(); } - QList<HeaderPath> systemHeaderPaths(const QStringList &cxxflags, const FileName &sysRoot) const override - { Q_UNUSED(cxxflags); Q_UNUSED(sysRoot); return QList<HeaderPath>(); } + HeaderPaths systemHeaderPaths(const QStringList &cxxflags, const FileName &sysRoot) const override + { Q_UNUSED(cxxflags); Q_UNUSED(sysRoot); return {}; } void addToEnvironment(Environment &env) const override { Q_UNUSED(env); } QString makeCommand(const Environment &env) const override { Q_UNUSED(env); return QString("make"); } FileName compilerCommand() const override { return Utils::FileName::fromString("/tmp/test/gcc"); } |