GUI: Show clang-tidy assertion errors in the results

This commit is contained in:
Daniel Marjamäki 2017-08-12 09:15:10 +02:00
parent fb37f3503a
commit 2c837f2908
2 changed files with 17 additions and 2 deletions

View File

@ -231,7 +231,7 @@ void CheckThread::runAddons(const QString &addonPath, const ImportProject::FileS
QProcess process; QProcess process;
process.start(cmd, args); process.start(cmd, args);
process.waitForFinished(600*1000); process.waitForFinished(600*1000);
const QString errout(addon == CLANG ? process.readAllStandardError() : process.readAllStandardOutput()); const QString errout(process.readAllStandardOutput() + "\n\n\n" + process.readAllStandardError());
if (!analyzerInfoFile.isEmpty()) { if (!analyzerInfoFile.isEmpty()) {
QFile f(analyzerInfoFile + '.' + addon + "-results"); QFile f(analyzerInfoFile + '.' + addon + "-results");
if (f.open(QIODevice::WriteOnly | QIODevice::Text)) { if (f.open(QIODevice::WriteOnly | QIODevice::Text)) {
@ -333,6 +333,21 @@ void CheckThread::parseClangErrors(const QString &tool, const QString &file0, QS
QTextStream in(&err, QIODevice::ReadOnly); QTextStream in(&err, QIODevice::ReadOnly);
while (!in.atEnd()) { while (!in.atEnd()) {
QString line = in.readLine(); QString line = in.readLine();
if (line.startsWith("Assertion failed:")) {
ErrorItem e;
e.errorPath.append(QErrorPathItem());
e.errorPath.last().file = file0;
e.errorPath.last().line = 1;
e.errorPath.last().col = 1;
e.errorId = tool + "-internal-error";
e.file0 = file0;
e.message = line;
e.severity = Severity::information;
errorItems.append(e);
continue;
}
if (!r1.exactMatch(line)) if (!r1.exactMatch(line))
continue; continue;
if (r1.cap(4) != "note") { if (r1.cap(4) != "note") {
@ -380,7 +395,7 @@ void CheckThread::parseClangErrors(const QString &tool, const QString &file0, QS
const std::string f0 = file0.toStdString(); const std::string f0 = file0.toStdString();
const std::string msg = e.message.toStdString(); const std::string msg = e.message.toStdString();
const std::string id = e.errorId.toStdString(); const std::string id = e.errorId.toStdString();
ErrorLogger::ErrorMessage errmsg(callstack, f0, errorItem.severity, msg, id, false); ErrorLogger::ErrorMessage errmsg(callstack, f0, e.severity, msg, id, false);
mResult.reportErr(errmsg); mResult.reportErr(errmsg);
} }
} }

0
gui/projectfiledialog.cpp Executable file → Normal file
View File