[PATCH] D107040: [clangd] Make use of diagnostic tags for some clang diags

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 30 05:26:21 PDT 2021


sammccall accepted this revision.
sammccall added inline comments.
This revision is now accepted and ready to land.


================
Comment at: clang-tools-extra/clangd/Diagnostics.cpp:330
+
+std::vector<DiagnosticTag> getDiagnosticTags(unsigned DiagID) {
+  static const llvm::DenseSet<unsigned> DeprecatedDiags = {
----------------
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)


================
Comment at: clang-tools-extra/clangd/Diagnostics.cpp:331
+std::vector<DiagnosticTag> getDiagnosticTags(unsigned DiagID) {
+  static const llvm::DenseSet<unsigned> DeprecatedDiags = {
+      diag::warn_access_decl_deprecated,
----------------
nit: static const auto& DeprecatedDiags = *new llvm::DenseSet<unsigned>{...

This suppresses destruction


================
Comment at: clang-tools-extra/clangd/Diagnostics.h:109
   std::vector<Fix> Fixes;
+  std::vector<DiagnosticTag> Tags;
 };
----------------
Maybe SmallVector or even Optional since this is 0-1 integers in practice?


================
Comment at: clang-tools-extra/clangd/Protocol.cpp:1455
 
+llvm::json::Value toJSON(DiagnosticTag Tag) { return static_cast<int>(Tag); }
 } // namespace clangd
----------------
keep ordering consistent with the header? so before Diagnostic


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D107040/new/

https://reviews.llvm.org/D107040



More information about the cfe-commits mailing list