[clang] [Clang] Fix assertion failure in SDiagsWriter when finish() is not called (PR #181712)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 16 10:43:50 PST 2026
================
@@ -146,7 +146,10 @@ class SDiagsWriter : public DiagnosticConsumer {
EmitPreamble();
}
- ~SDiagsWriter() override {}
+ ~SDiagsWriter() override {
+ if (OriginalInstance && !IsFinishing)
----------------
zeyi2 wrote:
I used a RAII approach to ensure blocks are always closed during early exits. I'm not certain if this is the preferred way here. I checked LLVM Coding Standards but didn't find specific guidance regarding RAII safety guards. If Tooling prefers a more explicit cleanup path or has other conventions, I'll refactor this based on your feedback :)
https://github.com/llvm/llvm-project/pull/181712
More information about the cfe-commits
mailing list