diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2020-04-08 17:45:39 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2020-04-09 14:49:32 +0000 |
commit | 45ba9fcd535e4cfd5f057149b1ca4bb4dfed5bdb (patch) | |
tree | 3e3246ccf3d971e69004182007bd1b726b88b8bf /src/plugins/qtsupport/qtparser.cpp | |
parent | fa517bd72aa21ea82072af27ce98030c4ff028f2 (diff) |
Output parsers: Replace the chaining approach
Use "flat" aggregation instead.
This is another step towards the formatter/parser merger.
Along the way, also fix some some subclasses (mostly in BareMetal) that
erroneously forwarded handled output to other parsers.
Task-number: QTCREATORBUG-22665
Change-Id: I12947349ca663d2e6bbfc99efd069d69e2b54969
Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'src/plugins/qtsupport/qtparser.cpp')
-rw-r--r-- | src/plugins/qtsupport/qtparser.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/plugins/qtsupport/qtparser.cpp b/src/plugins/qtsupport/qtparser.cpp index edeff3d178d..c3fb0d57107 100644 --- a/src/plugins/qtsupport/qtparser.cpp +++ b/src/plugins/qtsupport/qtparser.cpp @@ -43,12 +43,11 @@ QtParser::QtParser() : m_translationRegExp.setMinimal(true); } -void QtParser::handleLine(const QString &line, Utils::OutputFormat type) +IOutputParser::Status QtParser::doHandleLine(const QString &line, Utils::OutputFormat type) { - if (type != Utils::StdErrFormat) { - IOutputParser::handleLine(line, type); - return; - } + if (type != Utils::StdErrFormat) + return Status::NotHandled; + QString lne = rightTrimmed(line); if (m_mocRegExp.indexIn(lne) > -1) { bool ok; @@ -65,7 +64,7 @@ void QtParser::handleLine(const QString &line, Utils::OutputFormat type) absoluteFilePath(Utils::FilePath::fromUserInput(m_mocRegExp.cap(1))), lineno); emit addTask(task, 1); - return; + return Status::Done; } if (m_translationRegExp.indexIn(lne) > -1) { Task::TaskType type = Task::Warning; @@ -74,9 +73,9 @@ void QtParser::handleLine(const QString &line, Utils::OutputFormat type) CompileTask task(type, m_translationRegExp.cap(2), absoluteFilePath(Utils::FilePath::fromUserInput(m_translationRegExp.cap(3)))); emit addTask(task, 1); - return; + return Status::Done; } - IOutputParser::handleLine(line, Utils::StdErrFormat); + return Status::NotHandled; } // Unit tests: @@ -179,7 +178,7 @@ void QtSupportPlugin::testQtOutputParser_data() void QtSupportPlugin::testQtOutputParser() { OutputParserTester testbench; - testbench.appendOutputParser(new QtParser); + testbench.addLineParser(new QtParser); QFETCH(QString, input); QFETCH(OutputParserTester::Channel, inputChannel); QFETCH(Tasks, tasks); |