[cfe-commits] [PATCH] new clang-analyzer checker that verifies ObjC API usage in UIViewController subclasses [v4]

Jordan Rose jordan_rose at apple.com
Fri Oct 26 09:26:49 PDT 2012


  Looking good! I still think the end of the function is a better place to warn -- the dealloc checker hasn't been used since we've gotten the compiler warning, so I'd rather be consistent with the warning than the old checker.


================
Comment at: lib/StaticAnalyzer/Checkers/ObjCMissingSuperCallChecker.cpp:78-86
@@ +77,11 @@
+  IdentifierInfo *ViewControllerII = &Ctx.Idents.get("UIViewController");
+  bool IsViewController = false;
+
+  // Determine if the class subclasses UIViewController.
+  for ( ; ID ; ID = ID->getSuperClass()) {
+    IdentifierInfo *II = ID->getIdentifier();
+
+    if (II == ViewControllerII)
+      IsViewController = true;
+  }
+
----------------
Thinking about this a little more, this should probably be moved into a separate function with an early return. It's not a big deal but it is [[http://llvm.org/docs/CodingStandards.html#turn-predicate-loops-into-predicate-functions | mentioned in our coding standards]].


http://llvm-reviews.chandlerc.com/D78



More information about the cfe-commits mailing list