ClangCodeModel: Ignore child diagnostics of type 'note' and 'ignored'

This avoids appending "previous declaration here" to the parent
diagnostic.

Clang's diagnostics are only used in the C++ editor for denoting code
warnings.

Task-number: QTCREATORBUG-13398
Change-Id: I8ed5ce2cdaa828877596745e29bb55b2d23f9735
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
Nikolai Kosjar
2014-12-04 16:29:49 +01:00
parent dcad56568e
commit 0a00bac452

View File

@@ -154,6 +154,12 @@ QList<Diagnostic> SemanticMarker::diagnostics() const
const unsigned size = qMin(ATTACHED_NOTES_LIMIT, numChildren);
for (unsigned di = 0; di < size; ++di) {
ScopedCXDiagnostic child(clang_getDiagnosticInSet(cxChildren, di));
const Diagnostic::Severity severity
= static_cast<Diagnostic::Severity>(clang_getDiagnosticSeverity(child));
if (severity == Diagnostic::Ignored || severity == Diagnostic::Note)
continue;
spelling.append(QLatin1String("\n "));
spelling.append(Internal::getQString(clang_getDiagnosticSpelling(child)));
}