This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Make use of diagnostic tags for some clang diags
ClosedPublic

Authored by kadircet on Jul 29 2021, 12:25 AM.

Details

Summary

It is not great to list diag ids by hand, but I don't see any other
solution unless diagnostics are annotated with these explicitly, which is a
bigger change in clang and I am not sure if would be worth it.

Diagnostics handled by this patch is by no means exhaustive, there might be
other checks that don't mention "unused"/"deprecated" in their names. But it
feels like this should be enough to catch common diagnostics and can be extended
over time.

Diff Detail

Event Timeline

kadircet created this revision.Jul 29 2021, 12:25 AM
kadircet requested review of this revision.Jul 29 2021, 12:25 AM
kadircet updated this revision to Diff 363038.Jul 30 2021, 5:20 AM
  • Fix base
sammccall accepted this revision.Jul 30 2021, 5:26 AM
sammccall added inline comments.
clang-tools-extra/clangd/Diagnostics.cpp
330

I think it might be nicer if this took a clangd::Diag& and added the tags to it, then we could naturally group the clang-tidy list along with the main clang diag list (I don't think having them separately serves anyone well)

331

nit: static const auto& DeprecatedDiags = *new llvm::DenseSet<unsigned>{...

This suppresses destruction

clang-tools-extra/clangd/Diagnostics.h
110

Maybe SmallVector or even Optional since this is 0-1 integers in practice?

clang-tools-extra/clangd/Protocol.cpp
1457

keep ordering consistent with the header? so before Diagnostic

This revision is now accepted and ready to land.Jul 30 2021, 5:26 AM
kadircet updated this revision to Diff 363053.Jul 30 2021, 6:11 AM
kadircet marked 3 inline comments as done.
  • Address comments
kadircet marked an inline comment as done.Jul 30 2021, 6:11 AM
This revision was landed with ongoing or failed builds.Jul 30 2021, 6:12 AM
This revision was automatically updated to reflect the committed changes.