CppEditor:CppTools: Replace QRegExp by QRegularExpression

Task-number: QTCREATORBUG-24098
Change-Id: Id1804a31162d0239659de33c1700354494c11689
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Stenger
2020-07-13 12:05:22 +02:00
parent feb873ca34
commit 7598018a7f
2 changed files with 6 additions and 6 deletions

View File

@@ -47,7 +47,7 @@
#include <utils/runextensions.h>
#include <utils/tooltip/tooltip.h>
#include <QRegExp>
#include <QRegularExpression>
#include <QVarLengthArray>
using namespace CPlusPlus;
@@ -359,7 +359,7 @@ static int declaredParameterCount(Function *function)
return argc;
}
Q_GLOBAL_STATIC(QRegExp, commentArgNameRegexp)
Q_GLOBAL_STATIC(QRegularExpression, commentArgNameRegexp)
static bool hasCommentedName(
TranslationUnit *unit,
@@ -410,9 +410,9 @@ static bool hasCommentedName(
QString text = source.mid(nameStart, nameEnd - nameStart);
if (commentArgNameRegexp()->isEmpty())
*commentArgNameRegexp() = QRegExp(QLatin1String("/\\*\\s*(\\w*)\\s*\\*/"));
return commentArgNameRegexp()->indexIn(text) != -1;
if (commentArgNameRegexp()->pattern().isEmpty())
*commentArgNameRegexp() = QRegularExpression(QLatin1String("/\\*\\s*(\\w*)\\s*\\*/"));
return text.indexOf(*commentArgNameRegexp()) != -1;
}
static bool canReplaceSpecifier(TranslationUnit *translationUnit, SpecifierAST *specifier)

View File

@@ -111,7 +111,7 @@ protected:
pp(ast);
QString code = QString::fromStdString(s.str());
code.replace('\n', ' ');
code.replace(QRegExp("\\s+"), " ");
code.replace(QRegularExpression("\\s+"), " ");
const char *name = abi::__cxa_demangle(typeid(*ast).name(), 0, 0, 0) + 11;