forked from qt-creator/qt-creator
ClangTools: Remove "in file included from" trace for header diagnostics
...as this does not add much value but rather noise. Change-Id: I0bb8807c3f4df4114ea135bea74cde3fd21ab090 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
@@ -25,6 +25,8 @@
|
||||
|
||||
#include "clangtoolslogfilereader.h"
|
||||
|
||||
#include <cpptools/cppprojectfile.h>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QObject>
|
||||
@@ -147,6 +149,10 @@ static Diagnostic buildDiagnostic(const CXDiagnostic cxDiagnostic,
|
||||
clang_disposeDiagnosticSet(cxChildDiagnostics);
|
||||
});
|
||||
|
||||
using CppTools::ProjectFile;
|
||||
const bool isHeaderFile = ProjectFile::isHeader(
|
||||
ProjectFile::classify(diagnostic.location.filePath));
|
||||
|
||||
for (unsigned i = 0; i < clang_getNumDiagnosticsInSet(cxChildDiagnostics); ++i) {
|
||||
CXDiagnostic cxDiagnostic = clang_getDiagnosticInSet(cxChildDiagnostics, i);
|
||||
Utils::ExecuteOnDestruction cleanUpDiagnostic([&]() {
|
||||
@@ -156,6 +162,9 @@ static Diagnostic buildDiagnostic(const CXDiagnostic cxDiagnostic,
|
||||
if (diagnosticStep.isValid())
|
||||
continue;
|
||||
|
||||
if (isHeaderFile && diagnosticStep.message.contains("in file included from"))
|
||||
continue;
|
||||
|
||||
if (isInvalidDiagnosticLocation(diagnostic, diagnosticStep, nativeFilePath))
|
||||
return diagnostic;
|
||||
|
||||
|
Reference in New Issue
Block a user