[PATCH] D17528: [analyzer] Warn on use of 'self' after call to to [super dealloc].

Devin Coughlin via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 25 15:41:54 PST 2016


dcoughlin added inline comments.

================
Comment at: lib/StaticAnalyzer/Checkers/ObjCSuperDeallocChecker.cpp:165
@@ +164,3 @@
+  if (Desc.empty())
+    Desc = "use of 'self' after it is freed with call to [super dealloc]";
+
----------------
zaks.anna wrote:
> Does "has been freed" sound better?
Yes, changed it.

================
Comment at: test/Analysis/DeallocUseAfterFreeErrors.m:59
@@ +58,3 @@
+  [super dealloc]; // expected-note {{[super dealloc] called here}}
+  _delegate = nil; // expected-warning {{use of 'self' after it is freed with call to [super dealloc]}}
+      // expected-note at -1 {{use of 'self' after it is freed with call to [super dealloc]}}
----------------
zaks.anna wrote:
> Would it be possible to provide a more presice error message here? Specifically, we refer to 'self' here but the reference is implicit. I guess we could say something like "accessing an instance variable after the object has been freed". Would that require extra checking to ensure that we are indeed accessing a member in checkLocation?
I've updated this to be "use of instance variable '_ivar' after the instance has been freed with call to [super dealloc]".


Repository:
  rL LLVM

http://reviews.llvm.org/D17528





More information about the cfe-commits mailing list