]> granicus.if.org Git - clang/commitdiff
Instead of resetting the pointer, or releasing it which was the previous
authorChandler Carruth <chandlerc@gmail.com>
Thu, 3 Nov 2016 18:03:14 +0000 (18:03 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Thu, 3 Nov 2016 18:03:14 +0000 (18:03 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@285950 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Frontend/VerifyDiagnosticConsumer.cpp

index 57ea9a0f8be7515c26f6fe949126003ab0f858e3..ae16ea177ffedef6948bb9ec23f07f1a248971d3 100644 (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