r207128 - Squelch leak found by LSan by handling missing switch case.

Jordan Rose jordan_rose at apple.com
Thu Apr 24 10:27:19 PDT 2014


Author: jrose
Date: Thu Apr 24 12:27:18 2014
New Revision: 207128

URL: http://llvm.org/viewvc/llvm-project?rev=207128&view=rev
Log:
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

Modified:
    cfe/trunk/lib/Sema/DelayedDiagnostic.cpp

Modified: cfe/trunk/lib/Sema/DelayedDiagnostic.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/DelayedDiagnostic.cpp?rev=207128&r1=207127&r2=207128&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/DelayedDiagnostic.cpp (original)
+++ cfe/trunk/lib/Sema/DelayedDiagnostic.cpp Thu Apr 24 12:27:18 2014
@@ -52,12 +52,13 @@ DelayedDiagnostic::makeAvailability(Sema
 }
 
 void DelayedDiagnostic::Destroy() {
-  switch (Kind) {
+  switch (static_cast<DDKind>(Kind)) {
   case Access: 
     getAccessData().~AccessedEntity(); 
     break;
 
-  case Deprecation: 
+  case Deprecation:
+  case Unavailable:
     delete [] DeprecationData.Message;
     break;
 





More information about the cfe-commits mailing list