forked from qt-creator/qt-creator
clang: Do not keep tasks around too long
Change-Id: Ieb03e2ed3fa2ac54dede30107942666aee11d43c Reviewed-on: http://codereview.qt.nokia.com/312 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user