[clangd] Respect WarningsAsErrors configuration for clang-tidy
This completes the fix for https://bugs.llvm.org/show_bug.cgi?id=41218.
Reviewed By: sammccall
Patch by Nathan Ridge!
Differential Revision: https://reviews.llvm.org/D61841
llvm-svn: 361113
diff --git a/clang-tools-extra/clangd/Diagnostics.cpp b/clang-tools-extra/clangd/Diagnostics.cpp
index 5fe1749..5f42841 100644
--- a/clang-tools-extra/clangd/Diagnostics.cpp
+++ b/clang-tools-extra/clangd/Diagnostics.cpp
@@ -514,9 +514,12 @@
     // Handle the new main diagnostic.
     flushLastDiag();
 
-    if (SuppressionFilter && SuppressionFilter(DiagLevel, Info)) {
-      LastPrimaryDiagnosticWasSuppressed = true;
-      return;
+    if (Adjuster) {
+      DiagLevel = Adjuster(DiagLevel, Info);
+      if (DiagLevel == DiagnosticsEngine::Ignored) {
+        LastPrimaryDiagnosticWasSuppressed = true;
+        return;
+      }
     }
     LastPrimaryDiagnosticWasSuppressed = false;