aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qtsupport
diff options
context:
space:
mode:
authorChristian Stenger <christian.stenger@qt.io>2020-06-16 08:59:54 +0200
committerChristian Stenger <christian.stenger@qt.io>2020-06-16 12:09:49 +0000
commit241b24486ed097e93a8473efa65b3fc1d7e705b1 (patch)
tree8b9d1a206de5b0e01821c2180066771860da540e /src/plugins/qtsupport
parentd8b1fcb9d36281d3c9041b72ad7b359c2dac369d (diff)
QtSupport: Replace QRegExp by QRegularExpression
Task-number: QTCREATORBUG-24098 Change-Id: I1eefae2473919e3d2f9fa93d7d54797effd4a5f2 Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'src/plugins/qtsupport')
-rw-r--r--src/plugins/qtsupport/qtkitinformation.cpp2
-rw-r--r--src/plugins/qtsupport/qtparser.cpp30
-rw-r--r--src/plugins/qtsupport/qtparser.h6
3 files changed, 18 insertions, 20 deletions
diff --git a/src/plugins/qtsupport/qtkitinformation.cpp b/src/plugins/qtsupport/qtkitinformation.cpp
index 070f8c4860..bc3d0f9e39 100644
--- a/src/plugins/qtsupport/qtkitinformation.cpp
+++ b/src/plugins/qtsupport/qtkitinformation.cpp
@@ -25,8 +25,6 @@
#include "qtkitinformation.h"
-#include <QRegExp>
-
#include "qtsupportconstants.h"
#include "qtversionmanager.h"
#include "qtparser.h"
diff --git a/src/plugins/qtsupport/qtparser.cpp b/src/plugins/qtsupport/qtparser.cpp
index b376e9911c..7265f45c64 100644
--- a/src/plugins/qtsupport/qtparser.cpp
+++ b/src/plugins/qtsupport/qtparser.cpp
@@ -44,12 +44,10 @@ namespace QtSupport {
#define FILE_PATTERN "^(([A-Za-z]:)?[^:]+\\.[^:]+)"
QtParser::QtParser() :
- m_mocRegExp(QLatin1String(FILE_PATTERN"[:\\(](\\d+)\\)?:\\s([Ww]arning|[Ee]rror|[Nn]ote):\\s(.+)$")),
- m_translationRegExp(QLatin1String("^([Ww]arning|[Ee]rror):\\s+(.*) in '(.*)'$"))
+ m_mocRegExp(QLatin1String(FILE_PATTERN"[:\\(](\\d+?)\\)?:\\s([Ww]arning|[Ee]rror|[Nn]ote):\\s(.+?)$")),
+ m_translationRegExp(QLatin1String("^([Ww]arning|[Ee]rror):\\s+(.*?) in '(.*?)'$"))
{
setObjectName(QLatin1String("QtParser"));
- m_mocRegExp.setMinimal(true);
- m_translationRegExp.setMinimal(true);
}
Utils::OutputLineParser::Result QtParser::handleLine(const QString &line, Utils::OutputFormat type)
@@ -58,34 +56,36 @@ Utils::OutputLineParser::Result QtParser::handleLine(const QString &line, Utils:
return Status::NotHandled;
QString lne = rightTrimmed(line);
- if (m_mocRegExp.indexIn(lne) > -1) {
+ QRegularExpressionMatch match = m_mocRegExp.match(lne);
+ if (match.hasMatch()) {
bool ok;
- int lineno = m_mocRegExp.cap(3).toInt(&ok);
+ int lineno = match.captured(3).toInt(&ok);
if (!ok)
lineno = -1;
Task::TaskType type = Task::Error;
- const QString level = m_mocRegExp.cap(4);
+ const QString level = match.captured(4);
if (level.compare(QLatin1String("Warning"), Qt::CaseInsensitive) == 0)
type = Task::Warning;
if (level.compare(QLatin1String("Note"), Qt::CaseInsensitive) == 0)
type = Task::Unknown;
LinkSpecs linkSpecs;
const Utils::FilePath file
- = absoluteFilePath(Utils::FilePath::fromUserInput(m_mocRegExp.cap(1)));
- addLinkSpecForAbsoluteFilePath(linkSpecs, file, lineno, m_mocRegExp, 1);
- CompileTask task(type, m_mocRegExp.cap(5).trimmed() /* description */, file, lineno);
+ = absoluteFilePath(Utils::FilePath::fromUserInput(match.captured(1)));
+ addLinkSpecForAbsoluteFilePath(linkSpecs, file, lineno, match, 1);
+ CompileTask task(type, match.captured(5).trimmed() /* description */, file, lineno);
scheduleTask(task, 1);
return {Status::Done, linkSpecs};
}
- if (m_translationRegExp.indexIn(lne) > -1) {
+ match = m_translationRegExp.match(line);
+ if (match.hasMatch()) {
Task::TaskType type = Task::Warning;
- if (m_translationRegExp.cap(1) == QLatin1String("Error"))
+ if (match.captured(1) == QLatin1String("Error"))
type = Task::Error;
LinkSpecs linkSpecs;
const Utils::FilePath file
- = absoluteFilePath(Utils::FilePath::fromUserInput(m_translationRegExp.cap(3)));
- addLinkSpecForAbsoluteFilePath(linkSpecs, file, 0, m_translationRegExp, 3);
- CompileTask task(type, m_translationRegExp.cap(2), file);
+ = absoluteFilePath(Utils::FilePath::fromUserInput(match.captured(3)));
+ addLinkSpecForAbsoluteFilePath(linkSpecs, file, 0, match, 3);
+ CompileTask task(type, match.captured(2), file);
scheduleTask(task, 1);
return {Status::Done, linkSpecs};
}
diff --git a/src/plugins/qtsupport/qtparser.h b/src/plugins/qtsupport/qtparser.h
index e70661f648..ad6c9d5d35 100644
--- a/src/plugins/qtsupport/qtparser.h
+++ b/src/plugins/qtsupport/qtparser.h
@@ -25,7 +25,7 @@
#pragma once
-#include <QRegExp>
+#include <QRegularExpression>
#include "qtsupport_global.h"
#include <projectexplorer/ioutputparser.h>
@@ -44,8 +44,8 @@ public:
private:
Result handleLine(const QString &line, Utils::OutputFormat type) override;
- QRegExp m_mocRegExp;
- QRegExp m_translationRegExp;
+ QRegularExpression m_mocRegExp;
+ QRegularExpression m_translationRegExp;
};
} // namespace QtSupport