diff options
-rw-r--r-- | src/libs/utils/environment.cpp | 15 | ||||
-rw-r--r-- | src/libs/utils/environment.h | 2 | ||||
-rw-r--r-- | src/plugins/projectexplorer/gcctoolchain.cpp | 11 | ||||
-rw-r--r-- | src/plugins/projectexplorer/gcctoolchain.h | 4 | ||||
-rw-r--r-- | src/plugins/projectexplorer/msvctoolchain.cpp | 4 | ||||
-rw-r--r-- | src/plugins/projectexplorer/toolchain.cpp | 4 | ||||
-rw-r--r-- | src/plugins/projectexplorer/toolchain.h | 4 | ||||
-rw-r--r-- | src/plugins/qmakeprojectmanager/qmakeproject.cpp | 4 | ||||
-rw-r--r-- | src/plugins/qtsupport/qtversionmanager.cpp | 3 |
9 files changed, 11 insertions, 40 deletions
diff --git a/src/libs/utils/environment.cpp b/src/libs/utils/environment.cpp index 0a2d39c8f0..486fb85053 100644 --- a/src/libs/utils/environment.cpp +++ b/src/libs/utils/environment.cpp @@ -168,21 +168,6 @@ static QStringList appendExeExtensions(const Environment &env, const QString &ex return execs; } -bool Environment::isSameExecutable(const QString &exe1, const QString &exe2) const -{ - const QStringList exe1List = appendExeExtensions(*this, exe1); - const QStringList exe2List = appendExeExtensions(*this, exe2); - for (const QString &i1 : exe1List) { - for (const QString &i2 : exe2List) { - const FilePath f1 = FilePath::fromString(i1); - const FilePath f2 = FilePath::fromString(i2); - if (f1.isSameFile(f2)) - return true; - } - } - return false; -} - QString Environment::expandedValueForKey(const QString &key) const { return expandVariables(m_dict.value(key)); diff --git a/src/libs/utils/environment.h b/src/libs/utils/environment.h index 180bd86b49..65ecc8dbbe 100644 --- a/src/libs/utils/environment.h +++ b/src/libs/utils/environment.h @@ -65,8 +65,6 @@ public: FilePaths path() const; FilePaths pathListValue(const QString &varName) const; - bool isSameExecutable(const QString &exe1, const QString &exe2) const; - QString expandedValueForKey(const QString &key) const; QString expandVariables(const QString &input) const; FilePath expandVariables(const FilePath &input) const; diff --git a/src/plugins/projectexplorer/gcctoolchain.cpp b/src/plugins/projectexplorer/gcctoolchain.cpp index 89a172aae6..bcf6cab5a2 100644 --- a/src/plugins/projectexplorer/gcctoolchain.cpp +++ b/src/plugins/projectexplorer/gcctoolchain.cpp @@ -1189,9 +1189,7 @@ Toolchains GccToolChainFactory::autoDetectToolchains( || compilerPath.toString().contains("ccache")) { existingTcMatches = existingCommand == compilerPath; } else { - existingTcMatches = Environment::systemEnvironment() - .isSameExecutable(existingCommand.toString(), - compilerPath.toString()); + existingTcMatches = existingCommand.isSameExecutable(compilerPath); if (!existingTcMatches && HostOsInfo::isWindowsHost() && !existingCommand.needsDevice() @@ -1560,8 +1558,7 @@ ClangToolChain::~ClangToolChain() QObject::disconnect(m_mingwToolchainAddedConnection); } -bool ClangToolChain::matchesCompilerCommand(const Utils::FilePath &command, - const Utils::Environment &env) const +bool ClangToolChain::matchesCompilerCommand(const FilePath &command) const { if (!m_resolvedCompilerCommand) { m_resolvedCompilerCommand = FilePath(); @@ -1576,9 +1573,9 @@ bool ClangToolChain::matchesCompilerCommand(const Utils::FilePath &command, } } if (!m_resolvedCompilerCommand->isEmpty() - && env.isSameExecutable(m_resolvedCompilerCommand->toString(), command.toString())) + && m_resolvedCompilerCommand->isSameExecutable(command)) return true; - return GccToolChain::matchesCompilerCommand(command, env); + return GccToolChain::matchesCompilerCommand(command); } static FilePath mingwAwareMakeCommand(const Environment &environment) diff --git a/src/plugins/projectexplorer/gcctoolchain.h b/src/plugins/projectexplorer/gcctoolchain.h index e17c79d3ec..37c50f6db1 100644 --- a/src/plugins/projectexplorer/gcctoolchain.h +++ b/src/plugins/projectexplorer/gcctoolchain.h @@ -190,9 +190,7 @@ public: explicit ClangToolChain(Utils::Id typeId); ~ClangToolChain() override; - bool matchesCompilerCommand( - const Utils::FilePath &command, - const Utils::Environment &env = Utils::Environment::systemEnvironment()) const override; + bool matchesCompilerCommand(const Utils::FilePath &command) const override; Utils::FilePath makeCommand(const Utils::Environment &environment) const override; diff --git a/src/plugins/projectexplorer/msvctoolchain.cpp b/src/plugins/projectexplorer/msvctoolchain.cpp index 8a598c2624..5bb3fe8d07 100644 --- a/src/plugins/projectexplorer/msvctoolchain.cpp +++ b/src/plugins/projectexplorer/msvctoolchain.cpp @@ -1598,7 +1598,6 @@ static Toolchains detectClangClToolChainInPath(const FilePath &clangClPath, return res; } - Utils::Environment systemEnvironment = Utils::Environment::systemEnvironment(); const Abi targetAbi = toolChain->targetAbi(); const QString name = QString("%1LLVM %2 bit based on %3") .arg(QLatin1String(isDefault ? "Default " : "")) @@ -1613,8 +1612,7 @@ static Toolchains detectClangClToolChainInPath(const FilePath &clangClPath, return false; if (tc->language() != language) return false; - return systemEnvironment.isSameExecutable(tc->compilerCommand().toString(), - clangClPath.toString()); + return tc->compilerCommand().isSameExecutable(clangClPath); })); if (tc) { res << tc; diff --git a/src/plugins/projectexplorer/toolchain.cpp b/src/plugins/projectexplorer/toolchain.cpp index fbbc748d8e..4edab3c8b0 100644 --- a/src/plugins/projectexplorer/toolchain.cpp +++ b/src/plugins/projectexplorer/toolchain.cpp @@ -325,9 +325,9 @@ void ToolChain::setCompilerCommand(const FilePath &command) toolChainUpdated(); } -bool ToolChain::matchesCompilerCommand(const Utils::FilePath &command, const Environment &env) const +bool ToolChain::matchesCompilerCommand(const FilePath &command) const { - return env.isSameExecutable(compilerCommand().toString(), command.toString()); + return compilerCommand().isSameExecutable(command); } void ToolChain::setCompilerCommandKey(const QString &commandKey) diff --git a/src/plugins/projectexplorer/toolchain.h b/src/plugins/projectexplorer/toolchain.h index 807e0c5671..05e9d58102 100644 --- a/src/plugins/projectexplorer/toolchain.h +++ b/src/plugins/projectexplorer/toolchain.h @@ -134,9 +134,7 @@ public: virtual Utils::FilePath compilerCommand() const; // FIXME: De-virtualize. void setCompilerCommand(const Utils::FilePath &command); - virtual bool matchesCompilerCommand( - const Utils::FilePath &command, - const Utils::Environment &env = Utils::Environment::systemEnvironment()) const; + virtual bool matchesCompilerCommand(const Utils::FilePath &command) const; virtual QList<Utils::OutputLineParser *> createOutputParsers() const = 0; diff --git a/src/plugins/qmakeprojectmanager/qmakeproject.cpp b/src/plugins/qmakeprojectmanager/qmakeproject.cpp index 12176bb619..5b330ae752 100644 --- a/src/plugins/qmakeprojectmanager/qmakeproject.cpp +++ b/src/plugins/qmakeprojectmanager/qmakeproject.cpp @@ -1395,9 +1395,7 @@ void QmakeBuildSystem::testToolChain(ToolChain *tc, const FilePath &path) const return; const FilePath expected = tc->compilerCommand(); - Environment env = buildConfiguration()->environment(); - - if (tc->matchesCompilerCommand(expected, env)) + if (tc->matchesCompilerCommand(expected)) return; const QPair<FilePath, FilePath> pair{expected, path}; if (m_toolChainWarnings.contains(pair)) diff --git a/src/plugins/qtsupport/qtversionmanager.cpp b/src/plugins/qtsupport/qtversionmanager.cpp index 117adebad9..a4ab8f4906 100644 --- a/src/plugins/qtsupport/qtversionmanager.cpp +++ b/src/plugins/qtsupport/qtversionmanager.cpp @@ -421,8 +421,7 @@ static void findSystemQt() if (BuildableHelperLibrary::isQtChooser(qmakePath)) continue; const auto isSameQmake = [qmakePath](const QtVersion *version) { - return Environment::systemEnvironment(). - isSameExecutable(qmakePath.toString(), version->qmakeFilePath().toString()); + return qmakePath.isSameExecutable(version->qmakeFilePath()); }; if (contains(m_versions, isSameQmake)) continue; |