| 344 | } |
| 345 | |
| 346 | void CheckThread::parseClangErrors(const QString &tool, const QString &file0, QString err) |
| 347 | { |
| 348 | QList<ErrorItem> errorItems; |
| 349 | ErrorItem errorItem; |
| 350 | static const QRegularExpression r1("^(.+):([0-9]+):([0-9]+): (note|warning|error|fatal error): (.*)$"); |
| 351 | static const QRegularExpression r2("^(.*)\\[([a-zA-Z0-9\\-_\\.]+)\\]$"); |
| 352 | QTextStream in(&err, QIODevice::ReadOnly); |
| 353 | while (!in.atEnd()) { |
| 354 | QString line = in.readLine(); |
| 355 | |
| 356 | if (line.startsWith("Assertion failed:")) { |
| 357 | ErrorItem e; |
| 358 | e.errorPath.append(QErrorPathItem()); |
| 359 | e.errorPath.last().file = file0; |
| 360 | e.errorPath.last().line = 1; |
| 361 | e.errorPath.last().column = 1; |
| 362 | e.errorId = tool + "-internal-error"; |
| 363 | e.file0 = file0; |
| 364 | e.message = line; |
| 365 | e.severity = Severity::information; |
| 366 | errorItems.append(e); |
| 367 | continue; |
| 368 | } |
| 369 | |
| 370 | const QRegularExpressionMatch r1MatchRes = r1.match(line); |
| 371 | if (!r1MatchRes.hasMatch()) |
| 372 | continue; |
| 373 | if (r1MatchRes.captured(4) != "note") { |
| 374 | errorItems.append(errorItem); |
| 375 | errorItem = ErrorItem(); |
| 376 | errorItem.file0 = r1MatchRes.captured(1); |
| 377 | } |
| 378 | |
| 379 | errorItem.errorPath.append(QErrorPathItem()); |
| 380 | errorItem.errorPath.last().file = r1MatchRes.captured(1); |
| 381 | errorItem.errorPath.last().line = r1MatchRes.captured(2).toInt(); |
| 382 | errorItem.errorPath.last().column = r1MatchRes.captured(3).toInt(); |
| 383 | if (r1MatchRes.captured(4) == "warning") |
| 384 | errorItem.severity = Severity::warning; |
| 385 | else if (r1MatchRes.captured(4) == "error" || r1MatchRes.captured(4) == "fatal error") |
| 386 | errorItem.severity = Severity::error; |
| 387 | |
| 388 | QString message,id; |
| 389 | const QRegularExpressionMatch r2MatchRes = r2.match(r1MatchRes.captured(5)); |
| 390 | if (r2MatchRes.hasMatch()) { |
| 391 | message = r2MatchRes.captured(1); |
| 392 | const QString id1(r2MatchRes.captured(2)); |
| 393 | if (id1.startsWith("clang")) |
| 394 | id = id1; |
| 395 | else |
| 396 | id = tool + '-' + r2MatchRes.captured(2); |
| 397 | if (tool == CLANG_TIDY) { |
| 398 | if (id1.startsWith("performance")) |
| 399 | errorItem.severity = Severity::performance; |
| 400 | else if (id1.startsWith("portability")) |
| 401 | errorItem.severity = Severity::portability; |
| 402 | else if (id1.startsWith("misc") && !id1.contains("unused")) |
| 403 | errorItem.severity = Severity::warning; |
nothing calls this directly
no test coverage detected