From a60cd0ba30b8c66f1f34d2e79365f94b4e332cf6 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Wed, 6 Feb 2019 09:34:00 +0100 Subject: [PATCH] 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 --- src/plugins/clangtools/clangtoolslogfilereader.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/plugins/clangtools/clangtoolslogfilereader.cpp b/src/plugins/clangtools/clangtoolslogfilereader.cpp index d1e98fac87b..d2213d3304e 100644 --- a/src/plugins/clangtools/clangtoolslogfilereader.cpp +++ b/src/plugins/clangtools/clangtoolslogfilereader.cpp @@ -25,6 +25,8 @@ #include "clangtoolslogfilereader.h" +#include + #include #include #include @@ -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;