[PATCH] [analyzer] Remove dead code in ObjCDeallocChecker that checked for a missing [super dealloc] call

David Kilzer ddkilzer at kilzer.net
Fri Aug 22 04:50:47 PDT 2014


Fix patch context by uploading through arc.

http://reviews.llvm.org/D5017

Files:
  lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp

Index: lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp
===================================================================
--- lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp
+++ lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp
@@ -28,27 +28,6 @@
 using namespace clang;
 using namespace ento;
 
-static bool scan_dealloc(Stmt *S, Selector Dealloc) {
-
-  if (ObjCMessageExpr *ME = dyn_cast<ObjCMessageExpr>(S))
-    if (ME->getSelector() == Dealloc) {
-      switch (ME->getReceiverKind()) {
-      case ObjCMessageExpr::Instance: return false;
-      case ObjCMessageExpr::SuperInstance: return true;
-      case ObjCMessageExpr::Class: break;
-      case ObjCMessageExpr::SuperClass: break;
-      }
-    }
-
-  // Recurse to children.
-
-  for (Stmt::child_iterator I = S->child_begin(), E= S->child_end(); I!=E; ++I)
-    if (*I && scan_dealloc(*I, Dealloc))
-      return true;
-
-  return false;
-}
-
 static bool scan_ivar_release(Stmt *S, ObjCIvarDecl *ID,
                               const ObjCPropertyDecl *PD,
                               Selector Release,
@@ -181,24 +160,6 @@
     return;
   }
 
-  // dealloc found.  Scan for missing [super dealloc].
-  if (MD->getBody() && !scan_dealloc(MD->getBody(), S)) {
-
-    const char* name = LOpts.getGC() == LangOptions::NonGC
-                       ? "missing [super dealloc]"
-                       : "missing [super dealloc] (Hybrid MM, non-GC)";
-
-    std::string buf;
-    llvm::raw_string_ostream os(buf);
-    os << "The 'dealloc' instance method in Objective-C class '" << *D
-       << "' does not send a 'dealloc' message to its super class"
-           " (missing [super dealloc])";
-
-    BR.EmitBasicReport(MD, Checker, name, categories::CoreFoundationObjectiveC,
-                       os.str(), DLoc);
-    return;
-  }
-
   // Get the "release" selector.
   IdentifierInfo* RII = &Ctx.Idents.get("release");
   Selector RS = Ctx.Selectors.getSelector(0, &RII);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D5017.12838.patch
Type: text/x-patch
Size: 1948 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140822/1daf962e/attachment.bin>


More information about the cfe-commits mailing list