Debugger: Convert a QRegExp use in source path map

Task-number: QTCREATORBUG-24098
Change-Id: I1ee441a60cbf362d38459bcef869e02d7fca9b7e
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2020-06-10 08:10:59 +02:00
parent ae0d913e2f
commit afde217f28
4 changed files with 8 additions and 8 deletions

View File

@@ -236,7 +236,7 @@ void CommonOptionsPageWidget::apply()
for (auto it = allPathMap.begin(), end = allPathMap.end(); it != end; ++it) {
const QString key = it.key();
if (key.startsWith('('))
options->sourcePathRegExpMap.append(qMakePair(QRegExp(key), it.value()));
options->sourcePathRegExpMap.append(qMakePair(QRegularExpression(key), it.value()));
else
options->sourcePathMap.insert(key, it.value());
}

View File

@@ -87,7 +87,7 @@ void GlobalDebuggerOptions::fromSettings()
const QString key = s->value(sourcePathMappingSourceKey).toString();
const QString value = s->value(sourcePathMappingTargetKey).toString();
if (key.startsWith('('))
sourcePathRegExpMap.append(qMakePair(QRegExp(key), value));
sourcePathRegExpMap.append(qMakePair(QRegularExpression(key), value));
else
sourcePathMap.insert(key, value);
}

View File

@@ -28,7 +28,7 @@
#include <QCoreApplication>
#include <QHash>
#include <QMap>
#include <QRegExp>
#include <QRegularExpression>
#include <QVector>
namespace Utils { class SavedAction; }
@@ -37,7 +37,7 @@ namespace Debugger {
namespace Internal {
using SourcePathMap = QMap<QString, QString>;
using SourcePathRegExpMap = QVector<QPair<QRegExp, QString> >;
using SourcePathRegExpMap = QVector<QPair<QRegularExpression, QString>>;
// Global debugger options that are not stored as saved action.
class GlobalDebuggerOptions

View File

@@ -2827,10 +2827,10 @@ void CppDebuggerEngine::validateRunParameters(DebuggerRunParameters &rp)
for (auto itExp = globalRegExpSourceMap.begin(), itEnd = globalRegExpSourceMap.end();
itExp != itEnd;
++itExp) {
QRegExp exp = itExp->first;
int index = exp.indexIn(string);
if (index != -1) {
rp.sourcePathMap.insert(string.left(index) + exp.cap(1), itExp->second);
const QRegularExpressionMatch match = itExp->first.match(string);
if (match.hasMatch()) {
rp.sourcePathMap.insert(string.left(match.capturedStart()) + match.captured(1),
itExp->second);
found = true;
break;
}