diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2016-11-03 18:03:14 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2016-11-03 18:03:14 +0000 |
commit | a667ace90c22ecee67ce95fd21ffe66fb514a17f (patch) | |
tree | e94fddd1df917cade6ad2591308e6fd798485188 /clang/lib/Frontend/VerifyDiagnosticConsumer.cpp | |
parent | f91282e1cf6871f933bc7186332f47f3d4b38b7d (diff) | |
download | bcm5719-llvm-a667ace90c22ecee67ce95fd21ffe66fb514a17f.tar.gz bcm5719-llvm-a667ace90c22ecee67ce95fd21ffe66fb514a17f.zip |
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
Diffstat (limited to 'clang/lib/Frontend/VerifyDiagnosticConsumer.cpp')
-rw-r--r-- | clang/lib/Frontend/VerifyDiagnosticConsumer.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
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 |