AutoTest: Improve QRegularExpression usages

Use static const if possible to avoid re-initializations.

Change-Id: Ibee9e320dccb90cd928737b809db3b56369961ec
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Stenger
2023-07-04 08:31:37 +02:00
parent a85d7ef538
commit acad4b6b2e
8 changed files with 35 additions and 35 deletions

View File

@@ -112,8 +112,8 @@ TestCases QtTestParser::testCases(const CppEditor::CppModelManager *modelManager
return astVisitor.testCases();
TestCases result;
const QRegularExpression regex("\\b(QTEST_(APPLESS_|GUILESS_)?MAIN)"
"\\s*\\(\\s*([[:alnum:]]+)\\s*\\)");
static const QRegularExpression regex("\\b(QTEST_(APPLESS_|GUILESS_)?MAIN)"
"\\s*\\(\\s*([[:alnum:]]+)\\s*\\)");
QRegularExpressionMatchIterator it = regex.globalMatch(QString::fromUtf8(document->utf8Source()));
while (it.hasNext()) {
const QRegularExpressionMatch match = it.next();