GccToolChain: Invalidate caches on toolchain changes

Change-Id: I91a69631d0417beb35574a5725da6b5a5e411113
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
Tobias Hunger
2017-10-30 10:12:32 +01:00
parent d8afb51c92
commit 2a651bf477
3 changed files with 15 additions and 1 deletions

View File

@@ -177,6 +177,13 @@ QList<HeaderPath> GccToolChain::gccHeaderPaths(const FileName &gcc, const QStrin
return systemHeaderPaths;
}
void GccToolChain::toolChainUpdated()
{
m_predefinedMacrosCache->invalidate();
m_headerPathsCache->invalidate();
ToolChain::toolChainUpdated();
}
static QList<Abi> guessGccAbi(const QString &m, const ProjectExplorer::Macros &macros)
{
QList<Abi> abiList;

View File

@@ -104,6 +104,12 @@ public:
return checkImpl(compilerArguments);
}
void invalidate()
{
QMutexLocker locker(&m_mutex);
m_cache.clear();
}
private:
Utils::optional<T> checkImpl(const QStringList &compilerArguments)
{
@@ -217,6 +223,7 @@ protected:
bool m_doesEnable = false;
bool m_triggered = false;
};
void toolChainUpdated() override;
private:
explicit GccToolChain(Detection d);

View File

@@ -158,7 +158,7 @@ protected:
explicit ToolChain(Core::Id typeId, Detection d);
explicit ToolChain(const ToolChain &);
void toolChainUpdated();
virtual void toolChainUpdated();
// Make sure to call this function when deriving!
virtual bool fromMap(const QVariantMap &data);