[clang] [Clang] Fix assertion failure in SDiagsWriter when finish() is not called (PR #181712)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 17 09:20:12 PST 2026


================
@@ -146,7 +146,10 @@ class SDiagsWriter : public DiagnosticConsumer {
     EmitPreamble();
   }
 
-  ~SDiagsWriter() override {}
+  ~SDiagsWriter() override {
----------------
AaronBallman wrote:

I'm not certain this is the right direction -- `SDiagsWriter` is a subclass of `DiagnosticConsumer` which defines the contract for `finish()`. So this means some subclasses will automagically handle `finish()` while others won't. WDYT about calling `finish()` explicitly in tooling? That means any diagnostic consumer will behave correctly, not just serialized diagnostics.

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


More information about the cfe-commits mailing list