Tests: Fix compile

Broke with 4e96f2ce.

Change-Id: I7c467cc92cc8444bd3b1ef41eebff089668a0f31
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
Christian Stenger
2017-06-21 07:34:46 +02:00
parent 1e68d91cb1
commit bd259129b5
2 changed files with 14 additions and 2 deletions

View File

@@ -34,8 +34,14 @@ using namespace Utils;
class MacroMapExpander : public AbstractMacroExpander { class MacroMapExpander : public AbstractMacroExpander {
public: public:
virtual bool resolveMacro(const QString &name, QString *ret) virtual bool resolveMacro(const QString &name, QString *ret, QSet<AbstractMacroExpander*> &seen)
{ {
// loop prevention
const int count = seen.count();
seen.insert(this);
if (seen.count() == count)
return false;
QHash<QString, QString>::const_iterator it = m_map.constFind(name); QHash<QString, QString>::const_iterator it = m_map.constFind(name);
if (it != m_map.constEnd()) { if (it != m_map.constEnd()) {
*ret = it.value(); *ret = it.value();

View File

@@ -32,8 +32,14 @@
class TestMacroExpander : public Utils::AbstractMacroExpander class TestMacroExpander : public Utils::AbstractMacroExpander
{ {
public: public:
virtual bool resolveMacro(const QString &name, QString *ret) virtual bool resolveMacro(const QString &name, QString *ret, QSet<AbstractMacroExpander*> &seen)
{ {
// loop prevention
const int count = seen.count();
seen.insert(this);
if (seen.count() == count)
return false;
if (name == QLatin1String("foo")) { if (name == QLatin1String("foo")) {
*ret = QLatin1String("a"); *ret = QLatin1String("a");
return true; return true;