[PATCH] D17511: [analyzer] Make ObjCDeallocChecker path sensitive.

Devin Coughlin via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 24 17:44:45 PST 2016


dcoughlin added inline comments.

================
Comment at: lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp:184
@@ -144,21 +183,3 @@
 
-  // Determine if the class subclasses NSObject.
-  IdentifierInfo* NSObjectII = &Ctx.Idents.get("NSObject");
-  IdentifierInfo* SenTestCaseII = &Ctx.Idents.get("SenTestCase");
-
-  for ( ; ID ; ID = ID->getSuperClass()) {
-    IdentifierInfo *II = ID->getIdentifier();
-
-    if (II == NSObjectII)
-      break;
-
-    // FIXME: For now, ignore classes that subclass SenTestCase, as these don't
-    // need to implement -dealloc.  They implement tear down in another way,
-    // which we should try and catch later.
-    //  http://llvm.org/bugs/show_bug.cgi?id=3187
-    if (II == SenTestCaseII)
-      return;
-  }
-
-  if (!ID)
+  if (isSuppressedClass(ID))
     return;
----------------
I've changed the method name to 'classHasSeparateTeardown()'.

================
Comment at: lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp:249
@@ +248,3 @@
+    // in that location has not changed.
+    State = State->bindLoc(LValLoc.getValue(), InitialVal,
+                           /*notifyChanges*/false);
----------------
I've removed this. It is not needed now that the program state is a map from instance symbols to sets of initial field values that must be released.

================
Comment at: lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp:383
@@ +382,3 @@
+    // at, for example, both a return and at the end of of the function.
+    State = State->remove<UnreleasedIvarValues>(IvarSymbol);
+
----------------
I've added an assertion to catch when these aren't being removed. (You were right, they weren't always.)


http://reviews.llvm.org/D17511





More information about the cfe-commits mailing list