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
This commit is contained in:
Chandler Carruth
2016-11-03 18:03:14 +00:00
parent f91282e1cf
commit a667ace90c

View File

@@ -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