[clang] [llvm] DiagnosticHandler: refactor error checking (PR #75889)

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 19 14:53:06 PST 2023


================
@@ -256,10 +256,13 @@ void LLVMContext::diagnose(const DiagnosticInfo &DI) {
       RS->emit(*OptDiagBase);
 
   // If there is a report handler, use it.
-  if (pImpl->DiagHandler &&
-      (!pImpl->RespectDiagnosticFilters || isDiagnosticEnabled(DI)) &&
-      pImpl->DiagHandler->handleDiagnostics(DI))
-    return;
+  if (pImpl->DiagHandler) {
+    if (DI.getSeverity() == DS_Error)
+      pImpl->DiagHandler->HasErrors = true;
----------------
MaskRay wrote:

Since `DiagnosticHandler` members are all public (and I do not want to change this), it seems that we could just avoid defining a new function, which is not supposed to be called elsewhere anyway...

https://github.com/llvm/llvm-project/pull/75889


More information about the cfe-commits mailing list