ClangCodeModel: Suppress "Unknown argument" error

Unknown compiler flags are an unsuppressable error in clang.
But we do not want to maintain a blacklist of unsupported GCC and MSVC
options or a whitelist of supported clang options, as both would
constantly go out of date.
As clangd seems to work fine despite the error message, we simply filter
out this type of diagnostic.

Fixes: QTCREATORBUG-27113
Change-Id: Ib32601831eded60daf80eb0ca5cf01bbd71493fa
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Kandeler
2022-02-25 16:37:16 +01:00
parent f8cec0a85a
commit 9735049e2c
10 changed files with 26 additions and 9 deletions

View File

@@ -90,7 +90,9 @@ void DiagnosticManager::setDiagnostics(const LanguageServerProtocol::DocumentUri
const Utils::optional<int> &version)
{
hideDiagnostics(uri.toFilePath());
m_diagnostics[uri] = {version, diagnostics};
const QList<Diagnostic> filteredDiags = m_filter
? Utils::filtered(diagnostics, m_filter) : diagnostics;
m_diagnostics[uri] = {version, filteredDiags};
}
void DiagnosticManager::hideDiagnostics(const Utils::FilePath &filePath)
@@ -201,10 +203,12 @@ bool DiagnosticManager::hasDiagnostic(const LanguageServerProtocol::DocumentUri
}
void DiagnosticManager::setDiagnosticsHandlers(const TextMarkCreator &textMarkCreator,
const HideDiagnosticsHandler &removalHandler)
const HideDiagnosticsHandler &removalHandler,
const DiagnosticsFilter &filter)
{
m_textMarkCreator = textMarkCreator;
m_hideHandler = removalHandler;
m_filter = filter;
}
} // namespace LanguageClient