From a1947aeffe158a0ea7de3ced1bf8d6a4719a27ef Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Fri, 3 Apr 2020 17:11:36 +0200 Subject: Port qmake over to user QRegularExpression Use the DotMatchesEverythingOption for all places where we interpret .pro files, to increase compatibility with QRegExp. Change-Id: I347d6b17858069f3c9cedcedd04df58358d83f27 Reviewed-by: Joerg Bornemann --- qmake/library/qmakeevaluator.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'qmake/library/qmakeevaluator.cpp') diff --git a/qmake/library/qmakeevaluator.cpp b/qmake/library/qmakeevaluator.cpp index 7041a2402e..f78537c340 100644 --- a/qmake/library/qmakeevaluator.cpp +++ b/qmake/library/qmakeevaluator.cpp @@ -41,7 +41,7 @@ #include #include #include -#include +#include #include #include #include @@ -334,7 +334,7 @@ ProStringList QMakeEvaluator::split_value_list(const QStringRef &vals, int sourc } static void replaceInList(ProStringList *varlist, - const QRegExp ®exp, const QString &replace, bool global, QString &tmp) + const QRegularExpression ®exp, const QString &replace, bool global, QString &tmp) { for (ProStringList::Iterator varit = varlist->begin(); varit != varlist->end(); ) { ProStringRoUser u1(*varit, tmp); @@ -898,9 +898,10 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProVariable( QString pattern = func[1].toString(); QString replace = func[2].toString(); if (quote) - pattern = QRegExp::escape(pattern); + pattern = QRegularExpression::escape(pattern); - QRegExp regexp(pattern, case_sense ? Qt::CaseSensitive : Qt::CaseInsensitive); + QRegularExpression regexp(pattern, case_sense ? QRegularExpression::NoPatternOption : + QRegularExpression::CaseInsensitiveOption); // We could make a union of modified and unmodified values, // but this will break just as much as it fixes, so leave it as is. @@ -1635,17 +1636,17 @@ bool QMakeEvaluator::isActiveConfig(const QStringRef &config, bool regex) return m_hostBuild; if (regex && (config.contains(QLatin1Char('*')) || config.contains(QLatin1Char('?')))) { - QRegExp re(config.toString(), Qt::CaseSensitive, QRegExp::Wildcard); + QRegularExpression re(QRegularExpression::wildcardToRegularExpression(config.toString())); // mkspecs - if (re.exactMatch(m_qmakespecName)) + if (re.match(m_qmakespecName).hasMatch()) return true; // CONFIG variable const auto configValues = values(statics.strCONFIG); for (const ProString &configValue : configValues) { ProStringRoUser u1(configValue, m_tmp[m_toggle ^= 1]); - if (re.exactMatch(u1.str())) + if (re.match(u1.str()).hasMatch()) return true; } } else { -- cgit v1.2.3