ProjectExplorer: Consolidate macro and header path cache handling

All except Nim and the test tool chain were referencing the cache,
so move it to the base.

This removes also toolChainUpdated() overloads, including the
MsvcToolChain one that missed to call the base implementation
and the ClangClToolChain one that worked around that.

Change-Id: I8a99734aa3c697c635809a3648673a10ca14a2d8
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
hjk
2019-05-09 11:24:54 +02:00
parent 14300bd477
commit a659cbc680
12 changed files with 61 additions and 126 deletions

View File

@@ -58,7 +58,9 @@ public:
explicit ToolChainPrivate(Core::Id typeId, Detection d) :
m_id(QUuid::createUuid().toByteArray()),
m_typeId(typeId),
m_detection(d)
m_detection(d),
m_predefinedMacrosCache(new ToolChain::MacrosCache::element_type()),
m_headerPathsCache(new ToolChain::HeaderPathsCache::element_type())
{
QTC_ASSERT(m_typeId.isValid(), return);
QTC_ASSERT(!m_typeId.toString().contains(QLatin1Char(':')), return);
@@ -70,6 +72,9 @@ public:
Core::Id m_typeId;
Core::Id m_language;
Detection m_detection;
ToolChain::MacrosCache m_predefinedMacrosCache;
ToolChain::HeaderPathsCache m_headerPathsCache;
};
@@ -236,6 +241,9 @@ QVariantMap ToolChain::toMap() const
void ToolChain::toolChainUpdated()
{
d->m_predefinedMacrosCache->invalidate();
d->m_headerPathsCache->invalidate();
ToolChainManager::notifyAboutUpdate(this);
}
@@ -286,6 +294,16 @@ bool ToolChain::fromMap(const QVariantMap &data)
return true;
}
const ToolChain::HeaderPathsCache &ToolChain::headerPathsCache() const
{
return d->m_headerPathsCache;
}
const ToolChain::MacrosCache &ToolChain::predefinedMacrosCache() const
{
return d->m_predefinedMacrosCache;
}
static long toLanguageVersionAsLong(QByteArray dateAsByteArray)
{
dateAsByteArray.chop(1); // Strip 'L'.