Commit 7572718a authored by Tobias Hunger's avatar Tobias Hunger
Browse files

clang: Do not keep tasks around too long

Change-Id: Ieb03e2ed3fa2ac54dede30107942666aee11d43c
Reviewed-on: http://codereview.qt.nokia.com/312

Reviewed-by: default avatarQt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: default avatarTobias Hunger <tobias.hunger@nokia.com>
parent 652454a8
......@@ -47,22 +47,22 @@ namespace {
ClangParser::ClangParser() :
m_commandRegExp(QLatin1String("^clang(\\+\\+)?: +(fatal +)?(warning|error|note): (.*)$")),
m_inLineRegExp(QLatin1String("^In (.*) included from (.*):(\\d+):$")),
m_messageRegExp(QLatin1String("^") + QLatin1String(FILE_PATTERN) + QLatin1String("(:(\\d+):\\d+|\\((\\d+)\\) *): +(fatal +)?(error|warning|note): (.*)$"))
m_messageRegExp(QLatin1String("^") + QLatin1String(FILE_PATTERN) + QLatin1String("(:(\\d+):\\d+|\\((\\d+)\\) *): +(fatal +)?(error|warning|note): (.*)$")),
m_summaryRegExp(QLatin1String("^\\d+ (warnings?|errors?)( and \\d (warnings?|errors?))? generated.$"))
{
setObjectName(QLatin1String("ClangParser"));
appendOutputParser(new LdParser);
}
ClangParser::~ClangParser()
{
if (!m_currentTask.isNull())
emit addTask(m_currentTask);
}
void ClangParser::stdError(const QString &line)
{
const QString lne = line.left(line.count() - 1);
if (m_summaryRegExp.indexIn(lne) > -1) {
emitTask();
return;
}
if (m_commandRegExp.indexIn(lne) > -1) {
m_codeSnippet.clear();
newTask(Task::Error,
......@@ -144,10 +144,16 @@ void ClangParser::stdError(const QString &line)
void ClangParser::newTask(Task::TaskType type_, const QString &description_,
const QString &file_, int line_, const QString &category_)
{
emitTask();
m_currentTask = Task(type_, description_, file_, line_, category_);
}
void ClangParser::emitTask()
{
if (!m_currentTask.isNull())
emit addTask(m_currentTask);
m_currentTask = Task(type_, description_, file_, line_, category_);
m_currentTask = Task();
}
// Unit tests:
......
......@@ -45,16 +45,18 @@ class ClangParser : public ProjectExplorer::IOutputParser
public:
ClangParser();
~ClangParser();
virtual void stdError(const QString &line);
void stdError(const QString &line);
private:
void newTask(Task::TaskType type_, const QString &description_,
const QString &file_, int line_, const QString &category_);
void emitTask();
QRegExp m_commandRegExp;
QRegExp m_inLineRegExp;
QRegExp m_messageRegExp;
QRegExp m_summaryRegExp;
QString m_codeSnippet;
Task m_currentTask;
......
Supports Markdown
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