MacroExpander: Prevent loop with subproviders

Prevent a loop where a subprovider of a macroexpander creates
the macroexpander itself.

Change-Id: Id2f3e29651aeb22c818091d8c785a6ea01545463
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Tobias Hunger
2017-06-07 16:50:04 +02:00
parent ba8e7d1156
commit 4e96f2ce22
3 changed files with 16 additions and 7 deletions

View File

@@ -31,6 +31,7 @@
#include <QDir>
#include <QRegularExpression>
#include <QSet>
#include <limits.h>
@@ -153,7 +154,8 @@ bool AbstractMacroExpander::expandNestedMacros(const QString &str, int *pos, QSt
*pos = i;
return true;
}
if (resolveMacro(varName, ret)) {
QSet<AbstractMacroExpander*> seen;
if (resolveMacro(varName, ret, seen)) {
*pos = i;
if (!pattern.isEmpty() && currArg == &replace) {
const QRegularExpression regexp(pattern);