Commit 5695cd69 authored by Tobias Hunger's avatar Tobias Hunger
Browse files

Improve MSVC parser

 * Handle additional information lines.
parent 6ec21747
......@@ -30,13 +30,19 @@
#include "msvcparser.h"
#include "projectexplorerconstants.h"
namespace {
const char * const FILE_POS_PATTERN = "([^\\(]+)\\((\\d+)\\)\\s:";
}
using namespace ProjectExplorer;
MsvcParser::MsvcParser()
{
m_compileRegExp.setPattern("^([^\\(]+)\\((\\d+)\\)+\\s:([^:\\d]+)\\s([A-Z]+(\\d+):.*)$");
m_compileRegExp.setPattern(QString::fromLatin1("^") + QLatin1String(FILE_POS_PATTERN) + QLatin1String("([^:\\d]+)\\s([A-Z]+(\\d+):.*)$"));
m_compileRegExp.setMinimal(true);
m_linkRegExp.setPattern("^([^\\(]+)\\s:[^:\\d]+(\\d+):(.*)$");
m_additionalInfoRegExp.setPattern(QString::fromLatin1("^ ") + QLatin1String(FILE_POS_PATTERN) + QLatin1String("\\s(.*)$"));
m_additionalInfoRegExp.setMinimal(true);
m_linkRegExp.setPattern(QString::fromLatin1("^") + QLatin1String(FILE_POS_PATTERN) + QLatin1String("[^:\\d]+(\\d+):(.*)$"));
m_linkRegExp.setMinimal(true);
}
......@@ -58,6 +64,14 @@ void MsvcParser::stdOutput(const QString &line)
addTask(task);
return;
}
if (m_additionalInfoRegExp.indexIn(line) > -1 && m_additionalInfoRegExp.numCaptures() == 3) {
addTask(Task(Task::Unknown,
m_additionalInfoRegExp.cap(3),
m_additionalInfoRegExp.cap(1),
m_additionalInfoRegExp.cap(2).toInt(),
Constants::TASK_CATEGORY_COMPILE));
return;
}
if (m_linkRegExp.indexIn(lne) > -1 && m_linkRegExp.numCaptures() == 3) {
QString fileName = m_linkRegExp.cap(1);
if (fileName.contains(QLatin1String("LINK"), Qt::CaseSensitive))
......@@ -135,6 +149,22 @@ void ProjectExplorerPlugin::testMsvcOutputParsers_data()
QLatin1String(ProjectExplorer::Constants::TASK_CATEGORY_COMPILE)))
<< QString();
QTest::newRow("additional information")
<< QString::fromLatin1("x:\\src\\plugins\\texteditor\\icompletioncollector.h(50) : warning C4099: 'TextEditor::CompletionItem' : type name first seen using 'struct' now seen using 'class'\n"
" x:\\src\\plugins\\texteditor\\completionsupport.h(39) : see declaration of 'TextEditor::CompletionItem'")
<< OutputParserTester::STDOUT
<< QString() << QString()
<< (QList<ProjectExplorer::Task>()
<< Task(Task::Warning,
QLatin1String("C4099: 'TextEditor::CompletionItem' : type name first seen using 'struct' now seen using 'class'"),
QLatin1String("x:\\src\\plugins\\texteditor\\icompletioncollector.h"), 50,
QLatin1String(ProjectExplorer::Constants::TASK_CATEGORY_COMPILE))
<< Task(Task::Unknown,
QLatin1String("see declaration of 'TextEditor::CompletionItem'"),
QLatin1String("x:\\src\\plugins\\texteditor\\completionsupport.h"), 39,
QLatin1String(ProjectExplorer::Constants::TASK_CATEGORY_COMPILE)))
<< QString();
}
void ProjectExplorerPlugin::testMsvcOutputParsers()
......
......@@ -50,6 +50,7 @@ public:
private:
Task::TaskType toType(int number);
QRegExp m_compileRegExp;
QRegExp m_additionalInfoRegExp;
QRegExp m_linkRegExp;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment