nridge updated this revision to Diff 199552.
nridge marked 2 inline comments as done.
nridge added a comment.

Address review comment


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61841

Files:
  clang-tools-extra/clangd/ClangdUnit.cpp


Index: clang-tools-extra/clangd/ClangdUnit.cpp
===================================================================
--- clang-tools-extra/clangd/ClangdUnit.cpp
+++ clang-tools-extra/clangd/ClangdUnit.cpp
@@ -304,6 +304,21 @@
     this->CTContext = CTContext;
   }
 
+  void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel,
+                        const clang::Diagnostic &Info) override {
+    DiagnosticsEngine::Level Level = DiagLevel;
+
+    // Check for warning-as-error.
+    if (CTContext && DiagLevel == DiagnosticsEngine::Warning) {
+      std::string CheckName = CTContext->getCheckName(Info.getID());
+      if (!CheckName.empty() && CTContext->treatAsError(CheckName)) {
+        Level = DiagnosticsEngine::Error;
+      }
+    }
+
+    StoreDiags::HandleDiagnostic(Level, Info);
+  }
+
 private:
   tidy::ClangTidyContext *CTContext = nullptr;
 };


Index: clang-tools-extra/clangd/ClangdUnit.cpp
===================================================================
--- clang-tools-extra/clangd/ClangdUnit.cpp
+++ clang-tools-extra/clangd/ClangdUnit.cpp
@@ -304,6 +304,21 @@
     this->CTContext = CTContext;
   }
 
+  void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel,
+                        const clang::Diagnostic &Info) override {
+    DiagnosticsEngine::Level Level = DiagLevel;
+
+    // Check for warning-as-error.
+    if (CTContext && DiagLevel == DiagnosticsEngine::Warning) {
+      std::string CheckName = CTContext->getCheckName(Info.getID());
+      if (!CheckName.empty() && CTContext->treatAsError(CheckName)) {
+        Level = DiagnosticsEngine::Error;
+      }
+    }
+
+    StoreDiags::HandleDiagnostic(Level, Info);
+  }
+
 private:
   tidy::ClangTidyContext *CTContext = nullptr;
 };
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to