This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Allow diagnostics to be suppressed with configuration
ClosedPublic

Authored by sammccall on Jan 25 2021, 5:06 AM.

Details

Summary

This has been specifically requested:

https://github.com/clangd/vscode-clangd/issues/114

and various issues can be addressed with this as a workaround, e.g.:

https://github.com/clangd/clangd/issues/662

Diff Detail

Event Timeline

sammccall created this revision.Jan 25 2021, 5:06 AM
sammccall requested review of this revision.Jan 25 2021, 5:06 AM
hokein accepted this revision.Jan 25 2021, 6:34 AM
hokein added inline comments.
clang-tools-extra/clangd/Diagnostics.cpp
808

nit: use normalizeSuppressedCode(Code)?

This revision is now accepted and ready to land.Jan 25 2021, 6:34 AM
sammccall marked an inline comment as done.Jan 25 2021, 6:49 AM
This revision was landed with ongoing or failed builds.Jan 25 2021, 6:59 AM
This revision was automatically updated to reflect the committed changes.
ArcsinX added inline comments.
clang-tools-extra/clangd/ParsedAST.cpp
319

This line breaks GCC 5.4 build with the following log:

llvm-project/clang-tools-extra/clangd/ParsedAST.cpp:319:55: error: binding ‘const clang::clangd::Config’ to reference of type ‘clang::clangd::Config&’ discards qualifiers
     ASTDiags.setLevelAdjuster([&, &Cfg(Config::current())](
                                                       ^

Unsure is it a compiler bug or not. Moving Cfg out of the capture list or using a cast to Config & solves the problem.

sammccall added inline comments.Jan 27 2021, 6:33 AM
clang-tools-extra/clangd/ParsedAST.cpp
319