[PATCH] D12123: [analyzer] Skip Pre/Post handlers for ObjC calls when receiver is nil.

Devin Coughlin via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 19 16:30:46 PDT 2015


dcoughlin marked 5 inline comments as done.

================
Comment at: include/clang/StaticAnalyzer/Core/CheckerManager.h:96
@@ -95,1 +95,3 @@
 
+enum class ObjCCheckerKind {
+  PreVisit,
----------------
xazax.hun wrote:
> I do not really like the name ObjCCheckerKind, because it is not kind of an Obj-C related checker. It is the kind of the visit of the message expression. Maybe ObjCMessageVisitKind? Or just MessageVisitKind to be a bit shorter?
I've changed this to ObjCMessageVisitKind, as you suggested.

================
Comment at: lib/StaticAnalyzer/Core/ExprEngineObjC.cpp:153
@@ +152,3 @@
+      ProgramStateRef notNilState, nilState;
+      std::tie(notNilState, nilState) = State->assume(receiverVal);
+      if (nilState && !notNilState) {
----------------
xazax.hun wrote:
> The old code had a comment about merging two cases and a reference to a rdar. Is that rdar already fixed? Maybe it would be good to preserve the at least the first part of the commend?
Thanks for pointing this out! This revealed a deeper issue where the previous patch did not drop the non-nil flow after a method call when it was unknown whether the receiver was nil. I've fixed the behavior, added a comment explaining why it is needed, and added a test for it.


http://reviews.llvm.org/D12123





More information about the cfe-commits mailing list