From: Jordan Rose Date: Thu, 24 Apr 2014 17:27:18 +0000 (+0000) Subject: Squelch leak found by LSan by handling missing switch case. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5a48fb5809163f65ea20ddae64b08203dc94f05e;p=clang Squelch leak found by LSan by handling missing switch case. Also, use the enum type in the switch so this doesn't happen again. PR19523 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207128 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/DelayedDiagnostic.cpp b/lib/Sema/DelayedDiagnostic.cpp index 533b7ef3e8..ddecfdb376 100644 --- a/lib/Sema/DelayedDiagnostic.cpp +++ b/lib/Sema/DelayedDiagnostic.cpp @@ -52,12 +52,13 @@ DelayedDiagnostic::makeAvailability(Sema::AvailabilityDiagnostic AD, } void DelayedDiagnostic::Destroy() { - switch (Kind) { + switch (static_cast(Kind)) { case Access: getAccessData().~AccessedEntity(); break; - case Deprecation: + case Deprecation: + case Unavailable: delete [] DeprecationData.Message; break;