From a667ace90c22ecee67ce95fd21ffe66fb514a17f Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Thu, 3 Nov 2016 18:03:14 +0000 Subject: Instead of resetting the pointer, or releasing it which was the previous code, let's just assert that the DiagonsticEngine doesn't own the client because our constructor took ownership of it and has a std::unique_ptr that handles deleting it. This seems much more clear -- the release was harmless but confusing as if there were some memory there it would have leaked, and the reset was harmless but confusing as if there were some memory there it would have been double-freed. But in both cases there was nothing there. llvm-svn: 285950 --- clang/lib/Frontend/VerifyDiagnosticConsumer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'clang') diff --git a/clang/lib/Frontend/VerifyDiagnosticConsumer.cpp b/clang/lib/Frontend/VerifyDiagnosticConsumer.cpp index 57ea9a0f8be..ae16ea177ff 100644 --- a/clang/lib/Frontend/VerifyDiagnosticConsumer.cpp +++ b/clang/lib/Frontend/VerifyDiagnosticConsumer.cpp @@ -43,7 +43,8 @@ VerifyDiagnosticConsumer::~VerifyDiagnosticConsumer() { assert(!CurrentPreprocessor && "CurrentPreprocessor should be invalid!"); SrcManager = nullptr; CheckDiagnostics(); - Diags.takeClient().reset(); + assert(!Diags.ownsClient() && + "The VerifyDiagnosticConsumer takes over ownership of the client!"); } #ifndef NDEBUG -- cgit v1.2.3